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

#to_hash, #to_json

Constructor Details

#initialize(configuration = SKIP, current_period_consumption = SKIP, historical_bonus_paid = SKIP, error = SKIP, request_id = SKIP) ⇒ VolumeBasedBonusResponse

Returns a new instance of VolumeBasedBonusResponse.



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/shell_data_reporting_ap_is/models/volume_based_bonus_response.rb', line 59

def initialize(configuration = SKIP, current_period_consumption = SKIP,
               historical_bonus_paid = SKIP, error = SKIP,
               request_id = 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
  @error = error unless error == SKIP
  @request_id = request_id unless request_id == 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

#errorErrorStatus

TODO: Write general description for this method

Returns:



26
27
28
# File 'lib/shell_data_reporting_ap_is/models/volume_based_bonus_response.rb', line 26

def error
  @error
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

#request_idString

API Request Id

Returns:

  • (String)


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

def request_id
  @request_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/shell_data_reporting_ap_is/models/volume_based_bonus_response.rb', line 73

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')
  error = ErrorStatus.from_hash(hash['Error']) if hash['Error']
  request_id = hash.key?('RequestId') ? hash['RequestId'] : SKIP

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

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/shell_data_reporting_ap_is/models/volume_based_bonus_response.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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