api_particulier 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +23 -0
- data/LICENSE +21 -0
- data/README.md +66 -0
- data/lib/api_particulier/client.rb +76 -0
- data/lib/api_particulier/commons/auth/bearer_token.rb +21 -0
- data/lib/api_particulier/commons/auth/strategy.rb +13 -0
- data/lib/api_particulier/commons/client_base.rb +128 -0
- data/lib/api_particulier/commons/configuration.rb +101 -0
- data/lib/api_particulier/commons/errors.rb +84 -0
- data/lib/api_particulier/commons/middleware/authentication.rb +49 -0
- data/lib/api_particulier/commons/middleware/envelope.rb +31 -0
- data/lib/api_particulier/commons/middleware/error_handler.rb +106 -0
- data/lib/api_particulier/commons/middleware/logging.rb +70 -0
- data/lib/api_particulier/commons/middleware/rate_limit.rb +17 -0
- data/lib/api_particulier/commons/rate_limit.rb +54 -0
- data/lib/api_particulier/commons/response.rb +32 -0
- data/lib/api_particulier/commons/siren.rb +37 -0
- data/lib/api_particulier/commons/siret.rb +37 -0
- data/lib/api_particulier/commons/user_agent.rb +16 -0
- data/lib/api_particulier/commons/version.rb +7 -0
- data/lib/api_particulier/commons.rb +23 -0
- data/lib/api_particulier/resources/ants.rb +28 -0
- data/lib/api_particulier/resources/cnous.rb +65 -0
- data/lib/api_particulier/resources/dsnj.rb +42 -0
- data/lib/api_particulier/resources/dss.rb +238 -0
- data/lib/api_particulier/resources/france_travail.rb +42 -0
- data/lib/api_particulier/resources/gip_mds.rb +42 -0
- data/lib/api_particulier/resources/men.rb +34 -0
- data/lib/api_particulier/resources/mesri.rb +56 -0
- data/lib/api_particulier/resources/sdh.rb +28 -0
- data/lib/api_particulier/version.rb +3 -0
- data/lib/api_particulier.rb +4 -0
- metadata +107 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# DO NOT EDIT — generated from clients/ruby/commons/ (source digest: 903f3b3aca1a59a6cb1a53ab98f72c365486fc1f).
|
|
3
|
+
# Regenerate via clients/ruby/bin/sync_commons.
|
|
4
|
+
|
|
5
|
+
require 'faraday'
|
|
6
|
+
require 'json'
|
|
7
|
+
|
|
8
|
+
module ApiParticulier::Commons
|
|
9
|
+
module Middleware
|
|
10
|
+
class ErrorHandler < Faraday::Middleware
|
|
11
|
+
AUTH_CODES = %w[00101 00103 00105].freeze
|
|
12
|
+
AUTHORIZATION_CODES = %w[00100].freeze
|
|
13
|
+
|
|
14
|
+
def on_complete(env)
|
|
15
|
+
status = env.status
|
|
16
|
+
return if status.between?(200, 299)
|
|
17
|
+
|
|
18
|
+
exception = map_exception(status, env)
|
|
19
|
+
raise exception if exception
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def call(env)
|
|
23
|
+
super
|
|
24
|
+
rescue Faraday::TimeoutError, Faraday::ConnectionFailed => e
|
|
25
|
+
raise ApiParticulier::Commons::TransportError.new(
|
|
26
|
+
e.message,
|
|
27
|
+
method: env.method,
|
|
28
|
+
url: env.url.to_s
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
private
|
|
33
|
+
|
|
34
|
+
def map_exception(status, env)
|
|
35
|
+
errors = extract_errors(env.body)
|
|
36
|
+
klass = klass_for(status)
|
|
37
|
+
return nil unless klass
|
|
38
|
+
|
|
39
|
+
kwargs = {
|
|
40
|
+
http_status: status,
|
|
41
|
+
errors: errors,
|
|
42
|
+
method: env.method,
|
|
43
|
+
url: env.url.to_s
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if klass == ApiParticulier::Commons::RateLimitError
|
|
47
|
+
kwargs[:retry_after] = compute_retry_after(env, errors)
|
|
48
|
+
elsif klass == ApiParticulier::Commons::ProviderError
|
|
49
|
+
kwargs[:retry_after] = provider_retry(errors)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
klass.new(nil, **kwargs)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def klass_for(status)
|
|
56
|
+
case status
|
|
57
|
+
when 401 then ApiParticulier::Commons::AuthenticationError
|
|
58
|
+
when 403 then ApiParticulier::Commons::AuthorizationError
|
|
59
|
+
when 404 then ApiParticulier::Commons::NotFoundError
|
|
60
|
+
when 409 then ApiParticulier::Commons::ConflictError
|
|
61
|
+
when 422 then ApiParticulier::Commons::ValidationError
|
|
62
|
+
when 429 then ApiParticulier::Commons::RateLimitError
|
|
63
|
+
when 400..499 then ApiParticulier::Commons::ClientError
|
|
64
|
+
when 502 then ApiParticulier::Commons::ProviderError
|
|
65
|
+
when 503, 504 then ApiParticulier::Commons::ProviderUnavailableError
|
|
66
|
+
when 500..599 then ApiParticulier::Commons::ServerError
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def extract_errors(body)
|
|
71
|
+
parsed = body
|
|
72
|
+
parsed = safely_parse(body) if body.is_a?(String)
|
|
73
|
+
return [] unless parsed.is_a?(Hash)
|
|
74
|
+
|
|
75
|
+
Array(parsed['errors'] || parsed[:errors])
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def safely_parse(body)
|
|
79
|
+
JSON.parse(body)
|
|
80
|
+
rescue JSON::ParserError
|
|
81
|
+
nil
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def compute_retry_after(env, errors)
|
|
85
|
+
from_headers = ApiParticulier::Commons::RateLimit.from_headers(env.response_headers)&.retry_after
|
|
86
|
+
return from_headers if from_headers && from_headers.positive?
|
|
87
|
+
|
|
88
|
+
provider_retry(errors) || from_headers
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def provider_retry(errors)
|
|
92
|
+
first = errors.first || {}
|
|
93
|
+
meta = first['meta'] || first[:meta] || {}
|
|
94
|
+
value = meta['retry_in'] || meta[:retry_in]
|
|
95
|
+
return nil if value.nil?
|
|
96
|
+
|
|
97
|
+
Integer(value)
|
|
98
|
+
rescue ArgumentError, TypeError
|
|
99
|
+
nil
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
# No Faraday.register_middleware: symbols are process-global and collide when
|
|
105
|
+
# multiple gouv.fr gems are loaded in the same process. Clients pass the class
|
|
106
|
+
# directly to conn.response / conn.use.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# DO NOT EDIT — generated from clients/ruby/commons/ (source digest: 903f3b3aca1a59a6cb1a53ab98f72c365486fc1f).
|
|
3
|
+
# Regenerate via clients/ruby/bin/sync_commons.
|
|
4
|
+
|
|
5
|
+
require 'faraday'
|
|
6
|
+
|
|
7
|
+
module ApiParticulier::Commons
|
|
8
|
+
module Middleware
|
|
9
|
+
class Logging < Faraday::Middleware
|
|
10
|
+
def initialize(app, logger: nil, redact_query: false)
|
|
11
|
+
super(app)
|
|
12
|
+
@logger = logger
|
|
13
|
+
@redact_query = redact_query
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def call(env)
|
|
17
|
+
started = monotonic_now
|
|
18
|
+
response = @app.call(env)
|
|
19
|
+
log(env, response, monotonic_now - started) if @logger
|
|
20
|
+
response
|
|
21
|
+
rescue StandardError => e
|
|
22
|
+
log_error(env, e, monotonic_now - started) if @logger
|
|
23
|
+
raise
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def log(env, response, duration_ms)
|
|
29
|
+
@logger.info(
|
|
30
|
+
method: env.method.to_s.upcase,
|
|
31
|
+
url: safe_url(env.url),
|
|
32
|
+
status: response.status,
|
|
33
|
+
duration_ms: duration_ms.round(1),
|
|
34
|
+
rate_limit_remaining: extract_remaining(response.env.response_headers)
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def log_error(env, exception, duration_ms)
|
|
39
|
+
@logger.error(
|
|
40
|
+
method: env.method.to_s.upcase,
|
|
41
|
+
url: safe_url(env.url),
|
|
42
|
+
error: exception.class.name,
|
|
43
|
+
message: exception.message,
|
|
44
|
+
duration_ms: duration_ms.round(1)
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def safe_url(url)
|
|
49
|
+
return url.to_s unless @redact_query
|
|
50
|
+
|
|
51
|
+
dup = url.dup
|
|
52
|
+
dup.query = nil
|
|
53
|
+
"#{dup}?[REDACTED]"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def extract_remaining(headers)
|
|
57
|
+
return nil unless headers
|
|
58
|
+
|
|
59
|
+
headers.each do |k, v|
|
|
60
|
+
return v.to_i if k.to_s.downcase == 'ratelimit-remaining' && !v.nil? && !v.to_s.empty?
|
|
61
|
+
end
|
|
62
|
+
nil
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def monotonic_now
|
|
66
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC) * 1000.0
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# DO NOT EDIT — generated from clients/ruby/commons/ (source digest: 903f3b3aca1a59a6cb1a53ab98f72c365486fc1f).
|
|
3
|
+
# Regenerate via clients/ruby/bin/sync_commons.
|
|
4
|
+
|
|
5
|
+
require 'faraday'
|
|
6
|
+
|
|
7
|
+
module ApiParticulier::Commons
|
|
8
|
+
module Middleware
|
|
9
|
+
class RateLimitParser < Faraday::Middleware
|
|
10
|
+
ENV_KEY = :api_gouv_rate_limit
|
|
11
|
+
|
|
12
|
+
def on_complete(env)
|
|
13
|
+
env[ENV_KEY] = ApiParticulier::Commons::RateLimit.from_headers(env.response_headers)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# DO NOT EDIT — generated from clients/ruby/commons/ (source digest: 903f3b3aca1a59a6cb1a53ab98f72c365486fc1f).
|
|
3
|
+
# Regenerate via clients/ruby/bin/sync_commons.
|
|
4
|
+
|
|
5
|
+
module ApiParticulier::Commons
|
|
6
|
+
class RateLimit
|
|
7
|
+
attr_reader :limit, :remaining, :reset_at
|
|
8
|
+
|
|
9
|
+
def self.from_headers(headers)
|
|
10
|
+
return nil if headers.nil?
|
|
11
|
+
|
|
12
|
+
normalized = headers.transform_keys { |k| k.to_s.downcase }
|
|
13
|
+
limit = parse_int(normalized['ratelimit-limit'])
|
|
14
|
+
remaining = parse_int(normalized['ratelimit-remaining'])
|
|
15
|
+
reset_at = parse_reset(normalized['ratelimit-reset'])
|
|
16
|
+
|
|
17
|
+
return nil if limit.nil? && remaining.nil? && reset_at.nil?
|
|
18
|
+
|
|
19
|
+
new(limit: limit, remaining: remaining, reset_at: reset_at)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.parse_int(value)
|
|
23
|
+
return nil if value.nil? || value.to_s.strip.empty?
|
|
24
|
+
|
|
25
|
+
Integer(value.to_s, 10)
|
|
26
|
+
rescue ArgumentError
|
|
27
|
+
nil
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.parse_reset(value)
|
|
31
|
+
ts = parse_int(value)
|
|
32
|
+
return nil if ts.nil?
|
|
33
|
+
|
|
34
|
+
Time.at(ts).utc
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def initialize(limit:, remaining:, reset_at:)
|
|
38
|
+
@limit = limit
|
|
39
|
+
@remaining = remaining
|
|
40
|
+
@reset_at = reset_at
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def retry_after(now: Time.now)
|
|
44
|
+
return nil if reset_at.nil?
|
|
45
|
+
|
|
46
|
+
diff = reset_at.to_i - now.to_i
|
|
47
|
+
diff.negative? ? 0 : diff
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def to_h
|
|
51
|
+
{ limit: limit, remaining: remaining, reset_at: reset_at }
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# DO NOT EDIT — generated from clients/ruby/commons/ (source digest: 903f3b3aca1a59a6cb1a53ab98f72c365486fc1f).
|
|
3
|
+
# Regenerate via clients/ruby/bin/sync_commons.
|
|
4
|
+
|
|
5
|
+
module ApiParticulier::Commons
|
|
6
|
+
class Response
|
|
7
|
+
attr_reader :raw, :http_status, :headers, :rate_limit
|
|
8
|
+
|
|
9
|
+
def initialize(raw:, http_status:, headers:, rate_limit: nil)
|
|
10
|
+
@raw = raw.is_a?(Hash) ? raw : {}
|
|
11
|
+
@http_status = http_status
|
|
12
|
+
@headers = headers || {}
|
|
13
|
+
@rate_limit = rate_limit
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def data
|
|
17
|
+
raw['data']
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def links
|
|
21
|
+
raw['links'] || {}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def meta
|
|
25
|
+
raw['meta'] || {}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def success?
|
|
29
|
+
http_status.to_i.between?(200, 299)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# DO NOT EDIT — generated from clients/ruby/commons/ (source digest: 903f3b3aca1a59a6cb1a53ab98f72c365486fc1f).
|
|
3
|
+
# Regenerate via clients/ruby/bin/sync_commons.
|
|
4
|
+
|
|
5
|
+
module ApiParticulier::Commons
|
|
6
|
+
module Siren
|
|
7
|
+
module_function
|
|
8
|
+
|
|
9
|
+
DIGITS_9 = /\A\d{9}\z/.freeze
|
|
10
|
+
LA_POSTE_PATTERN = /\A356000000\z/.freeze
|
|
11
|
+
|
|
12
|
+
def valid?(value)
|
|
13
|
+
return false if value.nil?
|
|
14
|
+
return false unless value.to_s.match?(DIGITS_9)
|
|
15
|
+
return true if value.to_s.match?(LA_POSTE_PATTERN)
|
|
16
|
+
|
|
17
|
+
(luhn_checksum(value.to_s) % 10).zero?
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def validate!(value, parameter:)
|
|
21
|
+
return if valid?(value)
|
|
22
|
+
|
|
23
|
+
raise InvalidSirenError,
|
|
24
|
+
"#{parameter.inspect} must be a 9-digit SIREN passing the Luhn checksum; got #{value.inspect}"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def luhn_checksum(value)
|
|
28
|
+
accum = 0
|
|
29
|
+
value.reverse.each_char.map(&:to_i).each_with_index do |digit, index|
|
|
30
|
+
t = index.even? ? digit : digit * 2
|
|
31
|
+
t -= 9 if t >= 10
|
|
32
|
+
accum += t
|
|
33
|
+
end
|
|
34
|
+
accum
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# DO NOT EDIT — generated from clients/ruby/commons/ (source digest: 903f3b3aca1a59a6cb1a53ab98f72c365486fc1f).
|
|
3
|
+
# Regenerate via clients/ruby/bin/sync_commons.
|
|
4
|
+
|
|
5
|
+
module ApiParticulier::Commons
|
|
6
|
+
module Siret
|
|
7
|
+
module_function
|
|
8
|
+
|
|
9
|
+
LA_POSTE_PATTERN = /\A356000000\d{5}\z/.freeze
|
|
10
|
+
DIGITS_14 = /\A\d{14}\z/.freeze
|
|
11
|
+
|
|
12
|
+
def valid?(value)
|
|
13
|
+
return false if value.nil?
|
|
14
|
+
return false unless value.to_s.match?(DIGITS_14)
|
|
15
|
+
return true if value.to_s.match?(LA_POSTE_PATTERN)
|
|
16
|
+
|
|
17
|
+
(luhn_checksum(value.to_s) % 10).zero?
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def validate!(value, parameter:)
|
|
21
|
+
return if valid?(value)
|
|
22
|
+
|
|
23
|
+
raise InvalidSiretError,
|
|
24
|
+
"#{parameter.inspect} must be a 14-digit SIRET passing the Luhn checksum (or a La Poste SIRET); got #{value.inspect}"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def luhn_checksum(value)
|
|
28
|
+
accum = 0
|
|
29
|
+
value.reverse.each_char.map(&:to_i).each_with_index do |digit, index|
|
|
30
|
+
t = index.even? ? digit : digit * 2
|
|
31
|
+
t -= 9 if t >= 10
|
|
32
|
+
accum += t
|
|
33
|
+
end
|
|
34
|
+
accum
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# DO NOT EDIT — generated from clients/ruby/commons/ (source digest: 903f3b3aca1a59a6cb1a53ab98f72c365486fc1f).
|
|
3
|
+
# Regenerate via clients/ruby/bin/sync_commons.
|
|
4
|
+
|
|
5
|
+
module ApiParticulier::Commons
|
|
6
|
+
module UserAgent
|
|
7
|
+
URL = 'https://github.com/datagouv/apistration'.freeze
|
|
8
|
+
|
|
9
|
+
module_function
|
|
10
|
+
|
|
11
|
+
def build(product:, version:, suffix: nil)
|
|
12
|
+
base = "#{product}/#{version} (+#{URL})"
|
|
13
|
+
suffix ? "#{base} #{suffix}" : base
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# DO NOT EDIT — generated from clients/ruby/commons/ (source digest: 903f3b3aca1a59a6cb1a53ab98f72c365486fc1f).
|
|
3
|
+
# Regenerate via clients/ruby/bin/sync_commons.
|
|
4
|
+
|
|
5
|
+
module ApiParticulier; end
|
|
6
|
+
module ApiParticulier::Commons; end
|
|
7
|
+
|
|
8
|
+
require_relative 'commons/version'
|
|
9
|
+
require_relative 'commons/errors'
|
|
10
|
+
require_relative 'commons/siret'
|
|
11
|
+
require_relative 'commons/siren'
|
|
12
|
+
require_relative 'commons/rate_limit'
|
|
13
|
+
require_relative 'commons/response'
|
|
14
|
+
require_relative 'commons/user_agent'
|
|
15
|
+
require_relative 'commons/auth/strategy'
|
|
16
|
+
require_relative 'commons/auth/bearer_token'
|
|
17
|
+
require_relative 'commons/middleware/authentication'
|
|
18
|
+
require_relative 'commons/middleware/envelope'
|
|
19
|
+
require_relative 'commons/middleware/error_handler'
|
|
20
|
+
require_relative 'commons/middleware/rate_limit'
|
|
21
|
+
require_relative 'commons/middleware/logging'
|
|
22
|
+
require_relative 'commons/configuration'
|
|
23
|
+
require_relative 'commons/client_base'
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# DO NOT EDIT — generated from commons/swagger/openapi-*.yaml by
|
|
3
|
+
# clients/ruby/bin/scaffold_resources. Edit the OpenAPI spec or the scaffold
|
|
4
|
+
# script instead.
|
|
5
|
+
|
|
6
|
+
module ApiParticulier
|
|
7
|
+
module Resources
|
|
8
|
+
class Ants
|
|
9
|
+
def initialize(client)
|
|
10
|
+
@client = client
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# [FranceConnect] Extrait d'immatriculation véhicule
|
|
14
|
+
# Logical endpoint: /ants/extrait_immatriculation_vehicule/france_connect
|
|
15
|
+
# Versions available: [3] — default: 3
|
|
16
|
+
def extrait_immatriculation_vehicule(version: nil, recipient: nil, immatriculation:)
|
|
17
|
+
path =
|
|
18
|
+
case version || 3
|
|
19
|
+
when 3
|
|
20
|
+
"/v3/ants/extrait_immatriculation_vehicule/france_connect"
|
|
21
|
+
else
|
|
22
|
+
raise ArgumentError, "version #{version.inspect} not available for /ants/extrait_immatriculation_vehicule/france_connect; supported: [3]"
|
|
23
|
+
end
|
|
24
|
+
@client.get(path, params: { "recipient" => recipient, "immatriculation" => immatriculation }.compact)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# DO NOT EDIT — generated from commons/swagger/openapi-*.yaml by
|
|
3
|
+
# clients/ruby/bin/scaffold_resources. Edit the OpenAPI spec or the scaffold
|
|
4
|
+
# script instead.
|
|
5
|
+
|
|
6
|
+
module ApiParticulier
|
|
7
|
+
module Resources
|
|
8
|
+
class Cnous
|
|
9
|
+
def initialize(client)
|
|
10
|
+
@client = client
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# [FranceConnect] Statut étudiant boursier
|
|
14
|
+
# Logical endpoint: /cnous/etudiant_boursier/france_connect
|
|
15
|
+
# Versions available: [3, 4] — default: 4
|
|
16
|
+
def etudiant_boursier(version: nil, recipient: nil)
|
|
17
|
+
path =
|
|
18
|
+
case version || 4
|
|
19
|
+
when 3
|
|
20
|
+
warn "[DEPRECATED] /v3/cnous/etudiant_boursier/france_connect (#etudiant_boursier): marked deprecated in the OpenAPI spec.", uplevel: 1
|
|
21
|
+
"/v3/cnous/etudiant_boursier/france_connect"
|
|
22
|
+
when 4
|
|
23
|
+
"/v4/cnous/etudiant_boursier/france_connect"
|
|
24
|
+
else
|
|
25
|
+
raise ArgumentError, "version #{version.inspect} not available for /cnous/etudiant_boursier/france_connect; supported: [3, 4]"
|
|
26
|
+
end
|
|
27
|
+
@client.get(path, params: { "recipient" => recipient }.compact)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# [Identité] Statut étudiant boursier
|
|
31
|
+
# Logical endpoint: /cnous/etudiant_boursier/identite
|
|
32
|
+
# Versions available: [3, 4] — default: 4
|
|
33
|
+
def etudiant_boursier_identite(version: nil, recipient: nil, nom_naissance:, prenoms:, annee_date_naissance:, mois_date_naissance:, jour_date_naissance:, sexe_etat_civil: nil, code_cog_insee_commune_naissance: nil, nom_commune_naissance: nil, code_cog_insee_departement_naissance: nil)
|
|
34
|
+
path =
|
|
35
|
+
case version || 4
|
|
36
|
+
when 3
|
|
37
|
+
warn "[DEPRECATED] /v3/cnous/etudiant_boursier/identite (#etudiant_boursier_identite): marked deprecated in the OpenAPI spec.", uplevel: 1
|
|
38
|
+
"/v3/cnous/etudiant_boursier/identite"
|
|
39
|
+
when 4
|
|
40
|
+
"/v4/cnous/etudiant_boursier/identite"
|
|
41
|
+
else
|
|
42
|
+
raise ArgumentError, "version #{version.inspect} not available for /cnous/etudiant_boursier/identite; supported: [3, 4]"
|
|
43
|
+
end
|
|
44
|
+
@client.get(path, params: { "recipient" => recipient, "nomNaissance" => nom_naissance, "prenoms" => prenoms, "anneeDateNaissance" => annee_date_naissance, "moisDateNaissance" => mois_date_naissance, "jourDateNaissance" => jour_date_naissance, "sexeEtatCivil" => sexe_etat_civil, "codeCogInseeCommuneNaissance" => code_cog_insee_commune_naissance, "nomCommuneNaissance" => nom_commune_naissance, "codeCogInseeDepartementNaissance" => code_cog_insee_departement_naissance }.compact)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# [INE] Statut étudiant boursier
|
|
48
|
+
# Logical endpoint: /cnous/etudiant_boursier/ine
|
|
49
|
+
# Versions available: [3, 4] — default: 4
|
|
50
|
+
def ine(version: nil, recipient: nil, ine:)
|
|
51
|
+
path =
|
|
52
|
+
case version || 4
|
|
53
|
+
when 3
|
|
54
|
+
warn "[DEPRECATED] /v3/cnous/etudiant_boursier/ine (#ine): marked deprecated in the OpenAPI spec.", uplevel: 1
|
|
55
|
+
"/v3/cnous/etudiant_boursier/ine"
|
|
56
|
+
when 4
|
|
57
|
+
"/v4/cnous/etudiant_boursier/ine"
|
|
58
|
+
else
|
|
59
|
+
raise ArgumentError, "version #{version.inspect} not available for /cnous/etudiant_boursier/ine; supported: [3, 4]"
|
|
60
|
+
end
|
|
61
|
+
@client.get(path, params: { "recipient" => recipient, "ine" => ine }.compact)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# DO NOT EDIT — generated from commons/swagger/openapi-*.yaml by
|
|
3
|
+
# clients/ruby/bin/scaffold_resources. Edit the OpenAPI spec or the scaffold
|
|
4
|
+
# script instead.
|
|
5
|
+
|
|
6
|
+
module ApiParticulier
|
|
7
|
+
module Resources
|
|
8
|
+
class Dsnj
|
|
9
|
+
def initialize(client)
|
|
10
|
+
@client = client
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# [FranceConnect] API Service national
|
|
14
|
+
# Logical endpoint: /dsnj/service_national/france_connect
|
|
15
|
+
# Versions available: [3] — default: 3
|
|
16
|
+
def service_national(version: nil, recipient: nil)
|
|
17
|
+
path =
|
|
18
|
+
case version || 3
|
|
19
|
+
when 3
|
|
20
|
+
"/v3/dsnj/service_national/france_connect"
|
|
21
|
+
else
|
|
22
|
+
raise ArgumentError, "version #{version.inspect} not available for /dsnj/service_national/france_connect; supported: [3]"
|
|
23
|
+
end
|
|
24
|
+
@client.get(path, params: { "recipient" => recipient }.compact)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# [Identité] API Service national
|
|
28
|
+
# Logical endpoint: /dsnj/service_national/identite
|
|
29
|
+
# Versions available: [3] — default: 3
|
|
30
|
+
def service_national_identite(version: nil, recipient: nil, nom_naissance:, prenoms:, annee_date_naissance:, mois_date_naissance:, jour_date_naissance:, sexe_etat_civil:, code_cog_insee_commune_naissance: nil, code_cog_insee_pays_naissance:)
|
|
31
|
+
path =
|
|
32
|
+
case version || 3
|
|
33
|
+
when 3
|
|
34
|
+
"/v3/dsnj/service_national/identite"
|
|
35
|
+
else
|
|
36
|
+
raise ArgumentError, "version #{version.inspect} not available for /dsnj/service_national/identite; supported: [3]"
|
|
37
|
+
end
|
|
38
|
+
@client.get(path, params: { "recipient" => recipient, "nomNaissance" => nom_naissance, "prenoms" => prenoms, "anneeDateNaissance" => annee_date_naissance, "moisDateNaissance" => mois_date_naissance, "jourDateNaissance" => jour_date_naissance, "sexeEtatCivil" => sexe_etat_civil, "codeCogInseeCommuneNaissance" => code_cog_insee_commune_naissance, "codeCogInseePaysNaissance" => code_cog_insee_pays_naissance }.compact)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|