Class: ShellDataReportingApIs::VolumeBasedPricingResponse

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

Overview

VolumeBasedPricingResponse 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, history = SKIP, warnings = SKIP) ⇒ VolumeBasedPricingResponse

Returns a new instance of VolumeBasedPricingResponse.



58
59
60
61
62
63
64
65
66
67
# File 'lib/shell_data_reporting_ap_is/models/volume_based_pricing_response.rb', line 58

def initialize(configuration = SKIP, current_period_consumption = SKIP,
               history = SKIP, warnings = SKIP)
  @configuration = configuration unless configuration == SKIP
  unless current_period_consumption == SKIP
    @current_period_consumption =
      current_period_consumption
  end
  @history = history unless history == SKIP
  @warnings = warnings unless warnings == 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_pricing_response.rb', line 14

def configuration
  @configuration
end

#current_period_consumptionArray[PricingCurrentVolume]

TODO: Write general description for this method

Returns:



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

#historyArray[PricingHistory]

TODO: Write general description for this method

Returns:



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

def history
  @history
end

#warningsArray[Warning]

A list of Warning entity. This entity will hold the details of the scheduled System Outages of any dependent applications of this service. Note: If there is no scheduled outage information available, in the configuration in AMS, for this service, this parameter won’t be present in output.

Returns:



31
32
33
# File 'lib/shell_data_reporting_ap_is/models/volume_based_pricing_response.rb', line 31

def warnings
  @warnings
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

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')
  # Parameter is an array, so we need to iterate through it
  warnings = nil
  unless hash['Warnings'].nil?
    warnings = []
    hash['Warnings'].each do |structure|
      warnings << (Warning.from_hash(structure) if structure)
    end
  end

  warnings = SKIP unless hash.key?('Warnings')

  # Create object from extracted values.
  VolumeBasedPricingResponse.new(configuration,
                                 current_period_consumption,
                                 history,
                                 warnings)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['configuration'] = 'Configuration'
  @_hash['current_period_consumption'] = 'CurrentPeriodConsumption'
  @_hash['history'] = 'History'
  @_hash['warnings'] = 'Warnings'
  @_hash
end

.nullablesObject

An array for nullable fields



54
55
56
# File 'lib/shell_data_reporting_ap_is/models/volume_based_pricing_response.rb', line 54

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    configuration
    current_period_consumption
    history
    warnings
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



130
131
132
133
134
135
# File 'lib/shell_data_reporting_ap_is/models/volume_based_pricing_response.rb', line 130

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

#to_sObject

Provides a human-readable string representation of the object.



123
124
125
126
127
# File 'lib/shell_data_reporting_ap_is/models/volume_based_pricing_response.rb', line 123

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