Class: Cpro::Client

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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 =  || configuration.
  @token_provider = token_provider || configuration.token_provider
  @connections = connections || {}
end

Instance Attribute Details

#accountObject (readonly)

Returns the value of attribute account.



9
10
11
# File 'lib/cpro/client.rb', line 9

def 
  @account
end

#configurationObject (readonly)

Returns the value of attribute configuration.



9
10
11
# File 'lib/cpro/client.rb', line 9

def configuration
  @configuration
end

Instance Method Details

#annuaireObject



22
23
24
# File 'lib/cpro/client.rb', line 22

def annuaire
  @annuaire ||= Resources::Annuaire.new(self, connection_for(ANNUAIRE_PATH))
end

#facturesObject



30
31
32
# File 'lib/cpro/client.rb', line 30

def factures
  @factures ||= Resources::Factures.new(self, connection_for(FACTURES_PATH))
end

#fluxObject



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 ()
  self.class.new(configuration, account: , token_provider: token_provider, connections: connections)
end