Project

ytj_client

0.0
No commit activity in last 3 years
No release in over 3 years
Fetches data with business_id from the YTJ API at http://avoindata.prh.fi/ytj.html
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
~> 0.10.4
~> 12.0
~> 3.0
~> 3.0
~> 2.3

Runtime

 Project Readme

ytj_client

Gem Version Dependency Status Build Status

Test Coverage Code Climate Issue Count

A really small gem to fetch and parse data from the Finnish Patent and Registration Office's (PRH) YTJ-tiedot (business information system) API at http://avoindata.prh.fi/ytj.html

Makes the API call for you and parses the relevant (in my opinion) information to a convenient format (Ruby hash).

Installation

Add this line to your application's Gemfile:

gem 'ytj_client', '~> 0.3'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install ytj_client

Usage

fetch_company

Fetch company details with a business_id:

require 'ytj_client'
YtjClient.fetch_company('2331972-7')
# => #Hash {
#           :business_id => "2331972-7",
#                  :name => "Verso Food Oy",
#     :registration_date => "2010-04-20",
#          :company_form => "OY",
#                :phones => {
#         :mobile_phone => "+358400770697"
#     },
#               :website => "www.versofood.fi",
#             :addresses => {
#         :visiting_address => "Loisteputki 4, 00750, HELSINKI",
#           :postal_address => "Loisteputki 4, 00750, HELSINKI"
#     }
# }

fetch_companies

Fetch companies between two dates.

require 'ytj_client'
companies = YtjClient.fetch_companies(start_date: '2017-05-01',
                                      end_date: '2017-05-31',
                                      options: { mode: :array })
companies.each { |company| p company.inspect }

fetch_all_companies

Fetch all companies that are available in the TR API since the year 1896. This is well over 300 000 companies so it will take a while. Saves the results in a companies.csv file.

require 'ytj_client'
YtjClient.fetch_all_companies

Version history

0.3.3 (2017-08-30)

  • Fix fetching details when no address is found

0.3.2 (2017-06-01)

  • Changed the field order in CSV file

0.3.1 (2017-05-31)

  • Minor changes, refactoring
  • Better documentation

0.3.0 (2017-05-31)

  • Breaking changes, new API methods:
    • fetch_company (fetch details of a company with business_id)
    • fetch_companies (fetch companies between two dates)
    • fetch_all_companies (fetch all companies since the year 1896)
  • fetch_companies supports :mode argument, to save into :csv or just return the :array
  • Dependency updates

0.2.3

  • Fixes to fetching all the companies:
    • fetch one year and 1000 companies at a time
    • save to csv right away

0.2.2

  • fetch all Finnish companies from TR api

0.2.1

  • first working Version
  • fetching company details with business_id