Class: Smartbill::Sdk::Services::StocksService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/smartbill/sdk/services/stocks_service.rb

Overview

/stocks endpoint.

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Constructor Details

This class inherits a constructor from Smartbill::Sdk::Services::BaseService

Instance Method Details

#get(cif, date, warehouse_name: nil, product_name: nil, product_code: nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/smartbill/sdk/services/stocks_service.rb', line 8

def get(cif, date, warehouse_name: nil, product_name: nil, product_code: nil)
  params = { "cif" => cif, "date" => date }
  params["warehouseName"] = warehouse_name unless warehouse_name.nil?
  params["productName"]   = product_name   unless product_name.nil?
  params["productCode"]   = product_code   unless product_code.nil?
  parse(execute(build_request(
                  method: "GET", base_url: @client.base_url, path: "stocks",
                  params: params, auth_header: @client.auth_header
                )), Models::StocksResponse)
end