Class: Io::Flow::V0::Models::ItemMarginForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ItemMarginForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
A percent and/or fixed margin to apply to items based on query.
Instance Attribute Summary collapse
-
#fixed ⇒ Object
readonly
Returns the value of attribute fixed.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#percent ⇒ Object
readonly
Returns the value of attribute percent.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#q ⇒ Object
readonly
Returns the value of attribute q.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ItemMarginForm
constructor
A new instance of ItemMarginForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ItemMarginForm
Returns a new instance of ItemMarginForm.
13139 13140 13141 13142 13143 13144 13145 13146 13147 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13139 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:name, :q], 'ItemMarginForm') @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) @q = HttpClient::Preconditions.assert_class('q', opts.delete(:q), String) @fixed = (x = opts.delete(:fixed); x.nil? ? nil : HttpClient::Preconditions.assert_class('fixed', HttpClient::Helper.to_big_decimal(x), BigDecimal)) @percent = (x = opts.delete(:percent); x.nil? ? nil : HttpClient::Preconditions.assert_class('percent', HttpClient::Helper.to_big_decimal(x), BigDecimal)) @position = (x = opts.delete(:position); x.nil? ? nil : HttpClient::Preconditions.assert_class('position', x, Integer)) end |
Instance Attribute Details
#fixed ⇒ Object (readonly)
Returns the value of attribute fixed.
13137 13138 13139 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13137 def fixed @fixed end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
13137 13138 13139 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13137 def name @name end |
#percent ⇒ Object (readonly)
Returns the value of attribute percent.
13137 13138 13139 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13137 def percent @percent end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
13137 13138 13139 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13137 def position @position end |
#q ⇒ Object (readonly)
Returns the value of attribute q.
13137 13138 13139 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13137 def q @q end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
13153 13154 13155 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13153 def copy(incoming={}) ItemMarginForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
13157 13158 13159 13160 13161 13162 13163 13164 13165 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13157 def to_hash { :name => name, :q => q, :fixed => fixed, :percent => percent, :position => position } end |
#to_json ⇒ Object
13149 13150 13151 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13149 def to_json JSON.dump(to_hash) end |