Class: ShellDataReportingApIs::UpdateOdometer

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_data_reporting_ap_is/models/update_odometer.rb

Overview

UpdateOdometer Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(sales_item_id = nil, new_odometer_value = nil) ⇒ UpdateOdometer

Returns a new instance of UpdateOdometer.



42
43
44
45
# File 'lib/shell_data_reporting_ap_is/models/update_odometer.rb', line 42

def initialize(sales_item_id = nil, new_odometer_value = nil)
  @sales_item_id = sales_item_id
  @new_odometer_value = new_odometer_value
end

Instance Attribute Details

#new_odometer_valueInteger

NewOdometerValue that needs to be updated

Returns:

  • (Integer)


19
20
21
# File 'lib/shell_data_reporting_ap_is/models/update_odometer.rb', line 19

def new_odometer_value
  @new_odometer_value
end

#sales_item_idString

Unique SalesItemId (Either Billed on Unbilled) Mandatory

Returns:

  • (String)


15
16
17
# File 'lib/shell_data_reporting_ap_is/models/update_odometer.rb', line 15

def sales_item_id
  @sales_item_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/shell_data_reporting_ap_is/models/update_odometer.rb', line 48

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  sales_item_id = hash.key?('SalesItemId') ? hash['SalesItemId'] : nil
  new_odometer_value =
    hash.key?('NewOdometerValue') ? hash['NewOdometerValue'] : nil

  # Create object from extracted values.
  UpdateOdometer.new(sales_item_id,
                     new_odometer_value)
end

.namesObject

A mapping from model property names to API property names.



22
23
24
25
26
27
# File 'lib/shell_data_reporting_ap_is/models/update_odometer.rb', line 22

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['sales_item_id'] = 'SalesItemId'
  @_hash['new_odometer_value'] = 'NewOdometerValue'
  @_hash
end

.nullablesObject

An array for nullable fields



35
36
37
38
39
40
# File 'lib/shell_data_reporting_ap_is/models/update_odometer.rb', line 35

def self.nullables
  %w[
    sales_item_id
    new_odometer_value
  ]
end

.optionalsObject

An array for optional fields



30
31
32
# File 'lib/shell_data_reporting_ap_is/models/update_odometer.rb', line 30

def self.optionals
  []
end