hubspot_client 0.1.0.beta2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.gitignore +1 -0
 - data/.rubocop.yml +5 -1
 - data/CHANGELOG.md +9 -0
 - data/Gemfile +1 -1
 - data/Gemfile.lock +1 -1
 - data/README.md +13 -7
 - data/hubspot_client.gemspec +2 -2
 - data/lib/hubspot_client/client/communication_preference.rb +39 -0
 - data/lib/hubspot_client/client/company.rb +6 -6
 - data/lib/hubspot_client/client/contact.rb +7 -7
 - data/lib/hubspot_client/client_base_error.rb +8 -0
 - data/lib/hubspot_client/model/communication_preference.rb +11 -0
 - data/lib/hubspot_client/model/company.rb +2 -6
 - data/lib/hubspot_client/model/contact.rb +14 -6
 - data/lib/hubspot_client/version.rb +1 -1
 - data/lib/hubspot_client.rb +7 -4
 - metadata +10 -5
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 29ef10cf9b14d327f1d9990684aca8cfe7c7988cbf26cb4420c20bc14c18d237
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: fded388fb01ad2b338ba0ba32631553d24e72612fa0866644c9d95725b91542d
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e5b1458f89a50a95e1323b984329b10b47a992e05b8f1a662935ada633d019e111043de8e4ec31c453fb61f8421bca05be70c63d32629f556ac216b49e60d383
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 512dfc4ba03b80366059709c74ea09559c5e925c339dbdc556b4a24efd0d81db9cedd99ff90c308890c5e1b7fce83c2aeb034ed1a1d69f9cf58e4565f8879774
         
     | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/.rubocop.yml
    CHANGED
    
    
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/Gemfile
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,7 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         | 
| 
       2 
2 
     | 
    
         
             
            # HubspotClient
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
      
 4 
     | 
    
         
            +
            A Hubspot Client. Currently we only support the following CRM Parts:
         
     | 
| 
      
 5 
     | 
    
         
            +
            * Contact
         
     | 
| 
      
 6 
     | 
    
         
            +
            * Company
         
     | 
| 
      
 7 
     | 
    
         
            +
            * Properties
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            Also:
         
     | 
| 
      
 10 
     | 
    
         
            +
            * Communication Preferences
         
     | 
| 
       5 
11 
     | 
    
         | 
| 
       6 
12 
     | 
    
         
             
            ## Installation
         
     | 
| 
       7 
13 
     | 
    
         | 
| 
         @@ -21,7 +27,7 @@ Or install it yourself as: 
     | 
|
| 
       21 
27 
     | 
    
         | 
| 
       22 
28 
     | 
    
         
             
            ## Usage
         
     | 
| 
       23 
29 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
            You need to configure the ` 
     | 
| 
      
 30 
     | 
    
         
            +
            You need to configure the `hubspot_client` first:
         
     | 
| 
       25 
31 
     | 
    
         
             
            ``` ruby
         
     | 
| 
       26 
32 
     | 
    
         
             
            HubspotClient.configure do |config|
         
     | 
| 
       27 
33 
     | 
    
         
             
              config.access_token = 'PRIVATE_APP_ACCESS_TOKEN'
         
     | 
| 
         @@ -30,9 +36,10 @@ end 
     | 
|
| 
       30 
36 
     | 
    
         | 
| 
       31 
37 
     | 
    
         
             
            ## Models
         
     | 
| 
       32 
38 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
            The  
     | 
| 
      
 39 
     | 
    
         
            +
            The following models exists and should be mainly used. However you can also use the clients itself,
         
     | 
| 
      
 40 
     | 
    
         
            +
            if you like, but you need to understand the code by yourself.
         
     | 
| 
       34 
41 
     | 
    
         | 
| 
       35 
     | 
    
         
            -
            ### Contact 
     | 
| 
      
 42 
     | 
    
         
            +
            ### Contact
         
     | 
| 
       36 
43 
     | 
    
         | 
| 
       37 
