Class: ShellDataReportingApIs::UpdateOdometerReference

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

Overview

UpdateOdometerReference 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(sales_item_id = SKIP, update_odometer_reference_id = SKIP) ⇒ UpdateOdometerReference

Returns a new instance of UpdateOdometerReference.



44
45
46
47
48
49
50
# File 'lib/shell_data_reporting_ap_is/models/update_odometer_reference.rb', line 44

def initialize(sales_item_id = SKIP, update_odometer_reference_id = SKIP)
  @sales_item_id = sales_item_id unless sales_item_id == SKIP
  unless update_odometer_reference_id == SKIP
    @update_odometer_reference_id =
      update_odometer_reference_id
  end
end

Instance Attribute Details

#sales_item_idInteger

SalesItemId of input parameter

Returns:

  • (Integer)


14
15
16
# File 'lib/shell_data_reporting_ap_is/models/update_odometer_reference.rb', line 14

def sales_item_id
  @sales_item_id
end

#update_odometer_reference_idInteger

Reference number for each individual update odometer reference.

Returns:

  • (Integer)


18
19
20
# File 'lib/shell_data_reporting_ap_is/models/update_odometer_reference.rb', line 18

def update_odometer_reference_id
  @update_odometer_reference_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/shell_data_reporting_ap_is/models/update_odometer_reference.rb', line 53

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  sales_item_id = hash.key?('SalesItemId') ? hash['SalesItemId'] : SKIP
  update_odometer_reference_id =
    hash.key?('UpdateOdometerReferenceId') ? hash['UpdateOdometerReferenceId'] : SKIP

  # Create object from extracted values.

  UpdateOdometerReference.new(sales_item_id,
                              update_odometer_reference_id)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



37
38
39
40
41
42
# File 'lib/shell_data_reporting_ap_is/models/update_odometer_reference.rb', line 37

def self.nullables
  %w[
    sales_item_id
    update_odometer_reference_id
  ]
end

.optionalsObject

An array for optional fields



29
30
31
32
33
34
# File 'lib/shell_data_reporting_ap_is/models/update_odometer_reference.rb', line 29

def self.optionals
  %w[
    sales_item_id
    update_odometer_reference_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



74
75
76
77
78
# File 'lib/shell_data_reporting_ap_is/models/update_odometer_reference.rb', line 74

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

#to_sObject

Provides a human-readable string representation of the object.



67
68
69
70
71
# File 'lib/shell_data_reporting_ap_is/models/update_odometer_reference.rb', line 67

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