class Flexibee::Client

Public Class Methods

new(user_id, login, password, company_id) click to toggle source

working with base response from flexibee

{

"companies" => {
  "company" => {
    "createDt" => "2015-10-17T18:26:39.692+02:00",
    "dbNazev" => "esperia_test",
    "id" => "1",
    "licenseGroup" => "04fc91491a9647d451649736ad8127e2",
    "nazev" => "esperia-test",
    "show" => "true",
    "stavEnum" => "ESTABLISHED",
    "watchingChanges" => "false"
  }
}

}

# File lib/flexibee/client.rb, line 24
def initialize(user_id, login, password, company_id)
  @user_id = user_id
  @login = login
  @password = password
  @company_id = company_id
end

Public Instance Methods

base_response() click to toggle source
# File lib/flexibee/client.rb, line 35
def base_response
  get
end
base_url() click to toggle source
# File lib/flexibee/client.rb, line 31
def base_url
  "https://#{@login}:#{@password}@#{@user_id}.flexibee.eu:5434/c/#{@company_id}"
end
company() click to toggle source

flexibee obejcts

# File lib/flexibee/client.rb, line 42
def company
  @company ||= Company.new(base_response)
end
get(route='', params = {}, filter = nil) click to toggle source

flexibee base call methods

# File lib/flexibee/client.rb, line 69
def get(route='', params = {}, filter = nil)
  url = base_url + route
  unless filter.nil?
    url << '/' + "(#{ERB::Util.url_encode(filter)})"
  end
  url << '.json'
  begin
    JSON.parse(RestClient.get(url, params: params))
  rescue RestClient::ResourceNotFound => e
    Object.new
  end
end
invoice_types() click to toggle source
# File lib/flexibee/client.rb, line 46
def invoice_types
  @invoice_types = InvoiceTypes.new(self).invoice_types
end
order_types() click to toggle source
# File lib/flexibee/client.rb, line 50
def order_types
  @order_types = OrderTypes.new(self).order_types
end
product_list() click to toggle source
# File lib/flexibee/client.rb, line 54
def product_list
  @products = ProductList.new(self)
end
tree() click to toggle source

By default called with { detail: ‘full’ }, normal response does not have any usefull information in it Also to get whole list of categories default passes { limit: 0 } to get default pass { limit: 20 }

# File lib/flexibee/client.rb, line 62
def tree
  @tree = Tree.new(self)
end