mparticle 1.0.10 → 1.1.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/docs/DeviceInformation.md +2 -0
- data/example/main.rb +7 -3
- data/lib/mparticle/api_client.rb +1 -1
- data/lib/mparticle/models/device_information.rb +31 -1
- data/mparticle.gemspec +1 -1
- data/spec/models/batch_spec.rb +19 -0
- data/spec/models/ccpa_consent_state_spec.rb +1 -1
- data/spec/models/gdpr_consent_state_spec.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 2e643f74d5e885c07ad75683d3051bbab37e1736d423d013a03c9d69ac57eaea
         | 
| 4 | 
            +
              data.tar.gz: cdc2cc3d1adb8a2455cbe51eb081a2c3ce81ee72377ae7dac48fd88357ec5f0f
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 412958414338ad3f126b1e57078c350d748593c5917f53252f1abaf3b8500d11a7cfd04e9cbe022cffc260d6ed908798e20bba1464d9ca84716bde3c35025816
         | 
| 7 | 
            +
              data.tar.gz: a57f039027d6d5106a9d63e2de08eabdbd99e18a9121bcc0178b7327a4566f939560abd1e9a1a6c2fb6e4c0aec6c1d02e33f063fa79dc941a73385bb8f8d4685
         | 
    
        data/docs/DeviceInformation.md
    CHANGED
    
    | @@ -35,6 +35,8 @@ Name | Type | Description | Notes | |
| 35 35 | 
             
            **has_nfc** | **BOOLEAN** |  | [optional] 
         | 
| 36 36 | 
             
            **bluetooth_enabled** | **BOOLEAN** |  | [optional] 
         | 
| 37 37 | 
             
            **bluetooth_version** | **String** |  | [optional] 
         | 
| 38 | 
            +
            **att_timestamp_unixtime_ms** | **Integer** |  | [optional] 
         | 
| 39 | 
            +
            **att_authorization_status** | **String** |  | [optional] 
         | 
| 38 40 | 
             
            **ios_idfv** | **String** |  | [optional] 
         | 
| 39 41 | 
             
            **android_advertising_id** | **String** |  | [optional] 
         | 
| 40 42 |  | 
    
        data/example/main.rb
    CHANGED
    
    | @@ -14,6 +14,10 @@ batch = MParticle::Batch.new | |
| 14 14 | 
             
            batch.timestamp_unixtime_ms = DateTime.now.strftime('%Q').to_i
         | 
| 15 15 | 
             
            batch.environment = 'development'
         | 
| 16 16 |  | 
| 17 | 
            +
            batch.device_info = MParticle::DeviceInformation.new
         | 
| 18 | 
            +
            batch.device_info.att_timestamp_unixtime_ms = DateTime.now.strftime('%Q').to_i
         | 
| 19 | 
            +
            batch.device_info.att_authorization_status = 'authorized'
         | 
| 20 | 
            +
             | 
| 17 21 | 
             
            user_identities = MParticle::UserIdentities.new
         | 
| 18 22 | 
             
            user_identities.customerid = '12345'
         | 
| 19 23 |  | 
| @@ -56,14 +60,14 @@ batch.user_identities = user_identities | |
| 56 60 | 
             
            ccpa_consent_state = MParticle::CCPAConsentState.new
         | 
| 57 61 | 
             
            ccpa_consent_state.document = 'document.agreement.v3'
         | 
| 58 62 | 
             
            ccpa_consent_state.consented = true
         | 
| 59 | 
            -
            ccpa_consent_state.timestamp_unixtime_ms = Time.now.to_i
         | 
| 63 | 
            +
            ccpa_consent_state.timestamp_unixtime_ms = (Time.now.to_f * 1000).to_i
         | 
| 60 64 | 
             
            ccpa_consent_state.location = 'mparticle.test/signup'
         | 
| 61 65 | 
             
            ccpa_consent_state.hardware_id = 'IDFA:a5d96n32-224a-3b11-1088-a202695bc710'
         | 
| 62 66 |  | 
| 63 67 | 
             
            gdpr_consent_state = MParticle::GDPRConsentState.new
         | 
| 64 68 | 
             
            gdpr_consent_state.document = 'document_agreement.v2'
         | 
| 65 69 | 
             
            gdpr_consent_state.consented = true
         | 
