Class: ShellSmartPayApi::DeviceDetail

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_smart_pay_api/models/device_detail.rb

Overview

DeviceDetail Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(device_id = SKIP, model = SKIP, os_version = SKIP, other_device_information = SKIP) ⇒ DeviceDetail

Returns a new instance of DeviceDetail.



67
68
69
70
71
72
73
# File 'lib/shell_smart_pay_api/models/device_detail.rb', line 67

def initialize(device_id = SKIP, model = SKIP, os_version = SKIP,
               other_device_information = SKIP)
  @device_id = device_id unless device_id == SKIP
  @model = model unless model == SKIP
  @os_version = os_version unless os_version == SKIP
  @other_device_information = other_device_information unless other_device_information == SKIP
end

Instance Attribute Details

#device_idString

This is the mobile device’s unique ID (Vendor ID for iOS vs. Android ID for Android). This is only used for transactions made via the Shell Mobile App and will therefore be mandatory for requests originating from Shell’s mobile app but can be ignored by all other parties.

Returns:

  • (String)


17
18
19
# File 'lib/shell_smart_pay_api/models/device_detail.rb', line 17

def device_id
  @device_id
end

#modelString

This is the mobile device’s model (machine name/systemInfo for iOS vs. Build.MODEL for Android). This is only used for transactions made via the Shell Mobile App and will therefore be mandatory for requests originating from Shell’s mobile app but can be ignored by all other parties.

Returns:

  • (String)


24
25
26
# File 'lib/shell_smart_pay_api/models/device_detail.rb', line 24

def model
  @model
end

#os_versionString

This is the mobile device’s OS Version. This is only used for transactions made via the Shell Mobile App and will therefore be mandatory for requests originating from Shell’s mobile app but can be ignored by all other parties.

Returns:

  • (String)


31
32
33
# File 'lib/shell_smart_pay_api/models/device_detail.rb', line 31

def os_version
  @os_version
end

#other_device_informationString

This is only used for transactions made via Android versions of the Shell Mobile App and will therefore be mandatory for requests originating from Shell’s Android mobile app but can be ignored by all other devices and/or parties. This field is used to capture the Shell App build that was used to make this call.

Returns:

  • (String)


40
41
42
# File 'lib/shell_smart_pay_api/models/device_detail.rb', line 40

def other_device_information
  @other_device_information
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/shell_smart_pay_api/models/device_detail.rb', line 76

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  device_id = hash.key?('deviceId') ? hash['deviceId'] : SKIP
  model = hash.key?('model') ? hash['model'] : SKIP
  os_version = hash.key?('osVersion') ? hash['osVersion'] : SKIP
  other_device_information =
    hash.key?('otherDeviceInformation') ? hash['otherDeviceInformation'] : SKIP

  # Create object from extracted values.

  DeviceDetail.new(device_id,
                   model,
                   os_version,
                   other_device_information)
end

.namesObject

A mapping from model property names to API property names.



43
44
45
46
47
48
49
50
# File 'lib/shell_smart_pay_api/models/device_detail.rb', line 43

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['device_id'] = 'deviceId'
  @_hash['model'] = 'model'
  @_hash['os_version'] = 'osVersion'
  @_hash['other_device_information'] = 'otherDeviceInformation'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
# File 'lib/shell_smart_pay_api/models/device_detail.rb', line 63

def self.nullables
  []
end

.optionalsObject

An array for optional fields



53
54
55
56
57
58
59
60
# File 'lib/shell_smart_pay_api/models/device_detail.rb', line 53

def self.optionals
  %w[
    device_id
    model
    os_version
    other_device_information
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



101
102
103
104
105
# File 'lib/shell_smart_pay_api/models/device_detail.rb', line 101

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} device_id: #{@device_id.inspect}, model: #{@model.inspect}, os_version:"\
  " #{@os_version.inspect}, other_device_information: #{@other_device_information.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



94
95
96
97
98
# File 'lib/shell_smart_pay_api/models/device_detail.rb', line 94

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} device_id: #{@device_id}, model: #{@model}, os_version: #{@os_version},"\
  " other_device_information: #{@other_device_information}>"
end