Class: HarvestToInfakt::Infakt::Client
- Inherits:
-
Resource
- Object
- Resource
- HarvestToInfakt::Infakt::Client
show all
- Defined in:
- lib/harvest_to_infakt/infakt/client.rb
Class Method Summary
collapse
Methods inherited from Resource
#id, #initialize, #method_missing
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class HarvestToInfakt::Resource
Class Method Details
.all ⇒ Object
11
12
13
|
# File 'lib/harvest_to_infakt/infakt/client.rb', line 11
def all
@all ||= fetch_all
end
|
.basic_auth_options ⇒ Object
.fetch_all ⇒ Object
23
24
25
26
27
28
29
30
|
# File 'lib/harvest_to_infakt/infakt/client.rb', line 23
def fetch_all
response = get('/api/clients.xml', :basic_auth => basic_auth_options)
response.parsed_response['clients'].inject([]) do |invoices, data|
invoices << new(data)
invoices
end
end
|
.find(id) ⇒ Object
15
16
17
18
19
20
21
|
# File 'lib/harvest_to_infakt/infakt/client.rb', line 15
def find(id)
@find ||= all.inject({}) do |hash, client|
hash[client.id.to_s] = client
hash
end
@find[id.to_s]
end
|