Class: Io::Flow::V0::Models::RatecardRate
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::RatecardRate
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Specific line item in a ratecard lane with information on a weight threshold and corresponding amount to charge
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ RatecardRate
constructor
A new instance of RatecardRate.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ RatecardRate
Returns a new instance of RatecardRate.
45849 45850 45851 45852 45853 45854 45855 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45849 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :amount, :weight], 'RatecardRate') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @amount = HttpClient::Preconditions.assert_class('amount', opts.delete(:amount), Numeric) @weight = HttpClient::Preconditions.assert_class('weight', opts.delete(:weight), Numeric) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
45847 45848 45849 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45847 def amount @amount end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
45847 45848 45849 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45847 def id @id end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
45847 45848 45849 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45847 def weight @weight end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
45861 45862 45863 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45861 def copy(incoming={}) RatecardRate.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
45865 45866 45867 45868 45869 45870 45871 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45865 def to_hash { :id => id, :amount => amount, :weight => weight } end |
#to_json ⇒ Object
45857 45858 45859 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45857 def to_json JSON.dump(to_hash) end |