Class: ItemBuilder::Modes::Quantity::Base
- Inherits:
-
Object
- Object
- ItemBuilder::Modes::Quantity::Base
show all
- Defined in:
- lib/item_builder/modes/quantity/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(listing, available_quantity) ⇒ Base
Returns a new instance of Base.
10
11
12
13
14
15
|
# File 'lib/item_builder/modes/quantity/base.rb', line 10
def initialize(listing, available_quantity)
raise 'listing is not set' if listing.nil?
@listing = listing
@available_quantity = available_quantity
end
|
Instance Attribute Details
#available_quantity ⇒ Object
Returns the value of attribute available_quantity.
8
9
10
|
# File 'lib/item_builder/modes/quantity/base.rb', line 8
def available_quantity
@available_quantity
end
|
#listing ⇒ Object
Returns the value of attribute listing.
7
8
9
|
# File 'lib/item_builder/modes/quantity/base.rb', line 7
def listing
@listing
end
|
Instance Method Details
#apigateway_get ⇒ Object
31
32
33
|
# File 'lib/item_builder/modes/quantity/base.rb', line 31
def apigateway_get
RestClient.get("#{host}?#{params}")
end
|
#order_host ⇒ Object
17
18
19
20
|
# File 'lib/item_builder/modes/quantity/base.rb', line 17
def order_host
url = ENV['ORDERS_URL'] || 'orders.forstok.com'
url + '/api/v2/item_line/reserved_stock'
end
|
#reserved_params ⇒ Object
22
23
24
25
|
# File 'lib/item_builder/modes/quantity/base.rb', line 22
def reserved_params
"account_id=#{listing.profile_channel_association_id}
&item_variant_id=#{listing.variant_id}"
end
|
#reserved_stock ⇒ Object
27
28
29
|
# File 'lib/item_builder/modes/quantity/base.rb', line 27
def reserved_stock
RestClient.get("#{order_host}?#{reserved_params}")
end
|