Class: Flexibee::InvoiceTypes

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ InvoiceTypes

Returns a new instance of InvoiceTypes.



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

def initialize(client)
  @client = client
end

Instance Method Details

#find(filter = nil) ⇒ Object



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

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

#invoice_typesObject



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

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