Class: Bizo::Client
Instance Method Summary collapse
- #account ⇒ Object
- #classify(params = {}) ⇒ Object
-
#initialize(key, secret) ⇒ Client
constructor
A new instance of Client.
- #profile ⇒ Object
- #taxonomy(opts = {}) ⇒ Object
Constructor Details
#initialize(key, secret) ⇒ Client
Returns a new instance of Client.
5 6 7 |
# File 'lib/bizo/client.rb', line 5 def initialize(key,secret) super(key,secret) end |
Instance Method Details
#account ⇒ Object
19 20 21 |
# File 'lib/bizo/client.rb', line 19 def account request :get, ACCOUNT_PATH end |
#classify(params = {}) ⇒ Object
9 10 11 12 13 |
# File 'lib/bizo/client.rb', line 9 def classify(params = {}) email = params[:email] params[:email] = Digest::SHA1.hexdigest(email.downcase) unless email.nil? request :get, CLASSIFY_PATH, params end |
#profile ⇒ Object
15 16 17 |
# File 'lib/bizo/client.rb', line 15 def profile request :get, PROFILE_PATH end |
#taxonomy(opts = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/bizo/client.rb', line 23 def taxonomy(opts = {}) taxonomy = request :get, TAXONOMY_PATH bizographics = taxonomy["taxonomy"]["bizographics"] unless opts[:exclude].nil? || opts[:exclude].empty? bizographics = bizographics.inject({}) do |filtered, pair| category, segments = pair filtered[category] = segments unless opts[:exclude].include?(category.to_sym) filtered end end if opts[:top_level] == true bizographics = bizographics.inject({}) do |filtered, pair| category, segments = pair segments.each do |segment| filtered[category] ||= [] filtered[category] << segment if segment["parent_code"].nil? end filtered end end bizographics end |