Class: ShellDataReportingApIs::VolumeBasedPricingResponse
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ShellDataReportingApIs::VolumeBasedPricingResponse
- Defined in:
- lib/shell_data_reporting_ap_is/models/volume_based_pricing_response.rb
Overview
VolumeBasedPricingResponse Model.
Instance Attribute Summary collapse
-
#configuration ⇒ Array[BonusConfiguration]
TODO: Write general description for this method.
-
#current_period_consumption ⇒ Array[PricingCurrentVolume]
TODO: Write general description for this method.
-
#error ⇒ ErrorStatus
TODO: Write general description for this method.
-
#history ⇒ Array[PricingHistory]
TODO: Write general description for this method.
-
#request_id ⇒ String
API Request Id.
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(configuration = SKIP, current_period_consumption = SKIP, history = SKIP, error = SKIP, request_id = SKIP) ⇒ VolumeBasedPricingResponse
constructor
A new instance of VolumeBasedPricingResponse.
Methods inherited from BaseModel
Constructor Details
#initialize(configuration = SKIP, current_period_consumption = SKIP, history = SKIP, error = SKIP, request_id = SKIP) ⇒ VolumeBasedPricingResponse
Returns a new instance of VolumeBasedPricingResponse.
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/shell_data_reporting_ap_is/models/volume_based_pricing_response.rb', line 59 def initialize(configuration = SKIP, current_period_consumption = SKIP, history = SKIP, error = SKIP, request_id = SKIP) @configuration = configuration unless configuration == SKIP unless current_period_consumption == SKIP @current_period_consumption = current_period_consumption end @history = history unless history == SKIP @error = error unless error == SKIP @request_id = request_id unless request_id == SKIP end |
Instance Attribute Details
#configuration ⇒ Array[BonusConfiguration]
TODO: Write general description for this method
14 15 16 |
# File 'lib/shell_data_reporting_ap_is/models/volume_based_pricing_response.rb', line 14 def configuration @configuration end |
#current_period_consumption ⇒ Array[PricingCurrentVolume]
TODO: Write general description for this method
18 19 20 |
# File 'lib/shell_data_reporting_ap_is/models/volume_based_pricing_response.rb', line 18 def current_period_consumption @current_period_consumption end |
#error ⇒ ErrorStatus
TODO: Write general description for this method
26 27 28 |
# File 'lib/shell_data_reporting_ap_is/models/volume_based_pricing_response.rb', line 26 def error @error end |
#history ⇒ Array[PricingHistory]
TODO: Write general description for this method
22 23 24 |
# File 'lib/shell_data_reporting_ap_is/models/volume_based_pricing_response.rb', line 22 def history @history end |
#request_id ⇒ String
API Request Id
30 31 32 |
# File 'lib/shell_data_reporting_ap_is/models/volume_based_pricing_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.
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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/shell_data_reporting_ap_is/models/volume_based_pricing_response.rb', line 72 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 << (PricingCurrentVolume.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 history = nil unless hash['History'].nil? history = [] hash['History'].each do |structure| history << (PricingHistory.from_hash(structure) if structure) end end history = SKIP unless hash.key?('History') error = ErrorStatus.from_hash(hash['Error']) if hash['Error'] request_id = hash.key?('RequestId') ? hash['RequestId'] : SKIP # Create object from extracted values. VolumeBasedPricingResponse.new(configuration, current_period_consumption, history, error, request_id) end |
.names ⇒ Object
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_pricing_response.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['configuration'] = 'Configuration' @_hash['current_period_consumption'] = 'CurrentPeriodConsumption' @_hash['history'] = 'History' @_hash['error'] = 'Error' @_hash['request_id'] = 'RequestId' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 |
# File 'lib/shell_data_reporting_ap_is/models/volume_based_pricing_response.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 50 51 52 |
# File 'lib/shell_data_reporting_ap_is/models/volume_based_pricing_response.rb', line 44 def self.optionals %w[ configuration current_period_consumption history error request_id ] end |