Class: Io::Flow::V0::Models::ItemMarginPutForm

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ItemMarginPutForm

Returns a new instance of ItemMarginPutForm.



14963
14964
14965
14966
14967
14968
14969
14970
14971
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14963

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:name, :q], 'ItemMarginPutForm')
  @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.



14961
14962
14963
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14961

def fixed
  @fixed
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



14961
14962
14963
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14961

def name
  @name
end

#percent ⇒ Object (readonly)

Returns the value of attribute percent.



14961
14962
14963
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14961

def percent
  @percent
end

#position ⇒ Object (readonly)

Returns the value of attribute position.



14961
14962
14963
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14961

def position
  @position
end

#q ⇒ Object (readonly)

Returns the value of attribute q.



14961
14962
14963
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14961

def q
  @q
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



14977
14978
14979
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14977

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

#to_hash ⇒ Object



14981
14982
14983
14984
14985
14986
14987
14988
14989
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14981

def to_hash
  {
    :name => name,
    :q => q,
    :fixed => fixed,
    :percent => percent,
    :position => position
  }
end

#to_json ⇒ Object



14973
14974
14975
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14973

def to_json
  JSON.dump(to_hash)
end