| 66 | 
            -
            gdpr_consent_state.timestamp_unixtime_ms = Time.now.to_i
         | 
| 70 | 
            +
            gdpr_consent_state.timestamp_unixtime_ms = (Time.now.to_f * 1000).to_i
         | 
| 67 71 | 
             
            gdpr_consent_state.location = 'dtmgbank.com/signup'
         | 
| 68 72 | 
             
            gdpr_consent_state.hardware_id = 'IDFA:a5d934n0-232f-4afc-2e9a-3832d95zc702'
         | 
| 69 73 |  | 
| @@ -88,5 +92,5 @@ begin | |
| 88 92 | 
             
              # wait for the thread, otherwise process may exit too early
         | 
| 89 93 | 
             
              thread.join
         | 
| 90 94 | 
             
            rescue MParticle::ApiError => e
         | 
| 91 | 
            -
              puts "Exception when calling mParticle: #{e. | 
| 95 | 
            +
              puts "Exception when calling mParticle: #{e.code}"
         | 
| 92 96 | 
             
            end
         | 
    
        data/lib/mparticle/api_client.rb
    CHANGED
    
    | @@ -19,7 +19,7 @@ module MParticle | |
| 19 19 | 
             
                # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
         | 
| 20 20 | 
             
                def initialize(config)
         | 
| 21 21 | 
             
                  @config = config
         | 
| 22 | 
            -
                  @user_agent = "mParticle Ruby client/1.0 | 
| 22 | 
            +
                  @user_agent = "mParticle Ruby client/1.1.0"
         | 
| 23 23 | 
             
                  @default_headers = {
         | 
| 24 24 | 
             
                    'Content-Type' => "application/json",
         | 
| 25 25 | 
             
                    'User-Agent' => @user_agent
         | 
| @@ -67,6 +67,10 @@ module MParticle | |
| 67 67 |  | 
| 68 68 | 
             
                attr_accessor :bluetooth_version
         | 
| 69 69 |  | 
| 70 | 
            +
                attr_accessor :att_timestamp_unixtime_ms
         | 
| 71 | 
            +
             | 
| 72 | 
            +
                attr_accessor :att_authorization_status
         | 
| 73 | 
            +
             | 
| 70 74 | 
             
                attr_accessor :ios_idfv
         | 
| 71 75 |  | 
| 72 76 | 
             
                attr_accessor :android_advertising_id
         | 
| @@ -128,6 +132,8 @@ module MParticle | |
| 128 132 | 
             
                    :'has_nfc' => :'has_nfc',
         | 
| 129 133 | 
             
                    :'bluetooth_enabled' => :'bluetooth_enabled',
         | 
| 130 134 | 
             
                    :'bluetooth_version' => :'bluetooth_version',
         | 
| 135 | 
            +
                    :'att_timestamp_unixtime_ms' => :'att_timestamp_unixtime_ms',
         | 
| 136 | 
            +
                    :'att_authorization_status' => :'att_authorization_status',
         | 
| 131 137 | 
             
                    :'ios_idfv' => :'ios_idfv',
         | 
| 132 138 | 
             
                    :'android_advertising_id' => :'android_advertising_id'
         | 
| 133 139 | 
             
                  }
         | 
| @@ -168,6 +174,8 @@ module MParticle | |
| 168 174 | 
             
                    :'has_nfc' => :'BOOLEAN',
         | 
| 169 175 | 
             
                    :'bluetooth_enabled' => :'BOOLEAN',
         | 
| 170 176 | 
             
                    :'bluetooth_version' => :'String',
         | 
| 177 | 
            +
                    :'att_timestamp_unixtime_ms' => :'Integer',
         | 
| 178 | 
            +
                    :'att_authorization_status' => :'String',
         | 
| 171 179 | 
             
                    :'ios_idfv' => :'String',
         | 
| 172 180 | 
             
                    :'android_advertising_id' => :'String'
         | 
| 173 181 | 
             
                  }
         | 
| @@ -309,6 +317,14 @@ module MParticle | |
| 309 317 | 
             
                    self.bluetooth_version = attributes[:'bluetooth_version']
         | 
| 310 318 | 
             
                  end
         | 
| 311 319 |  | 
| 320 | 
            +
                  if attributes.has_key?(:'att_timestamp_unixtime_ms')
         | 
