Class: Bsale::Root

Inherits:
APIBase show all
Defined in:
lib/sale/root.rb

Constant Summary collapse

PATHS =
[
  'book_types',
  'coins',
  'clients',
  'discounts',
  'documents',
  'dte_codes',
  'document_types',
  'offices',
  'payments',
  'payment_types',
  'price_lists',
  'product_types',
  'products',
  'sale_conditions',
  'shipping_types',
  'shippings',
  'stocks',
  'returns',
  'taxes',
  'third_party_documents',
  'users',
  'variants'
].freeze

Constants inherited from APIBase

APIBase::ENDPOINT, APIBase::MAX_RETRIES, APIBase::VERSION

Instance Method Summary collapse

Methods inherited from APIBase

#connect, #delete, #disconnect, #get, #initialize, #post, #put, #request

Constructor Details

This class inherits a constructor from Bsale::APIBase

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, params = nil) ⇒ Object



32
33
34
35
36
# File 'lib/sale/root.rb', line 32

def method_missing(name, params = nil)
  if PATHS.include?(name.to_s)
    get("#{name}.json", params)
  end
end

Instance Method Details

#buyersObject



38
39
40
# File 'lib/sale/root.rb', line 38

def buyers
  Bsale::Buyers.new(self)
end

#invoicesObject



42
43
44
# File 'lib/sale/root.rb', line 42

def invoices
  Bsale::Invoices.new(self)
end