Class: ShellSmartPayApi::PrepareFuelingRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ShellSmartPayApi::PrepareFuelingRequest
- Defined in:
- lib/shell_smart_pay_api/models/prepare_fueling_request.rb
Overview
PrepareFuelingRequest Model.
Instance Attribute Summary collapse
-
#device_details ⇒ Array[DeviceDetail]
Object containing device details.
-
#device_type ⇒ String
The type of device making this call.
-
#latitude ⇒ Float
The user’s current latitude.
-
#longitude ⇒ Float
The user’s current longitude.
-
#loyalty_details ⇒ Array[LoyaltyDetails]
Object containing Loyalty details.
-
#maximum_fueling_amount ⇒ Float
The maximum fuelling amount that can be purchased.
-
#payment_details ⇒ PaymentDetails
Object containing Payment details.
-
#pump_id ⇒ String
A two digit numeric number of the pump as marked on the forecourt (e.g. pump number 12).
-
#source_application ⇒ String
The ID of the source application making this call.
-
#station_id ⇒ String
Expectation is that a user has to be located at a Shell petrol station in order to make this call.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(latitude = nil, longitude = nil, station_id = nil, pump_id = nil, source_application = nil, payment_details = nil, maximum_fueling_amount = SKIP, loyalty_details = SKIP, device_type = SKIP, device_details = SKIP) ⇒ PrepareFuelingRequest
constructor
A new instance of PrepareFuelingRequest.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(latitude = nil, longitude = nil, station_id = nil, pump_id = nil, source_application = nil, payment_details = nil, maximum_fueling_amount = SKIP, loyalty_details = SKIP, device_type = SKIP, device_details = SKIP) ⇒ PrepareFuelingRequest
Returns a new instance of PrepareFuelingRequest.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/shell_smart_pay_api/models/prepare_fueling_request.rb', line 103 def initialize(latitude = nil, longitude = nil, station_id = nil, pump_id = nil, source_application = nil, payment_details = nil, maximum_fueling_amount = SKIP, loyalty_details = SKIP, device_type = SKIP, device_details = SKIP) @latitude = latitude @longitude = longitude @maximum_fueling_amount = maximum_fueling_amount unless maximum_fueling_amount == SKIP @station_id = station_id @pump_id = pump_id @loyalty_details = loyalty_details unless loyalty_details == SKIP @source_application = source_application @device_type = device_type unless device_type == SKIP @payment_details = payment_details @device_details = device_details unless device_details == SKIP end |
Instance Attribute Details
#device_details ⇒ Array[DeviceDetail]
Object containing device details
70 71 72 |
# File 'lib/shell_smart_pay_api/models/prepare_fueling_request.rb', line 70 def device_details @device_details end |
#device_type ⇒ String
The type of device making this call. Permitted values for deviceType:
* car
* phone
62 63 64 |
# File 'lib/shell_smart_pay_api/models/prepare_fueling_request.rb', line 62 def device_type @device_type end |
#latitude ⇒ Float
The user’s current latitude
14 15 16 |
# File 'lib/shell_smart_pay_api/models/prepare_fueling_request.rb', line 14 def latitude @latitude end |
#longitude ⇒ Float
The user’s current longitude
18 19 20 |
# File 'lib/shell_smart_pay_api/models/prepare_fueling_request.rb', line 18 def longitude @longitude end |
#loyalty_details ⇒ Array[LoyaltyDetails]
Object containing Loyalty details
50 51 52 |
# File 'lib/shell_smart_pay_api/models/prepare_fueling_request.rb', line 50 def loyalty_details @loyalty_details end |
#maximum_fueling_amount ⇒ Float
The maximum fuelling amount that can be purchased. If the prepare fuelling is successful and the Customer starts fuelling their car, the pump will cut off once this threshold is reached. For B2B customers a maximum ceiling is set against their Shell Card. As a result, this can be left blank for B2B customers. If a value is provided it cannot be zero or lower and values that exceed ceiling will be ignored.
27 28 29 |
# File 'lib/shell_smart_pay_api/models/prepare_fueling_request.rb', line 27 def maximum_fueling_amount @maximum_fueling_amount end |
#payment_details ⇒ PaymentDetails
Object containing Payment details
66 67 68 |
# File 'lib/shell_smart_pay_api/models/prepare_fueling_request.rb', line 66 def payment_details @payment_details end |
#pump_id ⇒ String
A two digit numeric number of the pump as marked on the forecourt (e.g. pump number 12)
46 47 48 |
# File 'lib/shell_smart_pay_api/models/prepare_fueling_request.rb', line 46 def pump_id @pump_id end |
#source_application ⇒ String
The ID of the source application making this call. Each 3rd Party will be issued with its own sourceApp ID that must be specified correctly here
* 3rdParty_App_Archetype
56 57 58 |
# File 'lib/shell_smart_pay_api/models/prepare_fueling_request.rb', line 56 def source_application @source_application end |
#station_id ⇒ String
Expectation is that a user has to be located at a Shell petrol station in order to make this call. A user is recognised as being located at a Shell station if the user’s current location (as determined by GPS) is within 300 meters of a Shell station. Expectation is that requester will have established the Shell petrol station the user is located at prior to making this call by calling Station Locator APIs. The API will use stationId and siteCountry/GPS to verify the user is The user’s current latitude genuinely located at the specified Station. ‘mpp_station_id’ of the Station Locator API should be used. Leading ‘0’ should be dropped and only last four digits, should be used. E.G. for ‘00123’, only ‘0123’should be used and for ‘04567’ only ‘4567’ should be used.
41 42 43 |
# File 'lib/shell_smart_pay_api/models/prepare_fueling_request.rb', line 41 def station_id @station_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/shell_smart_pay_api/models/prepare_fueling_request.rb', line 121 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. latitude = hash.key?('latitude') ? hash['latitude'] : nil longitude = hash.key?('longitude') ? hash['longitude'] : nil station_id = hash.key?('stationId') ? hash['stationId'] : nil pump_id = hash.key?('pumpId') ? hash['pumpId'] : nil source_application = hash.key?('sourceApplication') ? hash['sourceApplication'] : nil payment_details = PaymentDetails.from_hash(hash['paymentDetails']) if hash['paymentDetails'] maximum_fueling_amount = hash.key?('maximumFuelingAmount') ? hash['maximumFuelingAmount'] : SKIP # Parameter is an array, so we need to iterate through it loyalty_details = nil unless hash['loyaltyDetails'].nil? loyalty_details = [] hash['loyaltyDetails'].each do |structure| loyalty_details << (LoyaltyDetails.from_hash(structure) if structure) end end loyalty_details = SKIP unless hash.key?('loyaltyDetails') device_type = hash.key?('deviceType') ? hash['deviceType'] : SKIP # Parameter is an array, so we need to iterate through it device_details = nil unless hash['deviceDetails'].nil? device_details = [] hash['deviceDetails'].each do |structure| device_details << (DeviceDetail.from_hash(structure) if structure) end end device_details = SKIP unless hash.key?('deviceDetails') # Create object from extracted values. PrepareFuelingRequest.new(latitude, longitude, station_id, pump_id, source_application, payment_details, maximum_fueling_amount, loyalty_details, device_type, device_details) end |
.names ⇒ Object
A mapping from model property names to API property names.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/shell_smart_pay_api/models/prepare_fueling_request.rb', line 73 def self.names @_hash = {} if @_hash.nil? @_hash['latitude'] = 'latitude' @_hash['longitude'] = 'longitude' @_hash['maximum_fueling_amount'] = 'maximumFuelingAmount' @_hash['station_id'] = 'stationId' @_hash['pump_id'] = 'pumpId' @_hash['loyalty_details'] = 'loyaltyDetails' @_hash['source_application'] = 'sourceApplication' @_hash['device_type'] = 'deviceType' @_hash['payment_details'] = 'paymentDetails' @_hash['device_details'] = 'deviceDetails' @_hash end |
.nullables ⇒ Object
An array for nullable fields
99 100 101 |
# File 'lib/shell_smart_pay_api/models/prepare_fueling_request.rb', line 99 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
89 90 91 92 93 94 95 96 |
# File 'lib/shell_smart_pay_api/models/prepare_fueling_request.rb', line 89 def self.optionals %w[ maximum_fueling_amount loyalty_details device_type device_details ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
180 181 182 183 184 185 186 187 188 |
# File 'lib/shell_smart_pay_api/models/prepare_fueling_request.rb', line 180 def inspect class_name = self.class.name.split('::').last "<#{class_name} latitude: #{@latitude.inspect}, longitude: #{@longitude.inspect},"\ " maximum_fueling_amount: #{@maximum_fueling_amount.inspect}, station_id:"\ " #{@station_id.inspect}, pump_id: #{@pump_id.inspect}, loyalty_details:"\ " #{@loyalty_details.inspect}, source_application: #{@source_application.inspect},"\ " device_type: #{@device_type.inspect}, payment_details: #{@payment_details.inspect},"\ " device_details: #{@device_details.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
170 171 172 173 174 175 176 177 |
# File 'lib/shell_smart_pay_api/models/prepare_fueling_request.rb', line 170 def to_s class_name = self.class.name.split('::').last "<#{class_name} latitude: #{@latitude}, longitude: #{@longitude}, maximum_fueling_amount:"\ " #{@maximum_fueling_amount}, station_id: #{@station_id}, pump_id: #{@pump_id},"\ " loyalty_details: #{@loyalty_details}, source_application: #{@source_application},"\ " device_type: #{@device_type}, payment_details: #{@payment_details}, device_details:"\ " #{@device_details}>" end |