| 321 | 
            +
                    self.att_timestamp_unixtime_ms = attributes[:'att_timestamp_unixtime_ms']
         | 
| 322 | 
            +
                  end
         | 
| 323 | 
            +
             | 
| 324 | 
            +
                  if attributes.has_key?(:'att_authorization_status')
         | 
| 325 | 
            +
                    self.att_authorization_status = attributes[:'att_authorization_status']
         | 
| 326 | 
            +
                  end
         | 
| 327 | 
            +
             | 
| 312 328 | 
             
                  if attributes.has_key?(:'ios_idfv')
         | 
| 313 329 | 
             
                    self.ios_idfv = attributes[:'ios_idfv']
         | 
| 314 330 | 
             
                  end
         | 
| @@ -330,7 +346,9 @@ module MParticle | |
| 330 346 | 
             
                # @return true if the model is valid
         | 
| 331 347 | 
             
                def valid?
         | 
| 332 348 | 
             
                  platform_validator = EnumAttributeValidator.new('String', ["Unknown", "iOS", "Android", "tvOS"])
         | 
| 349 | 
            +
                  att_validator = EnumAttributeValidator.new('String', ["authorized", "denied", "not_determined", "restricted"])
         | 
| 333 350 | 
             
                  return false unless platform_validator.valid?(@platform)
         | 
| 351 | 
            +
                  return false unless att_validator.valid?(@att_authorization_status)
         | 
| 334 352 | 
             
                  return true
         | 
| 335 353 | 
             
                end
         | 
| 336 354 |  | 
| @@ -344,6 +362,16 @@ module MParticle | |
| 344 362 | 
             
                  @platform = platform
         | 
| 345 363 | 
             
                end
         | 
| 346 364 |  | 
| 365 | 
            +
                # Custom attribute writer method checking allowed values (enum).
         | 
| 366 | 
            +
                # @param [Object] att_authorization_status Object to be assigned
         | 
| 367 | 
            +
                def att_authorization_status=(att_authorization_status)
         | 
| 368 | 
            +
                  validator = EnumAttributeValidator.new('String', ["authorized", "denied", "not_determined", "restricted"])
         | 
| 369 | 
            +
                  unless validator.valid?(att_authorization_status)
         | 
| 370 | 
            +
                    fail ArgumentError, "invalid value for 'att_authorization_status', must be one of #{validator.allowable_values}."
         | 
| 371 | 
            +
                  end
         | 
| 372 | 
            +
                  @att_authorization_status = att_authorization_status
         | 
| 373 | 
            +
                end
         | 
| 374 | 
            +
             | 
| 347 375 | 
             
                # Checks equality by comparing each attribute.
         | 
| 348 376 | 
             
                # @param [Object] Object to be compared
         | 
| 349 377 | 
             
                def ==(o)
         | 
| @@ -381,6 +409,8 @@ module MParticle | |
| 381 409 | 
             
                      has_nfc == o.has_nfc &&
         | 
| 382 410 | 
             
                      bluetooth_enabled == o.bluetooth_enabled &&
         | 
| 383 411 | 
             
                      bluetooth_version == o.bluetooth_version &&
         | 
| 412 | 
            +
                      att_timestamp_unixtime_ms == o.att_timestamp_unixtime_ms &&
         | 
| 413 | 
            +
                      att_authorization_status == o.att_authorization_status &&
         | 
| 384 414 | 
             
                      ios_idfv == o.ios_idfv &&
         | 
| 385 415 | 
             
                      android_advertising_id == o.android_advertising_id
         | 
| 386 416 | 
             
                end
         | 
| @@ -394,7 +424,7 @@ module MParticle | |
| 394 424 | 
             
                # Calculates hash code according to all attributes.
         | 
| 395 425 | 
             
                # @return [Fixnum] Hash code
         | 
| 396 426 | 
             
                def hash
         | 
| 397 | 
            -
                  [brand, product, device, android_uuid, device_manufacturer, platform, os_version, device_model, screen_height, screen_width, screen_dpi, device_country, locale_language, locale_country, network_country, network_carrier, network_code, network_mobile_country_code, timezone_offset, build_identifier, http_header_user_agent, ios_advertising_id, push_token, cpu_architecture, is_tablet, push_notification_sound_enabled, push_notification_vibrate_enabled, radio_access_technology, supports_telephony, has_nfc, bluetooth_enabled, bluetooth_version, ios_idfv, android_advertising_id].hash
         | 
