Class: ApiEntreprise::Client

Inherits:
ApiEntreprise::Commons::ClientBase show all
Defined in:
lib/api_entreprise/client.rb

Constant Summary collapse

REQUIRED_PARAMS =
%i[recipient context object].freeze
SIRET_PARAMS =
%i[recipient].freeze

Instance Attribute Summary

Attributes inherited from ApiEntreprise::Commons::ClientBase

#configuration

Instance Method Summary collapse

Methods inherited from ApiEntreprise::Commons::ClientBase

#get

Constructor Details

#initialize(token: nil, environment: nil, default_params: {}, base_url: nil, auth_strategy: nil, **opts) ⇒ Client

Returns a new instance of Client.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/api_entreprise/client.rb', line 40

def initialize(token: nil, environment: nil, default_params: {}, base_url: nil, auth_strategy: nil, **opts)
  env_token = token || ENV.fetch('API_ENTREPRISE_TOKEN', nil)
  env_env = (environment || ENV.fetch('API_ENTREPRISE_ENV', :production)).to_sym

  config = Commons::Configuration.new(
    base_urls: BASE_URLS,
    token: env_token,
    auth_strategy: auth_strategy,
    environment: env_env,
    base_url: base_url || ENV.fetch('API_ENTREPRISE_BASE_URL', nil),
    default_params: default_params,
    user_agent: opts[:user_agent] || Commons::UserAgent.build(product: 'api-entreprise-ruby', version: VERSION),
    open_timeout: opts[:open_timeout] || Commons::Configuration::DEFAULT_OPEN_TIMEOUT,
    read_timeout: opts[:read_timeout] || Commons::Configuration::DEFAULT_READ_TIMEOUT,
    retry: opts[:retry],
    logger: opts[:logger],
    adapter: opts[:adapter]
  )
  super(config, product: :entreprise)
end

Instance Method Details

#ademeObject

<scaffold:resources:begin>



62
63
64
# File 'lib/api_entreprise/client.rb', line 62

def ademe
  @ademe ||= Resources::Ademe.new(self)
end

#banque_de_franceObject



65
66
67
# File 'lib/api_entreprise/client.rb', line 65

def banque_de_france
  @banque_de_france ||= Resources::BanqueDeFrance.new(self)
end

#carif_orefObject



68
69
70
# File 'lib/api_entreprise/client.rb', line 68

def carif_oref
  @carif_oref ||= Resources::CarifOref.new(self)
end

#cibtpObject



71
72
73
# File 'lib/api_entreprise/client.rb', line 71

def cibtp
  @cibtp ||= Resources::Cibtp.new(self)
end

#cma_franceObject



74
75
76
# File 'lib/api_entreprise/client.rb', line 74

def cma_france
  @cma_france ||= Resources::CmaFrance.new(self)
end

#cnetpObject



77
78
79
# File 'lib/api_entreprise/client.rb', line 77

def cnetp
  @cnetp ||= Resources::Cnetp.new(self)
end

#data_subventionObject



80
81
82
# File 'lib/api_entreprise/client.rb', line 80

def data_subvention
  @data_subvention ||= Resources::DataSubvention.new(self)
end

#dgfipObject



83
84
85
# File 'lib/api_entreprise/client.rb', line 83

def dgfip
  @dgfip ||= Resources::Dgfip.new(self)
end

#djepvaObject



86
87
88
# File 'lib/api_entreprise/client.rb', line 86

def djepva
  @djepva ||= Resources::Djepva.new(self)
end

#douanesObject



89
90
91
# File 'lib/api_entreprise/client.rb', line 89

def douanes
  @douanes ||= Resources::Douanes.new(self)
end

#european_commissionObject



92
93
94
# File 'lib/api_entreprise/client.rb', line 92

def european_commission
  @european_commission ||= Resources::EuropeanCommission.new(self)
end

#fabrique_numerique_ministeres_sociauxObject



95
96
97
# File 'lib/api_entreprise/client.rb', line 95

def fabrique_numerique_ministeres_sociaux
  @fabrique_numerique_ministeres_sociaux ||= Resources::FabriqueNumeriqueMinisteresSociaux.new(self)
end

#fntpObject



98
99
100
# File 'lib/api_entreprise/client.rb', line 98

def fntp
  @fntp ||= Resources::Fntp.new(self)
end

#gip_mdsObject



101
102
103
# File 'lib/api_entreprise/client.rb', line 101

def gip_mds
  @gip_mds ||= Resources::GipMds.new(self)
end

#infogreffeObject



104
105
106
# File 'lib/api_entreprise/client.rb', line 104

def infogreffe
  @infogreffe ||= Resources::Infogreffe.new(self)
end

#inpiObject



107
108
109
# File 'lib/api_entreprise/client.rb', line 107

def inpi
  @inpi ||= Resources::Inpi.new(self)
end

#inseeObject



110
111
112
# File 'lib/api_entreprise/client.rb', line 110

def insee
  @insee ||= Resources::Insee.new(self)
end

#ministere_interieurObject



113
114
115
# File 'lib/api_entreprise/client.rb', line 113

def ministere_interieur
  @ministere_interieur ||= Resources::MinistereInterieur.new(self)
end

#msaObject



116
117
118
# File 'lib/api_entreprise/client.rb', line 116

def msa
  @msa ||= Resources::Msa.new(self)
end

#opqibiObject



119
120
121
# File 'lib/api_entreprise/client.rb', line 119

def opqibi
  @opqibi ||= Resources::Opqibi.new(self)
end

#probtpObject



122
123
124
# File 'lib/api_entreprise/client.rb', line 122

def probtp
  @probtp ||= Resources::Probtp.new(self)
end

#qualibatObject



125
126
127
# File 'lib/api_entreprise/client.rb', line 125

def qualibat
  @qualibat ||= Resources::Qualibat.new(self)
end

#qualifelecObject



128
129
130
# File 'lib/api_entreprise/client.rb', line 128

def qualifelec
  @qualifelec ||= Resources::Qualifelec.new(self)
end

#urssafObject



131
132
133
# File 'lib/api_entreprise/client.rb', line 131

def urssaf
  @urssaf ||= Resources::Urssaf.new(self)
end