44 
     | 
    
         
             
            [Hubspot- API](https://developers.hubspot.com/docs/api/crm/contacts)
         
     | 
| 
       38 
45 
     | 
    
         | 
| 
         @@ -47,9 +54,8 @@ HubspotClient::Model::Contact.find(email: 'vader@example.com') 
     | 
|
| 
       47 
54 
     | 
    
         
             
            => #<HubspotClient::Model::Contact createdate="2022-11-11T11:57:15.901Z", email="vader@example.com", firstname="Darth", hs_object_id="1337", lastmodifieddate="2022-11-17T13:31:00.526Z", lastname="Vader">
         
     | 
| 
       48 
55 
     | 
    
         
             
            ```
         
     | 
| 
       49 
56 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
            ####  
     | 
| 
      
 57 
     | 
    
         
            +
            #### associate_primary_company
         
     | 
| 
       51 
58 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
            Successfull Request
         
     | 
| 
       53 
59 
     | 
    
         
             
            ```ruby
         
     | 
| 
       54 
60 
     | 
    
         
             
            hubspot_contact = HubspotClient::Model::Contact.find(hubspot_id: '1337')
         
     | 
| 
       55 
61 
     | 
    
         
             
            => #<HubspotClient::Model::Contact createdate="2022-11-11T11:57:15.901Z", email="vader@example.com", firstname="Darth", hs_object_id="1337", lastmodifieddate="2022-11-17T13:31:00.526Z", lastname="Vader"> 
         
     | 
| 
         @@ -104,7 +110,7 @@ hubspot_company.update({ name: 'Blubber' }) 
     | 
|
| 
       104 
110 
     | 
    
         | 
| 
       105 
111 
     | 
    
         | 
| 
       106 
112 
     | 
    
         | 
| 
       107 
     | 
    
         
            -
            ###  
     | 
| 
      
 113 
     | 
    
         
            +
            ### Communication-Preference
         
     | 
| 
       108 
114 
     | 
    
         | 
| 
       109 
115 
     | 
    
         
             
            [Hubspot- API](https://developers.hubspot.com/docs/api/marketing-api/subscriptions-preferences)
         
     | 
| 
       110 
116 
     | 
    
         | 
    
        data/hubspot_client.gemspec
    CHANGED
    
    | 
         @@ -7,8 +7,8 @@ require 'hubspot_client/version' 
     | 
|
| 
       7 
7 
     | 
    
         
             
            Gem::Specification.new do |spec|
         
     | 
| 
       8 
8 
     | 
    
         
             
              spec.name          = 'hubspot_client'
         
     | 
| 
       9 
9 
     | 
    
         
             
              spec.version       = HubspotClient::VERSION
         
     | 
| 
       10 
     | 
    
         
            -
              spec.authors       = %w[Garllon]
         
     | 
| 
       11 
     | 
    
         
            -
              spec.email         = [ 
     | 
| 
      
 10 
     | 
    
         
            +
              spec.authors       = %w[Garllon romankonz]
         
     | 
| 
      
 11 
     | 
    
         
            +
              spec.email         = %w[garllon@protonmail.com roman@konz.me]
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
              spec.summary       = 'Hubspot client'
         
     | 
| 
       14 
14 
     | 
    
         
             
              spec.description   = 'Hubspot client to handle CRM objects.'
         
     | 
| 
         @@ -0,0 +1,39 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module HubspotClient
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Client
         
     | 
| 
      
 5 
     | 
    
         
            +
                class SubscriptionNotSuccessful < ClientBaseError; end
         
     | 
| 
      
 6 
     | 
    
         
            +
                class FetchDefinitionsNotSuccessful < ClientBaseError; end
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                class CommunicationPreference
         
     | 
| 
      
 9 
     | 
    
         
            +
                  include HTTParty
         
     | 
| 
      
 10 
     | 
    
         
            +
                  base_uri 'https://api.hubapi.com'
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  BASE_PATH = '/communication-preferences/v3'
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  def definitions
         
     | 
| 
      
 15 
     | 
    
         
            +
                    response = self.class.get("#{BASE_PATH}/definitions",
         
     | 
| 
      
 16 
     | 
    
         
            +
                                              headers: headers)
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                    return response if response.code == 200
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                    raise FetchDefinitionsNotSuccessful, response
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  def subscribe(properties)
         
     | 
| 
      
 24 
     | 
    
         
            +
                    response = self.class.post("#{BASE_PATH}/subscribe",
         
     | 
| 
      
 25 
     | 
    
         
            +
                                               body: properties.to_json,
         
     | 
| 
      
 26 
     | 
    
         
            +
                                               headers: headers)
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                    return response if response.code == 200
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                    raise SubscriptionNotSuccessful, response
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  def headers
         
     | 
| 
      
 34 
     | 
    
         
            +
                    { Authorization: "Bearer #{HubspotClient.configuration.access_token}",
         
     | 
| 
      
 35 
     | 
    
         
            +
                      'Content-Type': 'application/json' }
         
     | 
| 
      
 36 
     | 
    
         
            +
                  end
         
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -2,9 +2,9 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            module HubspotClient
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Client
         
     | 
| 
       5 
     | 
    
         
            -
                class CompanyNotFound <  
     | 
| 
       6 
     | 
    
         
            -
                class CompanyNotCreated <  
     | 
| 
       7 
     | 
    
         
            -
                class CompanyNotUpdated <  
     | 
| 
      
 5 
     | 
    
         
            +
                class CompanyNotFound < ClientBaseError; end
         
     | 
| 
      
 6 
     | 
    
         
            +
                class CompanyNotCreated < ClientBaseError; end
         
     | 
| 
      
 7 
     | 
    
         
            +
                class CompanyNotUpdated < ClientBaseError; end
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                class Company
         
     | 
| 
       10 
10 
     | 
    
         
             
                  include HTTParty
         
     | 
| 
         @@ -18,7 +18,7 @@ module HubspotClient 
     | 
|
| 
       18 
18 
     | 
    
         
             
                                              headers: headers)
         
     | 
| 
       19 
19 
     | 
    
         
             
                    return response if response.code == 200
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
                    raise CompanyNotFound,  
     | 
| 
      
 21 
     | 
    
         
            +
                    raise CompanyNotFound, response
         
     | 
| 
       22 
22 
     | 
    
         
             
                  end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
                  def create(properties)
         
     | 
| 
         @@ -28,7 +28,7 @@ module HubspotClient 
     | 
|
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
                    return response if response.code == 201
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
                    raise CompanyNotCreated,  
     | 
| 
      
 31 
     | 
    
         
            +
                    raise CompanyNotCreated, response
         
     | 
| 
       32 
32 
     | 
    
         
             
                  end
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
                  def update(hubspot_id, properties)
         
     | 
| 
         @@ -38,7 +38,7 @@ module HubspotClient 
     | 
|
| 
       38 
38 
     | 
    
         | 
| 
       39 
39 
     | 
    
         
             
                    return response if response.code == 200
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
                    raise CompanyNotUpdated,  
     | 
| 
      
 41 
     | 
    
         
            +
                    raise CompanyNotUpdated, response
         
     | 
| 
       42 
42 
     | 
    
         
             
                  end
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
44 
     | 
    
         
             
                  private
         
     | 
| 
         @@ -2,10 +2,10 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            module HubspotClient
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Client
         
     | 
| 
       5 
     | 
    
         
            -
                class ContactNotFound <  
     | 
| 
       6 
     | 
    
         
            -
                class ContactNotCreated <  
     | 
| 
       7 
     | 
    
         
            -
                class ContactNotUpdated <  
     | 
| 
       8 
     | 
    
         
            -
                class AssociationError <  
     | 
| 
      
 5 
     | 
    
         
            +
                class ContactNotFound < ClientBaseError; end
         
     | 
| 
      
 6 
     | 
    
         
            +
                class ContactNotCreated < ClientBaseError; end
         
     | 
| 
      
 7 
     | 
    
         
            +
                class ContactNotUpdated < ClientBaseError; end
         
     | 
| 
      
 8 
     | 
    
         
            +
                class AssociationError < ClientBaseError; end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
                class Contact
         
     | 
| 
       11 
11 
     | 
    
         
             
                  include HTTParty
         
     | 
| 
         @@ -32,7 +32,7 @@ module HubspotClient 
     | 
|
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
                    return response if response.code == 201
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
     | 
    
         
            -
                    raise ContactNotCreated,  
     | 
| 
      
 35 
     | 
    
         
            +
                    raise ContactNotCreated, response
         
     | 
| 
       36 
36 
     | 
    
         
             
                  end
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         
             
                  def update(hubspot_id, properties)
         
     | 
| 
         @@ -42,7 +42,7 @@ module HubspotClient 
     | 
|
| 
       42 
42 
     | 
    
         | 
| 
       43 
43 
     | 
    
         
             
                    return response if response.code == 200
         
     | 
| 
       44 
44 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
                    raise ContactNotUpdated,  
     | 
| 
      
 45 
     | 
    
         
            +
                    raise ContactNotUpdated, response
         
     | 
| 
       46 
46 
     | 
    
         
             
                  end
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
       48 
48 
     | 
    
         
             
                  def associate_with(hubspot_id, to_object_type, to_object_type_id, association_type = '1')
         
     | 
| 
         @@ -60,7 +60,7 @@ module HubspotClient 
     | 
|
| 
       60 
60 
     | 
    
         
             
                    response = self.class.get(path, headers: headers)
         
     | 
| 
       61 
61 
     | 
    
         
             
                    return response if response.code == 200
         
     | 
| 
       62 
62 
     | 
    
         | 
| 
       63 
     | 
    
         
            -
                    raise ContactNotFound,  
     | 
| 
      
 63 
     | 
    
         
            +
                    raise ContactNotFound, response
         
     | 
| 
       64 
64 
     | 
    
         
             
                  end
         
     | 
| 
       65 
65 
     | 
    
         | 
| 
       66 
66 
     | 
    
         
             
                  def find_query_params(query_params = {})
         
     | 
| 
         @@ -3,8 +3,6 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module HubspotClient
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Model
         
     | 
| 
       5 
5 
     | 
    
         
             
                class Company < OpenStruct
         
     | 
| 
       6 
     | 
    
         
            -
                  UPDATABLE_PROPERTIES = %i[name phone address city zip].freeze
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
6 
     | 
    
         
             
                  def self.find(hubspot_id: nil)
         
     | 
| 
       9 
7 
     | 
    
         
             
                    response = Client::Company.new.find_by_id(hubspot_id)
         
     | 
| 
       10 
8 
     | 
    
         | 
| 
         @@ -14,16 +12,14 @@ module HubspotClient 
     | 
|
| 
       14 
12 
     | 
    
         
             
                  end
         
     | 
| 
       15 
13 
     | 
    
         | 
| 
       16 
14 
     | 
    
         
             
                  def self.create(properties)
         
     | 
| 
       17 
     | 
    
         
            -
                     
     | 
| 
       18 
     | 
    
         
            -
                    response = Client::Company.new.create(sliced_properties)
         
     | 
| 
      
 15 
     | 
    
         
            +
                    response = Client::Company.new.create(properties)
         
     | 
| 
       19 
16 
     | 
    
         | 
| 
       20 
17 
     | 
    
         
             
                    new(response['properties'])
         
     | 
| 
       21 
18 
     | 
    
         
             
                  end
         
     | 
| 
       22 
19 
     | 
    
         | 
| 
       23 
20 
     | 
    
         
             
                  def update(new_properties = {})
         
     | 
| 
       24 
21 
     | 
    
         
             
                    assign_attributes(new_properties)
         
     | 
| 
       25 
     | 
    
         
            -
                     
     | 
| 
       26 
     | 
    
         
            -
                    response = Client::Company.new.update(hs_object_id, properties)
         
     | 
| 
      
 22 
     | 
    
         
            +
                    response = Client::Company.new.update(hs_object_id, to_h)
         
     | 
| 
       27 
23 
     | 
    
         | 
| 
       28 
24 
     | 
    
         
             
                    return true if response.code == 200
         
     | 
| 
       29 
25 
     | 
    
         | 
| 
         @@ -5,8 +5,6 @@ module HubspotClient 
     | 
|
| 
       5 
5 
     | 
    
         
             
                class MissingParameter < StandardError; end
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                class Contact < OpenStruct
         
     | 
| 
       8 
     | 
    
         
            -
                  UPDATABLE_PROPERTIES = %i[firstname lastname email phone lifecyclestage].freeze
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
8 
     | 
    
         
             
                  def self.find(hubspot_id: nil, email: nil)
         
     | 
| 
       11 
9 
     | 
    
         
             
                    response = if hubspot_id
         
     | 
| 
       12 
10 
     | 
    
         
             
                                 Client::Contact.new.find_by_id(hubspot_id)
         
     | 
| 
         @@ -20,16 +18,14 @@ module HubspotClient 
     | 
|
| 
       20 
18 
     | 
    
         
             
                  end
         
     | 
| 
       21 
19 
     | 
    
         | 
| 
       22 
20 
     | 
    
         
             
                  def self.create(properties)
         
     | 
| 
       23 
     | 
    
         
            -
                     
     | 
| 
       24 
     | 
    
         
            -
                    response = Client::Contact.new.create(sliced_properties)
         
     | 
| 
      
 21 
     | 
    
         
            +
                    response = Client::Contact.new.create(properties)
         
     | 
| 
       25 
22 
     | 
    
         | 
| 
       26 
23 
     | 
    
         
             
                    new(response['properties'])
         
     | 
| 
       27 
24 
     | 
    
         
             
                  end
         
     | 
| 
       28 
25 
     | 
    
         | 
| 
       29 
26 
     | 
    
         
             
                  def update(new_properties = {})
         
     | 
| 
       30 
27 
     | 
    
         
             
                    assign_attributes(new_properties)
         
     | 
| 
       31 
     | 
    
         
            -
                     
     | 
| 
       32 
     | 
    
         
            -
                    response = Client::Contact.new.update(hs_object_id, properties)
         
     | 
| 
      
 28 
     | 
    
         
            +
                    response = Client::Contact.new.update(hs_object_id, to_h)
         
     | 
| 
       33 
29 
     | 
    
         | 
| 
       34 
30 
     | 
    
         
             
                    return true if response.code == 200
         
     | 
| 
       35 
31 
     | 
    
         | 
| 
         @@ -45,6 +41,18 @@ module HubspotClient 
     | 
|
| 
       45 
41 
     | 
    
         
             
                    self
         
     | 
| 
       46 
42 
     | 
    
         
             
                  end
         
     | 
| 
       47 
43 
     | 
    
         | 
| 
      
 44 
     | 
    
         
            +
                  def create_communication_subscription(subscription_id:, legal_basis: nil, legal_basis_explanation: nil)
         
     | 
| 
      
 45 
     | 
    
         
            +
                    properties = {
         
     | 
| 
      
 46 
     | 
    
         
            +
                      emailAddress: email,
         
     | 
| 
      
 47 
     | 
    
         
            +
                      subscriptionId: subscription_id
         
     | 
| 
      
 48 
     | 
    
         
            +
                    }
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                    properties[:legalBasis] = legal_basis if legal_basis
         
     | 
| 
      
 51 
     | 
    
         
            +
                    properties[:legalBasisExplanation] = legal_basis_explanation if legal_basis_explanation
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                    Client::CommunicationPreference.new.subscribe(properties)
         
     | 
| 
      
 54 
     | 
    
         
            +
                  end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
       48 
56 
     | 
    
         
             
                  def primary_company
         
     | 
| 
       49 
57 
     | 
    
         
             
                    @primary_company ||= Company.find(hubspot_id: associatedcompanyid)
         
     | 
| 
       50 
58 
     | 
    
         
             
                  end
         
     | 
    
        data/lib/hubspot_client.rb
    CHANGED
    
    | 
         @@ -1,13 +1,16 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require 'httparty'
         
     | 
| 
       4 
     | 
    
         
            -
            require 'hubspot_client/ 
     | 
| 
       5 
     | 
    
         
            -
            require 'hubspot_client/ 
     | 
| 
       6 
     | 
    
         
            -
            require 'hubspot_client/client/contact'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'hubspot_client/client_base_error'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'hubspot_client/client/communication_preference'
         
     | 
| 
       7 
6 
     | 
    
         
             
            require 'hubspot_client/client/company'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'hubspot_client/client/contact'
         
     | 
| 
       8 
8 
     | 
    
         
             
            require 'hubspot_client/client/properties'
         
     | 
| 
       9 
     | 
    
         
            -
            require 'hubspot_client/ 
     | 
| 
      
 9 
     | 
    
         
            +
            require 'hubspot_client/configuration'
         
     | 
| 
      
 10 
     | 
    
         
            +
            require 'hubspot_client/model/communication_preference'
         
     | 
| 
       10 
11 
     | 
    
         
             
            require 'hubspot_client/model/company'
         
     | 
| 
      
 12 
     | 
    
         
            +
            require 'hubspot_client/model/contact'
         
     | 
| 
      
 13 
     | 
    
         
            +
            require 'hubspot_client/version'
         
     | 
| 
       11 
14 
     | 
    
         | 
| 
       12 
15 
     | 
    
         
             
            module HubspotClient
         
     | 
| 
       13 
16 
     | 
    
         
             
              class << self
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: hubspot_client
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Garllon
         
     | 
| 
      
 8 
     | 
    
         
            +
            - romankonz
         
     | 
| 
       8 
9 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
10 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2022- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2022-12-02 00:00:00.000000000 Z
         
     | 
| 
       12 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
15 
     | 
    
         
             
              name: httparty
         
     | 
| 
         @@ -145,6 +146,7 @@ dependencies: 
     | 
|
| 
       145 
146 
     | 
    
         
             
            description: Hubspot client to handle CRM objects.
         
     | 
| 
       146 
147 
     | 
    
         
             
            email:
         
     | 
| 
       147 
148 
     | 
    
         
             
            - garllon@protonmail.com
         
     | 
| 
      
 149 
     | 
    
         
            +
            - roman@konz.me
         
     | 
| 
       148 
150 
     | 
    
         
             
            executables: []
         
     | 
| 
       149 
151 
     | 
    
         
             
            extensions: []
         
     | 
| 
       150 
152 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
         @@ -159,10 +161,13 @@ files: 
     | 
|
| 
       159 
161 
     | 
    
         
             
            - bin/console
         
     | 
| 
       160 
162 
     | 
    
         
             
            - hubspot_client.gemspec
         
     | 
| 
       161 
163 
     | 
    
         
             
            - lib/hubspot_client.rb
         
     | 
| 
      
 164 
     | 
    
         
            +
            - lib/hubspot_client/client/communication_preference.rb
         
     | 
| 
       162 
165 
     | 
    
         
             
            - lib/hubspot_client/client/company.rb
         
     | 
| 
       163 
166 
     | 
    
         
             
            - lib/hubspot_client/client/contact.rb
         
     | 
| 
       164 
167 
     | 
    
         
             
            - lib/hubspot_client/client/properties.rb
         
     | 
| 
      
 168 
     | 
    
         
            +
            - lib/hubspot_client/client_base_error.rb
         
     | 
| 
       165 
169 
     | 
    
         
             
            - lib/hubspot_client/configuration.rb
         
     | 
| 
      
 170 
     | 
    
         
            +
            - lib/hubspot_client/model/communication_preference.rb
         
     | 
| 
       166 
171 
     | 
    
         
             
            - lib/hubspot_client/model/company.rb
         
     | 
| 
       167 
172 
     | 
    
         
             
            - lib/hubspot_client/model/contact.rb
         
     | 
| 
       168 
173 
     | 
    
         
             
            - lib/hubspot_client/version.rb
         
     | 
| 
         @@ -184,11 +189,11 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       184 
189 
     | 
    
         
             
                  version: 3.0.0
         
     | 
| 
       185 
190 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       186 
191 
     | 
    
         
             
              requirements:
         
     | 
| 
       187 
     | 
    
         
            -
              - - " 
     | 
| 
      
 192 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       188 
193 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       189 
     | 
    
         
            -
                  version:  
     | 
| 
      
 194 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
       190 
195 
     | 
    
         
             
            requirements: []
         
     | 
| 
       191 
     | 
    
         
            -
            rubygems_version: 3.3. 
     | 
| 
      
 196 
     | 
    
         
            +
            rubygems_version: 3.3.3
         
     | 
| 
       192 
197 
     | 
    
         
             
            signing_key:
         
     | 
| 
       193 
198 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       194 
199 
     | 
    
         
             
            summary: Hubspot client
         
     |