Coder Social home page Coder Social logo

jannewaren / ytj_client Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 1.0 185 KB

Client for communicating with Finnish Patent and Registration Office (PRH) API

License: MIT License

Ruby 98.65% Shell 1.35%
prh ytj-client ytj api-client kaupparekisteri kuulutustiedot

ytj_client's Introduction

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

ytj_client's People

Contributors

anakinj avatar jannewaren avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

anakinj

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.