Class: ApiReference::CostsRequestParams
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::CostsRequestParams
- Defined in:
- lib/api_reference/models/costs_request_params.rb
Overview
CostsRequestParams Model.
Instance Attribute Summary collapse
-
#currency ⇒ String
The currency or custom pricing unit to use.
-
#timeframe_end ⇒ DateTime
Costs returned are exclusive of
timeframe_end. -
#timeframe_start ⇒ DateTime
Costs returned are inclusive of
timeframe_start. -
#view_mode ⇒ ViewMode
Controls whether Orb returns cumulative costs since the start of the billing period, or incremental day-by-day costs.
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(timeframe_start: SKIP, timeframe_end: SKIP, view_mode: SKIP, currency: SKIP) ⇒ CostsRequestParams
constructor
A new instance of CostsRequestParams.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_timeframe_end ⇒ Object
- #to_custom_timeframe_start ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(timeframe_start: SKIP, timeframe_end: SKIP, view_mode: SKIP, currency: SKIP) ⇒ CostsRequestParams
Returns a new instance of CostsRequestParams.
62 63 64 65 66 67 68 |
# File 'lib/api_reference/models/costs_request_params.rb', line 62 def initialize(timeframe_start: SKIP, timeframe_end: SKIP, view_mode: SKIP, currency: SKIP) @timeframe_start = timeframe_start unless timeframe_start == SKIP @timeframe_end = timeframe_end unless timeframe_end == SKIP @view_mode = view_mode unless view_mode == SKIP @currency = currency unless currency == SKIP end |
Instance Attribute Details
#currency ⇒ String
The currency or custom pricing unit to use.
30 31 32 |
# File 'lib/api_reference/models/costs_request_params.rb', line 30 def currency @currency end |
#timeframe_end ⇒ DateTime
Costs returned are exclusive of timeframe_end.
19 20 21 |
# File 'lib/api_reference/models/costs_request_params.rb', line 19 def timeframe_end @timeframe_end end |
#timeframe_start ⇒ DateTime
Costs returned are inclusive of timeframe_start.
15 16 17 |
# File 'lib/api_reference/models/costs_request_params.rb', line 15 def timeframe_start @timeframe_start end |
#view_mode ⇒ ViewMode
Controls whether Orb returns cumulative costs since the start of the billing period, or incremental day-by-day costs. If your customer has minimums or discounts, it's strongly recommended that you use the default cumulative behavior.
26 27 28 |
# File 'lib/api_reference/models/costs_request_params.rb', line 26 def view_mode @view_mode end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/api_reference/models/costs_request_params.rb', line 71 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. timeframe_start = if hash.key?('timeframe_start') (DateTimeHelper.from_rfc3339(hash['timeframe_start']) if hash['timeframe_start']) else SKIP end timeframe_end = if hash.key?('timeframe_end') (DateTimeHelper.from_rfc3339(hash['timeframe_end']) if hash['timeframe_end']) else SKIP end view_mode = hash.key?('view_mode') ? hash['view_mode'] : SKIP currency = hash.key?('currency') ? hash['currency'] : SKIP # Create object from extracted values. CostsRequestParams.new(timeframe_start: timeframe_start, timeframe_end: timeframe_end, view_mode: view_mode, currency: currency) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 |
# File 'lib/api_reference/models/costs_request_params.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['timeframe_start'] = 'timeframe_start' @_hash['timeframe_end'] = 'timeframe_end' @_hash['view_mode'] = 'view_mode' @_hash['currency'] = 'currency' @_hash end |
.nullables ⇒ Object
An array for nullable fields
53 54 55 56 57 58 59 60 |
# File 'lib/api_reference/models/costs_request_params.rb', line 53 def self.nullables %w[ timeframe_start timeframe_end view_mode currency ] end |
.optionals ⇒ Object
An array for optional fields
43 44 45 46 47 48 49 50 |
# File 'lib/api_reference/models/costs_request_params.rb', line 43 def self.optionals %w[ timeframe_start timeframe_end view_mode currency ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
111 112 113 114 115 116 |
# File 'lib/api_reference/models/costs_request_params.rb', line 111 def inspect class_name = self.class.name.split('::').last "<#{class_name} timeframe_start: #{@timeframe_start.inspect}, timeframe_end:"\ " #{@timeframe_end.inspect}, view_mode: #{@view_mode.inspect}, currency:"\ " #{@currency.inspect}>" end |
#to_custom_timeframe_end ⇒ Object
99 100 101 |
# File 'lib/api_reference/models/costs_request_params.rb', line 99 def to_custom_timeframe_end DateTimeHelper.to_rfc3339(timeframe_end) end |
#to_custom_timeframe_start ⇒ Object
95 96 97 |
# File 'lib/api_reference/models/costs_request_params.rb', line 95 def to_custom_timeframe_start DateTimeHelper.to_rfc3339(timeframe_start) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
104 105 106 107 108 |
# File 'lib/api_reference/models/costs_request_params.rb', line 104 def to_s class_name = self.class.name.split('::').last "<#{class_name} timeframe_start: #{@timeframe_start}, timeframe_end: #{@timeframe_end},"\ " view_mode: #{@view_mode}, currency: #{@currency}>" end |