| 427 | 
            +
                  [brand, product, device, android_uuid, device_manufacturer, platform, os_version, device_model, screen_height, screen_width, screen_dpi, device_country, locale_language, locale_country, network_country, network_carrier, network_code, network_mobile_country_code, timezone_offset, build_identifier, http_header_user_agent, ios_advertising_id, push_token, cpu_architecture, is_tablet, push_notification_sound_enabled, push_notification_vibrate_enabled, radio_access_technology, supports_telephony, has_nfc, bluetooth_enabled, bluetooth_version, att_timestamp_unixtime_ms, att_authorization_status, ios_idfv, android_advertising_id].hash
         | 
| 398 428 | 
             
                end
         | 
| 399 429 |  | 
| 400 430 | 
             
                # Builds the object from hash
         | 
    
        data/mparticle.gemspec
    CHANGED
    
    
    
        data/spec/models/batch_spec.rb
    CHANGED
    
    | @@ -17,4 +17,23 @@ describe 'Batch' do | |
| 17 17 |  | 
| 18 18 | 
             
              end
         | 
| 19 19 |  | 
| 20 | 
            +
              it 'should have the property att_timestamp_unixtime_ms {base name: "att_timestamp_unixtime_ms" }' do
         | 
| 21 | 
            +
                device_info = MParticle::DeviceInformation.new
         | 
| 22 | 
            +
                now = (Time.now.to_f * 1000).to_i
         | 
| 23 | 
            +
                device_info.att_timestamp_unixtime_ms = now
         | 
| 24 | 
            +
                expect(device_info.att_timestamp_unixtime_ms).to eq now
         | 
| 25 | 
            +
                puts device_info.to_hash
         | 
| 26 | 
            +
                json = device_info.to_hash.to_json
         | 
| 27 | 
            +
             | 
| 28 | 
            +
              end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
              it 'should have the property att_authorization_status {base name: "att_authorization_status" }' do
         | 
| 31 | 
            +
                device_info = MParticle::DeviceInformation.new
         | 
| 32 | 
            +
                device_info.att_authorization_status = 'authorized'
         | 
| 33 | 
            +
                expect(device_info.att_authorization_status).to eq('authorized')
         | 
| 34 | 
            +
                puts device_info.to_hash
         | 
| 35 | 
            +
                json = device_info.to_hash.to_json
         | 
| 36 | 
            +
             | 
| 37 | 
            +
              end
         | 
| 38 | 
            +
             | 
| 20 39 | 
             
            end
         | 
| @@ -13,7 +13,7 @@ describe 'CCPAConsentState' do | |
| 13 13 | 
             
              end
         | 
| 14 14 |  | 
| 15 15 | 
             
              it 'should have the property timestamp_unixtime_ms {base name: "timestamp_unixtime_ms" }' do
         | 
| 16 | 
            -
                now = Time.now.to_i
         | 
| 16 | 
            +
                now = (Time.now.to_f * 1000).to_i
         | 
| 17 17 | 
             
                model = MParticle::CCPAConsentState.new
         | 
| 18 18 | 
             
                model.timestamp_unixtime_ms = now
         | 
| 19 19 | 
             
                expect(model.timestamp_unixtime_ms).to eq now
         | 
| @@ -19,7 +19,7 @@ describe 'GDPRConsentState' do | |
| 19 19 | 
             
                end
         | 
| 20 20 |  | 
| 21 21 | 
             
                it 'should have the property timestamp_unixtime_ms {base name: "timestamp_unixtime_ms" }' do
         | 
| 22 | 
            -
                  now = Time.now.to_i
         | 
| 22 | 
            +
                  now = (Time.now.to_f * 1000).to_i
         | 
| 23 23 | 
             
                  model = MParticle::GDPRConsentState.new
         | 
| 24 24 | 
             
                  model.timestamp_unixtime_ms = now
         | 
| 25 25 | 
             
                  expect(model.timestamp_unixtime_ms).to eq now
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: mparticle
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0 | 
| 4 | 
            +
              version: 1.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - mParticle Inc.
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2021-04-06 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: typhoeus
         |