Class: HubspotService
- Inherits:
-
Object
- Object
- HubspotService
- Defined in:
- app/services/hubspot_service.rb
Instance Attribute Summary collapse
-
#contact ⇒ Object
readonly
Returns the value of attribute contact.
-
#pipeline ⇒ Object
readonly
Returns the value of attribute pipeline.
Instance Method Summary collapse
-
#initialize(contact:) ⇒ HubspotService
constructor
A new instance of HubspotService.
- #save_lead_info ⇒ Object
Constructor Details
#initialize(contact:) ⇒ HubspotService
Returns a new instance of HubspotService.
6 7 8 |
# File 'app/services/hubspot_service.rb', line 6 def initialize(contact:) @contact = contact.attributes end |
Instance Attribute Details
#contact ⇒ Object (readonly)
Returns the value of attribute contact.
4 5 6 |
# File 'app/services/hubspot_service.rb', line 4 def contact @contact end |
#pipeline ⇒ Object (readonly)
Returns the value of attribute pipeline.
4 5 6 |
# File 'app/services/hubspot_service.rb', line 4 def pipeline @pipeline end |
Instance Method Details
#save_lead_info ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'app/services/hubspot_service.rb', line 10 def save_lead_info return if contact_exists? hubspot_contact = create_contact deal = create_deal company = create_company(contact["email"]) create_association({from_name: "contact", to_name: "deal", from_id: hubspot_contact.id, to_id: deal.id, type: "contact_to-deal"}) create_association({from_name: "contact", to_name: "company", from_id: hubspot_contact.id, to_id: company.id, type: "contact_to_company"}) create_association({from_name: "deal", to_name: "company", from_id: deal.id, to_id: company.id, type: "deal_to_company"}) create_association({from_name: "deal", to_name: "contact", from_id: deal.id, to_id: hubspot_contact.id, type: "deal_to_contact"}) end |