Class: Hubscreen::Contact
Overview
HubSpot Contacts API
https://developers.hubspot.com/docs/methods/contacts/contacts-overview
This is a convenience object for single Hubspot contact returned by the API
Constant Summary collapse
- CONTACT_KEYS =
[:properties, :vid, :email, :first_name, :last_name, :hubspot_owner_id]
Instance Attribute Summary
Attributes inherited from Response
Instance Method Summary collapse
-
#initialize(response) ⇒ Contact
constructor
A new instance of Contact.
- #inspect ⇒ Object
- #parse_response ⇒ Object
Methods inherited from Response
Constructor Details
#initialize(response) ⇒ Contact
Returns a new instance of Contact.
20 21 22 23 24 |
# File 'lib/hubscreen/contact.rb', line 20 def initialize(response) @raw_hash = response.raw_hash @raw_response = response.raw_response parse_response end |
Instance Method Details
#inspect ⇒ Object
36 37 38 |
# File 'lib/hubscreen/contact.rb', line 36 def inspect "<Hubscreen::Contact vid:#{@vid}, email:'#{@email}', first_name:'#{@first_name}', last_name:'#{@last_name}', company:'#{@company}', hubspot_owner_id:'#{@hubspot_owner_id}', properties:<Not Shown>, raw_response:<Not Shown>, raw_hash:<Not Shown>>" end |
#parse_response ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/hubscreen/contact.rb', line 26 def parse_response @properties = @raw_response.properties @vid = @raw_hash["vid"] @email = @raw_hash["properties"]["email"]["value"] if @raw_hash["properties"].has_key?("email") @first_name = @raw_hash["properties"]["firstname"]["value"] if @raw_hash["properties"].has_key?("firstname") @last_name = @raw_hash["properties"]["lastname"]["value"] if @raw_hash["properties"].has_key?("lastname") @company = @raw_hash["properties"]["company"]["value"] if @raw_hash["properties"].has_key?("company") @hubspot_owner_id = @raw_hash["properties"]["hubspot_owner_id"]["value"] if @raw_hash["properties"].has_key?("hubspot_owner_id") end |