Class: Beeleads::Client
- Inherits:
-
Object
- Object
- Beeleads::Client
- Defined in:
- lib/beeleads.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #lead(data) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 11 |
# File 'lib/beeleads.rb', line 6 def initialize(={}) instance_variable_set(:@api_url, 'https://hive.bldstools.com/api.php/v1/lead/') self.class.keys.each do |key| instance_variable_set(:"@#{key}", [key]) if [key] end end |
Instance Method Details
#lead(data) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/beeleads.rb', line 13 def lead(data) uri = URI(@api_url) conn = Faraday.new(:url => "#{uri.scheme}://#{uri.host}", :ssl => {:verify => false}) response = conn.get uri.path, {'token' => self.class.token(@api_secret, data), 'affiliate_id' => @api_affiliate_id, 'offer_id' => @api_offer_id, 'field' => data} JSON.parse(response.body) end |