Skip to content

Instantly share code, notes, and snippets.

@bkenny
Created April 29, 2012 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bkenny/2551404 to your computer and use it in GitHub Desktop.
Save bkenny/2551404 to your computer and use it in GitHub Desktop.
CRO API Services
# CRO API Access by @bkenny
#
# Example, to search for a company use: CRO.new(email_address, api_key).companies("Starbucks")
# To search for a companies submissions: CRO.new(email_address, api_key).submissions("315499", "c")
require 'rubygems'
require 'httparty'
require 'hashie'
class CRO
def initialize(u, p)
@auth = {:username => u, :password => p}
end
def companies(company_name)
@results = HTTParty.get("https://services.cro.ie/cws/companies?company_name=" + company_name + "&searchType=3&format=json", :basic_auth => @auth)
@results.each do |result|
@json = Hashie::Mash.new(result)
end
end
def submissions(company_num, company_type)
@results = HTTParty.get("https://services.cro.ie/cws/submissions?company_bus_ind=" + company_type + "&company_num=" + company_num + "&format=json", :basic_auth => @auth)
@results.each do |result|
@json = Hashie::Mash.new(result)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment