eventbrite_sdk 3.0.3 → 3.0.4
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/lib/eventbrite_sdk/resource/attributes.rb +17 -3
- data/lib/eventbrite_sdk/version.rb +1 -1
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 80cc8b081e40bc200ab5c877d5002f0ddef451a0
         | 
| 4 | 
            +
              data.tar.gz: b60c1723223c537ca4f1147c72c5c4767b688957
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 23470765f35da5250d104eaa23f882c7d01dc84f7151d7395f648a03bc0d6fcbfc58836c6699bdc6a0975bccabf17f7e3cb8430bdabfe9dabb9e71226a538e5b
         | 
| 7 | 
            +
              data.tar.gz: 259eb389b25aa7c31c660f72c3a19028aedc35f6be83be13a63cc0e3fd08071713d5c52c122dab43148d6cab6922c4f6a3dddf58d3c559771b300088065e04be
         | 
| @@ -1,6 +1,11 @@ | |
| 1 1 | 
             
            module EventbriteSDK
         | 
| 2 2 | 
             
              class Resource
         | 
| 3 3 | 
             
                class Attributes
         | 
| 4 | 
            +
                  SISTER_FIELDS = {
         | 
| 5 | 
            +
                    'timezone' => 'utc',
         | 
| 6 | 
            +
                    'utc' => 'timezone'
         | 
| 7 | 
            +
                  }.freeze
         | 
| 8 | 
            +
             | 
| 4 9 | 
             
                  attr_reader :attrs, :changes
         | 
| 5 10 |  | 
| 6 11 | 
             
                  def self.build(attrs, schema)
         | 
| @@ -108,11 +113,11 @@ module EventbriteSDK | |
| 108 113 | 
             
                  # you can run into a case where a "rich media" field needs other attrs
         | 
| 109 114 | 
             
                  # Namely timezone, so if a rich date changed, add the tz with it.
         | 
| 110 115 | 
             
                  def add_rich_value(attribute_key)
         | 
| 111 | 
            -
                    if changes[attribute_key] && attribute_key =~ /\A(.+)\.utc\z/
         | 
| 116 | 
            +
                    if changes[attribute_key] && attribute_key =~ /\A(.+)\.(utc|timezone)\z/
         | 
| 117 | 
            +
                      field = Regexp.last_match(2)
         | 
| 112 118 | 
             
                      key_prefix = Regexp.last_match(1)
         | 
| 113 | 
            -
                      tz = attrs.dig(key_prefix, 'timezone')
         | 
| 114 119 |  | 
| 115 | 
            -
                       | 
| 120 | 
            +
                      handle_sister_field(key_prefix, field)
         | 
| 116 121 | 
             
                    end
         | 
| 117 122 | 
             
                  end
         | 
| 118 123 |  | 
| @@ -142,6 +147,15 @@ module EventbriteSDK | |
| 142 147 | 
             
                    attrs.has_key?(method_name.to_s) || super
         | 
| 143 148 | 
             
                  end
         | 
| 144 149 |  | 
| 150 | 
            +
                  def handle_sister_field(key_prefix, field)
         | 
| 151 | 
            +
                    sister_field = SISTER_FIELDS[field]
         | 
| 152 | 
            +
                    stale_value = attrs.dig(key_prefix, sister_field)
         | 
| 153 | 
            +
             | 
| 154 | 
            +
                    unless changes["#{key_prefix}.#{sister_field}"]
         | 
| 155 | 
            +
                      changes["#{key_prefix}.#{sister_field}"] = [stale_value, stale_value]
         | 
| 156 | 
            +
                    end
         | 
| 157 | 
            +
                  end
         | 
| 158 | 
            +
             | 
| 145 159 | 
             
                  def handle_requested_attr(value)
         | 
| 146 160 | 
             
                    if value.is_a?(Hash)
         | 
| 147 161 | 
             
                      self.class.new(value)
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: eventbrite_sdk
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 3.0. | 
| 4 | 
            +
              version: 3.0.4
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Vinnie Franco
         | 
| @@ -10,7 +10,7 @@ authors: | |
| 10 10 | 
             
            autorequire: 
         | 
| 11 11 | 
             
            bindir: bin
         | 
| 12 12 | 
             
            cert_chain: []
         | 
| 13 | 
            -
            date: 2017- | 
| 13 | 
            +
            date: 2017-04-06 00:00:00.000000000 Z
         | 
| 14 14 | 
             
            dependencies:
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 16 16 | 
             
              name: rest-client
         | 
| @@ -166,3 +166,4 @@ signing_key: | |
| 166 166 | 
             
            specification_version: 4
         | 
| 167 167 | 
             
            summary: Official Eventbrite SDK for the v3 API
         | 
| 168 168 | 
             
            test_files: []
         | 
| 169 | 
            +
            has_rdoc: 
         |