Class: Io::Flow::V0::Models::BillingDiscount
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::BillingDiscount
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ BillingDiscount
constructor
A new instance of BillingDiscount.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ BillingDiscount
Returns a new instance of BillingDiscount.
32418 32419 32420 32421 32422 32423 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32418 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:amount], 'BillingDiscount') @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal) @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String)) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
32416 32417 32418 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32416 def amount @amount end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
32416 32417 32418 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32416 def description @description end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
32429 32430 32431 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32429 def copy(incoming={}) BillingDiscount.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
32433 32434 32435 32436 32437 32438 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32433 def to_hash { :amount => amount.to_f.to_s, :description => description } end |
#to_json ⇒ Object
32425 32426 32427 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32425 def to_json JSON.dump(to_hash) end |