Class: Io::Flow::V0::Models::FlatRateForm

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

Instance Attribute Summary collapse

Attributes inherited from TierRuleOutcomeForm

#discriminator

Instance Method Summary collapse

Methods inherited from TierRuleOutcomeForm

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ FlatRateForm

Returns a new instance of FlatRateForm.



19096
19097
19098
19099
19100
19101
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19096

def initialize(incoming={})
  super(:discriminator => TierRuleOutcomeForm::Types::FLAT_RATE_FORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:price], 'FlatRateForm')
  @price = (x = opts.delete(:price); x.is_a?(::Io::Flow::V0::Models::Money) ? x : ::Io::Flow::V0::Models::Money.new(x))
end

Instance Attribute Details

#priceObject (readonly)

Returns the value of attribute price.



19094
19095
19096
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19094

def price
  @price
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



19107
19108
19109
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19107

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

#subtype_to_hashObject



19111
19112
19113
19114
19115
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19111

def subtype_to_hash
  {
    :price => price.to_hash
  }
end

#to_jsonObject



19103
19104
19105
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19103

def to_json
  JSON.dump(to_hash)
end