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



33442
33443
33444
33445
33446
33447
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33442

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.



33440
33441
33442
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33440

def label
  @label
end

#typeObject (readonly)

Returns the value of attribute type.



33440
33441
33442
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33440

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



33453
33454
33455
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33453

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

#to_hashObject



33457
33458
33459
33460
33461
33462
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33457

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

#to_jsonObject



33449
33450
33451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33449

def to_json
  JSON.dump(to_hash)
end