Class: ApiReference::CostsRequestParams

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/costs_request_params.rb

Overview

CostsRequestParams 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(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

#currencyString

The currency or custom pricing unit to use.

Returns:

  • (String)


30
31
32
# File 'lib/api_reference/models/costs_request_params.rb', line 30

def currency
  @currency
end

#timeframe_endDateTime

Costs returned are exclusive of timeframe_end.

Returns:

  • (DateTime)


19
20
21
# File 'lib/api_reference/models/costs_request_params.rb', line 19

def timeframe_end
  @timeframe_end
end

#timeframe_startDateTime

Costs returned are inclusive of timeframe_start.

Returns:

  • (DateTime)


15
16
17
# File 'lib/api_reference/models/costs_request_params.rb', line 15

def timeframe_start
  @timeframe_start
end

#view_modeViewMode

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.

Returns:



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

.namesObject

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

.nullablesObject

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

.optionalsObject

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

#inspectObject

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_endObject



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_startObject



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_sObject

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