hubspot_client 0.2.0 → 0.2.1
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/Gemfile.lock +1 -1
- data/lib/hubspot_client/model/company.rb +7 -1
- data/lib/hubspot_client/model/contact.rb +7 -1
- data/lib/hubspot_client/model/property.rb +19 -0
- data/lib/hubspot_client/version.rb +1 -1
- data/lib/hubspot_client.rb +1 -0
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 8dd7941d915d5f004993d879b6575183f74a4b63dddd95760f79ee03c2df5453
         | 
| 4 | 
            +
              data.tar.gz: 1cb35e4a8c2f29589f6ee0fa488e63bb36fd501c1ad31e9dc426b2798b829e63
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: a8e0bfd247d726aa8cd993d50d5351dba0429388f37ea8c331fda4e713c652cb1be99ca247eb3a48c7b6010dd5849bdd944a7bf8fbcce2b48e8c0e123cc10685
         | 
| 7 | 
            +
              data.tar.gz: 5149870440dcce65666deddab1d44ccd79003f2caa7523a64b580c7bb6ae64892e3504ce84261c15e6f1c981414ed6c2c978fc366fac93f374dcc4b5e7a7d1b2
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
| @@ -19,7 +19,7 @@ module HubspotClient | |
| 19 19 |  | 
| 20 20 | 
             
                  def update(new_properties = {})
         | 
| 21 21 | 
             
                    assign_attributes(new_properties)
         | 
| 22 | 
            -
                    response = Client::Company.new.update(hs_object_id, to_h)
         | 
| 22 | 
            +
                    response = Client::Company.new.update(hs_object_id, to_h.slice(*writable_properties))
         | 
| 23 23 |  | 
| 24 24 | 
             
                    return true if response.code == 200
         | 
| 25 25 |  | 
| @@ -40,6 +40,12 @@ module HubspotClient | |
| 40 40 | 
             
                      self[attribute] = value
         | 
| 41 41 | 
             
                    end
         | 
| 42 42 | 
             
                  end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                  private
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                  def writable_properties
         | 
| 47 | 
            +
                    HubspotClient::Model::Property.writable_property_names_for('companies')
         | 
| 48 | 
            +
                  end
         | 
| 43 49 | 
             
                end
         | 
| 44 50 | 
             
              end
         | 
| 45 51 | 
             
            end
         | 
| @@ -25,7 +25,7 @@ module HubspotClient | |
| 25 25 |  | 
| 26 26 | 
             
                  def update(new_properties = {})
         | 
| 27 27 | 
             
                    assign_attributes(new_properties)
         | 
| 28 | 
            -
                    response = Client::Contact.new.update(hs_object_id, to_h)
         | 
| 28 | 
            +
                    response = Client::Contact.new.update(hs_object_id, to_h.slice(*writable_properties))
         | 
| 29 29 |  | 
| 30 30 | 
             
                    return true if response.code == 200
         | 
| 31 31 |  | 
| @@ -70,6 +70,12 @@ module HubspotClient | |
| 70 70 | 
             
                      self[attribute] = value
         | 
| 71 71 | 
             
                    end
         | 
| 72 72 | 
             
                  end
         | 
| 73 | 
            +
             | 
| 74 | 
            +
                  private
         | 
| 75 | 
            +
             | 
| 76 | 
            +
                  def writable_properties
         | 
| 77 | 
            +
                    HubspotClient::Model::Property.writable_property_names_for('contacts')
         | 
| 78 | 
            +
                  end
         | 
| 73 79 | 
             
                end
         | 
| 74 80 | 
             
              end
         | 
| 75 81 | 
             
            end
         | 
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module HubspotClient
         | 
| 4 | 
            +
              module Model
         | 
| 5 | 
            +
                class Property
         | 
| 6 | 
            +
                  def self.all_for(object_type)
         | 
| 7 | 
            +
                    HubspotClient::Client::Properties.new.for(object_type)
         | 
| 8 | 
            +
                  end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                  def self.writable_property_names_for(object_type)
         | 
| 11 | 
            +
                    readonly_properties = all_for(object_type)['results'].reject do |property|
         | 
| 12 | 
            +
                      property['modificationMetadata']['readOnlyValue'] == true
         | 
| 13 | 
            +
                    end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                    readonly_properties.map { |property| property['name'].to_sym }
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
            end
         | 
    
        data/lib/hubspot_client.rb
    CHANGED
    
    | @@ -10,6 +10,7 @@ require 'hubspot_client/configuration' | |
| 10 10 | 
             
            require 'hubspot_client/model/communication_preference'
         | 
| 11 11 | 
             
            require 'hubspot_client/model/company'
         | 
| 12 12 | 
             
            require 'hubspot_client/model/contact'
         | 
| 13 | 
            +
            require 'hubspot_client/model/property'
         | 
| 13 14 | 
             
            require 'hubspot_client/version'
         | 
| 14 15 |  | 
| 15 16 | 
             
            module HubspotClient
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: hubspot_client
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.2. | 
| 4 | 
            +
              version: 0.2.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Garllon
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire:
         | 
| 10 10 | 
             
            bindir: exe
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2022-12- | 
| 12 | 
            +
            date: 2022-12-07 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: httparty
         | 
| @@ -170,6 +170,7 @@ files: | |
| 170 170 | 
             
            - lib/hubspot_client/model/communication_preference.rb
         | 
| 171 171 | 
             
            - lib/hubspot_client/model/company.rb
         | 
| 172 172 | 
             
            - lib/hubspot_client/model/contact.rb
         | 
| 173 | 
            +
            - lib/hubspot_client/model/property.rb
         | 
| 173 174 | 
             
            - lib/hubspot_client/version.rb
         | 
| 174 175 | 
             
            homepage: https://github.com/Farbfox/hubspot_client/blob/main/README.md
         | 
| 175 176 | 
             
            licenses:
         |