Class: Cpro::Client
- Inherits:
-
Object
- Object
- Cpro::Client
- Defined in:
- lib/cpro/client.rb
Constant Summary collapse
- ANNUAIRE_PATH =
"/g2b/annuaire/v1"- FLUX_PATH =
"/g2b/flux/v1"- FACTURES_PATH =
"/g2b/factures/v1"
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
Instance Method Summary collapse
- #annuaire ⇒ Object
- #factures ⇒ Object
- #flux ⇒ Object
-
#initialize(configuration = Cpro.configuration, account: nil, token_provider: nil, connections: nil) ⇒ Client
constructor
A new instance of Client.
- #with_account(account) ⇒ Object
Constructor Details
#initialize(configuration = Cpro.configuration, account: nil, token_provider: nil, connections: nil) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 |
# File 'lib/cpro/client.rb', line 11 def initialize(configuration = Cpro.configuration, account: nil, token_provider: nil, connections: nil) @configuration = configuration @account = account || configuration.account @token_provider = token_provider || configuration.token_provider @connections = connections || {} end |
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
9 10 11 |
# File 'lib/cpro/client.rb', line 9 def account @account end |
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
9 10 11 |
# File 'lib/cpro/client.rb', line 9 def configuration @configuration end |
Instance Method Details
#annuaire ⇒ Object
22 23 24 |
# File 'lib/cpro/client.rb', line 22 def annuaire @annuaire ||= Resources::Annuaire.new(self, connection_for(ANNUAIRE_PATH)) end |
#factures ⇒ Object
30 31 32 |
# File 'lib/cpro/client.rb', line 30 def factures @factures ||= Resources::Factures.new(self, connection_for(FACTURES_PATH)) end |
#flux ⇒ Object
26 27 28 |
# File 'lib/cpro/client.rb', line 26 def flux @flux ||= Resources::Flux.new(self, connection_for(FLUX_PATH)) end |
#with_account(account) ⇒ Object
18 19 20 |
# File 'lib/cpro/client.rb', line 18 def with_account(account) self.class.new(configuration, account: account, token_provider: token_provider, connections: connections) end |