Class: Flexibee::OrderTypes

Inherits:
Object
  • Object
show all
Defined in:
lib/flexibee/order_types.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ OrderTypes

Returns a new instance of OrderTypes.



6
7
8
# File 'lib/flexibee/order_types.rb', line 6

def initialize(client)
  @client = client
end

Instance Method Details

#find(filter = nil) ⇒ Object



19
20
21
# File 'lib/flexibee/order_types.rb', line 19

def find(filter=nil)
  @client.get("/typ-objednavky-vydane", {}, filter)['winstrom']['typ-objednavky-vydane']
end

#order_typesObject



10
11
12
13
14
15
16
17
# File 'lib/flexibee/order_types.rb', line 10

def order_types
  find.map do |type|
    currency = type['mena'].split(':').last
    currency_name = type['mena@showAs'].split(':').last.strip
    Flexibee::OrderType.new(type['id'], type['lastUpdate'],
      type['kod'], type['nazev'], currency, type['mena@ref'], currency_name)
  end
end