module Nzcoapi

Constants

VERSION

Public Class Methods

find_company(id) click to toggle source
# File lib/nzcoapi.rb, line 48
def self.find_company(id)
        headers "Timestamp" => Time.now.rfc2822 + " GMT"
        @@timestamp = Time.now.rfc2822 + " GMT"

        stringtosign = "GET" + "\n" + "www.businessdata.govt.nz" + "\n" + "/data/app/ws/rest/companies/entity/v2.0/#{id}" + "\n" + @@timestamp + "\n" + @@access_key + "\n" + "application/xml" + "\n"

        headers "Authorization" => @@access_key + ":" + Base64.strict_encode64(OpenSSL::HMAC.digest('sha256', @@secret_key, stringtosign))

        Nokogiri::XML((get("/data/app/ws/rest/companies/entity/v2.0/#{id}").body), 'UTF-8')

end
find_director(string) click to toggle source
# File lib/nzcoapi.rb, line 36
def self.find_director(string)
        headers "Timestamp" => Time.now.rfc2822 + " GMT"
        @@timestamp = Time.now.rfc2822 + " GMT"

        stringtosign = "GET" + "\n" + "www.businessdata.govt.nz" + "\n" + "/data/app/ws/rest/companies/role/search/v1.0/size/200/type/DIR/#{string}" + "\n" + @@timestamp + "\n" + @@access_key + "\n" + "application/xml" + "\n"

        headers "Authorization" => @@access_key + ":" + Base64.strict_encode64(OpenSSL::HMAC.digest('sha256', @@secret_key, stringtosign))

        Nokogiri::XML((get("/data/app/ws/rest/companies/role/search/v1.0/size/200/type/DIR/#{string}").body), 'UTF-8')

end
search_for_company(string) click to toggle source
# File lib/nzcoapi.rb, line 24
def self.search_for_company(string)
        headers "Timestamp" => Time.now.rfc2822 + " GMT"
        @@timestamp = Time.now.rfc2822 + " GMT"

        stringtosign = "GET" + "\n" + "www.businessdata.govt.nz" + "\n" + "/data/app/ws/rest/companies/entity/search/v2.0/#{string}" + "\n" + @@timestamp + "\n" + @@access_key + "\n" + "application/xml" + "\n"

        headers "Authorization" => @@access_key + ":" + Base64.strict_encode64(OpenSSL::HMAC.digest('sha256', @@secret_key, stringtosign))
        headers "Timestamp" => Time.now.rfc2822 + " GMT"

        Nokogiri::XML((get("/data/app/ws/rest/companies/entity/search/v2.0/#{string}").body), 'UTF-8')
end
tagged(tag) click to toggle source
# File lib/nzcoapi.rb, line 62
def self.tagged(tag)
        retrieve_url get("/#{tag}.json")
end