Class: Wegift::Stock

Inherits:
Response show all
Defined in:
lib/wegift/models/stock.rb

Constant Summary collapse

PATH =
'/stock'

Constants inherited from Response

Response::STATUS

Instance Attribute Summary collapse

Attributes inherited from Response

#error_code, #error_details, #error_string, #payload, #status

Instance Method Summary collapse

Methods inherited from Response

#is_successful?

Constructor Details

#initialize(params = {}) ⇒ Stock

Returns a new instance of Stock.



12
13
14
# File 'lib/wegift/models/stock.rb', line 12

def initialize(params = {})
  @id = params[:id]
end

Instance Attribute Details

#available_stockObject

response/success



10
11
12
# File 'lib/wegift/models/stock.rb', line 10

def available_stock
  @available_stock
end

#currency_codeObject

response/success



10
11
12
# File 'lib/wegift/models/stock.rb', line 10

def currency_code
  @currency_code
end

#idObject (readonly)

request/payload



7
8
9
# File 'lib/wegift/models/stock.rb', line 7

def id
  @id
end

#product_codeObject

response/success



10
11
12
# File 'lib/wegift/models/stock.rb', line 10

def product_code
  @product_code
end

#product_nameObject

response/success



10
11
12
# File 'lib/wegift/models/stock.rb', line 10

def product_name
  @product_name
end

Instance Method Details

#get(ctx) ⇒ Object

Product Stock GET /api/b2b-sync/v1/stock/ID



18
19
20
21
22
23
# File 'lib/wegift/models/stock.rb', line 18

def get(ctx)
  response = ctx.request(:get, path)
  parse(response)

  self
end