Class: Io::Flow::V0::Models::RatecardRateForm

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 = {}) ⇒ RatecardRateForm

Returns a new instance of RatecardRateForm.



46592
46593
46594
46595
46596
46597
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46592

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:amount, :weight], 'RatecardRateForm')
  @amount = HttpClient::Preconditions.assert_class('amount', opts.delete(:amount), Numeric)
  @weight = HttpClient::Preconditions.assert_class('weight', opts.delete(:weight), Numeric)
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



46590
46591
46592
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46590

def amount
  @amount
end

#weightObject (readonly)

Returns the value of attribute weight.



46590
46591
46592
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46590

def weight
  @weight
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



46603
46604
46605
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46603

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

#to_hashObject



46607
46608
46609
46610
46611
46612
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46607

def to_hash
  {
    :amount => amount,
    :weight => weight
  }
end

#to_jsonObject



46599
46600
46601
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46599

def to_json
  JSON.dump(to_hash)
end