Class: ShellDataReportingApIs::VolumeBasedBonusResponse

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

Overview

VolumeBasedBonusResponse 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(configuration = SKIP, current_period_consumption = SKIP, historical_bonus_paid = SKIP) ⇒ VolumeBasedBonusResponse

Returns a new instance of VolumeBasedBonusResponse.



47
48
49
50
51
52
53
54
55
# File 'lib/shell_data_reporting_ap_is/models/volume_based_bonus_response.rb', line 47

def initialize(configuration = SKIP, current_period_consumption = SKIP,
               historical_bonus_paid = SKIP)
  @configuration = configuration unless configuration == SKIP
  unless current_period_consumption == SKIP
    @current_period_consumption =
      current_period_consumption
  end
  @historical_bonus_paid = historical_bonus_paid unless historical_bonus_paid == SKIP
end

Instance Attribute Details

#configurationArray[BonusConfiguration]

TODO: Write general description for this method

Returns:



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

def configuration
  @configuration
end

#current_period_consumptionArray[CurrentVolume]

TODO: Write general description for this method

Returns:



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

def current_period_consumption
  @current_period_consumption
end

#historical_bonus_paidArray[BonusHistory]

TODO: Write general description for this method

Returns:



22
23
24
# File 'lib/shell_data_reporting_ap_is/models/volume_based_bonus_response.rb', line 22

def historical_bonus_paid
  @historical_bonus_paid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/shell_data_reporting_ap_is/models/volume_based_bonus_response.rb', line 58

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  # Parameter is an array, so we need to iterate through it
  configuration = nil
  unless hash['Configuration'].nil?
    configuration = []
    hash['Configuration'].each do |structure|
      configuration << (BonusConfiguration.from_hash(structure) if structure)
    end
  end

  configuration = SKIP unless hash.key?('Configuration')
  # Parameter is an array, so we need to iterate through it
  current_period_consumption = nil
  unless hash['CurrentPeriodConsumption'].nil?
    current_period_consumption = []
    hash['CurrentPeriodConsumption'].each do |structure|
      current_period_consumption << (CurrentVolume.from_hash(structure) if structure)
    end
  end

  current_period_consumption = SKIP unless hash.key?('CurrentPeriodConsumption')
  # Parameter is an array, so we need to iterate through it
  historical_bonus_paid = nil
  unless hash['HistoricalBonusPaid'].nil?
    historical_bonus_paid = []
    hash['HistoricalBonusPaid'].each do |structure|
      historical_bonus_paid << (BonusHistory.from_hash(structure) if structure)
    end
  end

  historical_bonus_paid = SKIP unless hash.key?('HistoricalBonusPaid')

  # Create object from extracted values.
  VolumeBasedBonusResponse.new(configuration,
                               current_period_consumption,
                               historical_bonus_paid)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
31
# File 'lib/shell_data_reporting_ap_is/models/volume_based_bonus_response.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['configuration'] = 'Configuration'
  @_hash['current_period_consumption'] = 'CurrentPeriodConsumption'
  @_hash['historical_bonus_paid'] = 'HistoricalBonusPaid'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    configuration
    current_period_consumption
    historical_bonus_paid
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



107
108
109
110
111
112
# File 'lib/shell_data_reporting_ap_is/models/volume_based_bonus_response.rb', line 107

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

#to_sObject

Provides a human-readable string representation of the object.



100
101
102
103
104
# File 'lib/shell_data_reporting_ap_is/models/volume_based_bonus_response.rb', line 100

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