Class: Fakturoid::Client
- Inherits:
-
Object
show all
- Extended by:
- Forwardable
- Includes:
- Api
- Defined in:
- lib/fakturoid/client.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Api
#account, #bank_accounts, #events, #expense_payments, #expenses, #generators, #inbox_files, #inventory_items, #inventory_moves, #invoice_messages, #invoice_payments, #invoices, #number_formats, #recurring_generators, #subjects, #todos, #users, #webhooks
Constructor Details
#initialize(config = {}) ⇒ Client
Returns a new instance of Client.
21
22
23
24
25
26
|
# File 'lib/fakturoid/client.rb', line 21
def initialize(config = {})
raise ConfigurationError, "Configuration is missing" if self.class.config.nil?
@config = self.class.config.duplicate(config)
@oauth = Oauth.new(self)
end
|
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
8
9
10
|
# File 'lib/fakturoid/client.rb', line 8
def config
@config
end
|
Class Method Details
.config ⇒ Object
17
18
19
|
# File 'lib/fakturoid/client.rb', line 17
def self.config
@config
end
|
13
14
15
|
# File 'lib/fakturoid/client.rb', line 13
def self.configure(&block)
@config ||= Fakturoid::Config.new(&block) end
|
Instance Method Details
#account=(account) ⇒ Object
28
29
30
|
# File 'lib/fakturoid/client.rb', line 28
def account=(account)
config.account = account
end
|
#call_credentials_updated_callback ⇒ Object
44
45
46
|
# File 'lib/fakturoid/client.rb', line 44
def call_credentials_updated_callback
config.credentials_updated_callback&.call(config.credentials)
end
|
#credentials ⇒ Object
32
33
34
|
# File 'lib/fakturoid/client.rb', line 32
def credentials
config.credentials
end
|
#credentials=(values) ⇒ Object
36
37
38
|
# File 'lib/fakturoid/client.rb', line 36
def credentials=(values)
config.credentials = values
end
|
#credentials_updated_callback(&block) ⇒ Object
40
41
42
|
# File 'lib/fakturoid/client.rb', line 40
def credentials_updated_callback(&block)
config.credentials_updated_callback = block
end
|