Class: Io::Flow::V0::Models::TierEstimate

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ TierEstimate

Returns a new instance of TierEstimate.



32152
32153
32154
32155
32156
32157
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32152

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:type], 'TierEstimate')
  @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::TierEstimateType) ? x : ::Io::Flow::V0::Models::TierEstimateType.apply(x))
  @label = (x = opts.delete(:label); x.nil? ? nil : HttpClient::Preconditions.assert_class('label', x, String))
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



32150
32151
32152
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32150

def label
  @label
end

#typeObject (readonly)

Returns the value of attribute type.



32150
32151
32152
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32150

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



32163
32164
32165
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32163

def copy(incoming={})
  TierEstimate.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



32167
32168
32169
32170
32171
32172
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32167

def to_hash
  {
    :type => type.value,
    :label => label
  }
end

#to_jsonObject



32159
32160
32161
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32159

def to_json
  JSON.dump(to_hash)
end