moov_ruby 0.1.17 → 0.1.19
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 +4 -4
- data/lib/moov/client.rb +2 -1
- data/lib/moov/models/components/achfees.rb +57 -0
- data/lib/moov/models/components/achfees.rbi +25 -0
- data/lib/moov/models/components/billingcountandamount.rb +37 -0
- data/lib/moov/models/components/billingcountandamount.rbi +15 -0
- data/lib/moov/models/components/billinginterchangeprogramfee.rb +53 -0
- data/lib/moov/models/components/billinginterchangeprogramfee.rbi +23 -0
- data/lib/moov/models/components/billingsummary.rb +57 -0
- data/lib/moov/models/components/billingsummary.rbi +25 -0
- data/lib/moov/models/components/billingsummarydetails.rb +41 -0
- data/lib/moov/models/components/billingsummarydetails.rbi +17 -0
- data/lib/moov/models/components/billingsummaryinterchange.rb +45 -0
- data/lib/moov/models/components/billingsummaryinterchange.rbi +19 -0
- data/lib/moov/models/components/cardacquiring.rb +45 -0
- data/lib/moov/models/components/cardacquiring.rbi +19 -0
- data/lib/moov/models/components/cardacquiringfees.rb +45 -0
- data/lib/moov/models/components/cardacquiringfees.rbi +19 -0
- data/lib/moov/models/components/cardbrandfees.rb +69 -0
- data/lib/moov/models/components/cardbrandfees.rbi +31 -0
- data/lib/moov/models/components/instantpaymentfees.rb +61 -0
- data/lib/moov/models/components/instantpaymentfees.rbi +27 -0
- data/lib/moov/models/components/othercardfees.rb +49 -0
- data/lib/moov/models/components/othercardfees.rbi +21 -0
- data/lib/moov/models/components/platformfees.rb +41 -0
- data/lib/moov/models/components/platformfees.rbi +17 -0
- data/lib/moov/models/components/statement.rb +89 -0
- data/lib/moov/models/components/statement.rbi +41 -0
- data/lib/moov/models/components/webhookbillingstatementcreated.rb +33 -0
- data/lib/moov/models/components/webhookbillingstatementcreated.rbi +13 -0
- data/lib/moov/models/components/webhookevent.rb +2 -2
- data/lib/moov/models/components/webhookeventtype.rb +1 -0
- data/lib/moov/models/components.rb +14 -0
- data/lib/moov/models/operations/getstatement_request.rb +49 -0
- data/lib/moov/models/operations/getstatement_request.rbi +17 -0
- data/lib/moov/models/operations/getstatement_response.rb +53 -0
- data/lib/moov/models/operations/getstatement_response.rbi +23 -0
- data/lib/moov/models/operations/liststatements_request.rb +61 -0
- data/lib/moov/models/operations/liststatements_request.rbi +23 -0
- data/lib/moov/models/operations/liststatements_response.rb +49 -0
- data/lib/moov/models/operations/liststatements_response.rbi +21 -0
- data/lib/moov/models/operations.rb +4 -0
- data/lib/moov/sdkconfiguration.rb +3 -3
- data/lib/moov/statements.rb +315 -0
- data/lib/moov_ruby.rb +1 -0
- metadata +39 -2
@@ -0,0 +1,53 @@
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
|
7
|
+
module Moov
|
8
|
+
module Models
|
9
|
+
module Operations
|
10
|
+
|
11
|
+
|
12
|
+
class GetStatementResponse
|
13
|
+
extend T::Sig
|
14
|
+
include Crystalline::MetadataFields
|
15
|
+
|
16
|
+
# HTTP response content type for this operation
|
17
|
+
field :content_type, ::String
|
18
|
+
# HTTP response status code for this operation
|
19
|
+
field :status_code, ::Integer
|
20
|
+
# Raw HTTP response; suitable for custom response parsing
|
21
|
+
field :raw_response, ::Faraday::Response
|
22
|
+
|
23
|
+
field :headers, Crystalline::Hash.new(Symbol, Crystalline::Array.new(::String))
|
24
|
+
# The request has succeeded.
|
25
|
+
field :statement, Crystalline::Nilable.new(Models::Components::Statement)
|
26
|
+
# The request has succeeded.
|
27
|
+
field :bytes, Crystalline::Nilable.new(::String)
|
28
|
+
|
29
|
+
sig { params(content_type: ::String, status_code: ::Integer, raw_response: ::Faraday::Response, headers: T::Hash[Symbol, T::Array[::String]], statement: T.nilable(Models::Components::Statement), bytes: T.nilable(::String)).void }
|
30
|
+
def initialize(content_type:, status_code:, raw_response:, headers:, statement: nil, bytes: nil)
|
31
|
+
@content_type = content_type
|
32
|
+
@status_code = status_code
|
33
|
+
@raw_response = raw_response
|
34
|
+
@headers = headers
|
35
|
+
@statement = statement
|
36
|
+
@bytes = bytes
|
37
|
+
end
|
38
|
+
|
39
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
40
|
+
def ==(other)
|
41
|
+
return false unless other.is_a? self.class
|
42
|
+
return false unless @content_type == other.content_type
|
43
|
+
return false unless @status_code == other.status_code
|
44
|
+
return false unless @raw_response == other.raw_response
|
45
|
+
return false unless @headers == other.headers
|
46
|
+
return false unless @statement == other.statement
|
47
|
+
return false unless @bytes == other.bytes
|
48
|
+
true
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
|
5
|
+
class Moov::Models::Operations::GetStatementResponse
|
6
|
+
extend ::Crystalline::MetadataFields::ClassMethods
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
class Moov::Models::Operations::GetStatementResponse
|
11
|
+
def content_type(); end
|
12
|
+
def content_type=(str_); end
|
13
|
+
def status_code(); end
|
14
|
+
def status_code=(str_); end
|
15
|
+
def raw_response(); end
|
16
|
+
def raw_response=(str_); end
|
17
|
+
def headers(); end
|
18
|
+
def headers=(str_); end
|
19
|
+
def statement(); end
|
20
|
+
def statement=(str_); end
|
21
|
+
def bytes(); end
|
22
|
+
def bytes=(str_); end
|
23
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
|
7
|
+
module Moov
|
8
|
+
module Models
|
9
|
+
module Operations
|
10
|
+
|
11
|
+
|
12
|
+
class ListStatementsRequest
|
13
|
+
extend T::Sig
|
14
|
+
include Crystalline::MetadataFields
|
15
|
+
|
16
|
+
|
17
|
+
field :account_id, ::String, { 'path_param': { 'field_name': 'accountID', 'style': 'simple', 'explode': false } }
|
18
|
+
# Optional date-time which inclusively filters all statements where billing period is on or after this date-time.
|
19
|
+
field :billing_period_start_date_time, Crystalline::Nilable.new(::DateTime), { 'query_param': { 'field_name': 'billingPeriodStartDateTime', 'style': 'form', 'explode': false } }
|
20
|
+
# Optional date-time which exclusively filters all statements where billing period is before this date-time.
|
21
|
+
field :billing_period_end_date_time, Crystalline::Nilable.new(::DateTime), { 'query_param': { 'field_name': 'billingPeriodEndDateTime', 'style': 'form', 'explode': false } }
|
22
|
+
|
23
|
+
field :skip, Crystalline::Nilable.new(::Integer), { 'query_param': { 'field_name': 'skip', 'style': 'form', 'explode': false } }
|
24
|
+
|
25
|
+
field :count, Crystalline::Nilable.new(::Integer), { 'query_param': { 'field_name': 'count', 'style': 'form', 'explode': false } }
|
26
|
+
# Specify an API version.
|
27
|
+
#
|
28
|
+
# API versioning follows the format `vYYYY.QQ.BB`, where
|
29
|
+
# - `YYYY` is the year
|
30
|
+
# - `QQ` is the two-digit month for the first month of the quarter (e.g., 01, 04, 07, 10)
|
31
|
+
# - `BB` is the build number, starting at `.01`, for subsequent builds in the same quarter.
|
32
|
+
# - For example, `v2024.01.00` is the initial release of the first quarter of 2024.
|
33
|
+
#
|
34
|
+
# The `latest` version represents the most recent development state. It may include breaking changes and should be treated as a beta release.
|
35
|
+
field :x_moov_version, Crystalline::Nilable.new(::String), { 'header': { 'field_name': 'x-moov-version', 'style': 'simple', 'explode': false } }
|
36
|
+
|
37
|
+
sig { params(account_id: ::String, billing_period_start_date_time: T.nilable(::DateTime), billing_period_end_date_time: T.nilable(::DateTime), skip: T.nilable(::Integer), count: T.nilable(::Integer), x_moov_version: T.nilable(::String)).void }
|
38
|
+
def initialize(account_id:, billing_period_start_date_time: nil, billing_period_end_date_time: nil, skip: nil, count: nil, x_moov_version: 'v2024.01.00')
|
39
|
+
@account_id = account_id
|
40
|
+
@billing_period_start_date_time = billing_period_start_date_time
|
41
|
+
@billing_period_end_date_time = billing_period_end_date_time
|
42
|
+
@skip = skip
|
43
|
+
@count = count
|
44
|
+
@x_moov_version = x_moov_version
|
45
|
+
end
|
46
|
+
|
47
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
48
|
+
def ==(other)
|
49
|
+
return false unless other.is_a? self.class
|
50
|
+
return false unless @account_id == other.account_id
|
51
|
+
return false unless @billing_period_start_date_time == other.billing_period_start_date_time
|
52
|
+
return false unless @billing_period_end_date_time == other.billing_period_end_date_time
|
53
|
+
return false unless @skip == other.skip
|
54
|
+
return false unless @count == other.count
|
55
|
+
return false unless @x_moov_version == other.x_moov_version
|
56
|
+
true
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
|
5
|
+
class Moov::Models::Operations::ListStatementsRequest
|
6
|
+
extend ::Crystalline::MetadataFields::ClassMethods
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
class Moov::Models::Operations::ListStatementsRequest
|
11
|
+
def account_id(); end
|
12
|
+
def account_id=(str_); end
|
13
|
+
def billing_period_start_date_time(); end
|
14
|
+
def billing_period_start_date_time=(str_); end
|
15
|
+
def billing_period_end_date_time(); end
|
16
|
+
def billing_period_end_date_time=(str_); end
|
17
|
+
def skip(); end
|
18
|
+
def skip=(str_); end
|
19
|
+
def count(); end
|
20
|
+
def count=(str_); end
|
21
|
+
def x_moov_version(); end
|
22
|
+
def x_moov_version=(str_); end
|
23
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
|
7
|
+
module Moov
|
8
|
+
module Models
|
9
|
+
module Operations
|
10
|
+
|
11
|
+
|
12
|
+
class ListStatementsResponse
|
13
|
+
extend T::Sig
|
14
|
+
include Crystalline::MetadataFields
|
15
|
+
|
16
|
+
# HTTP response content type for this operation
|
17
|
+
field :content_type, ::String
|
18
|
+
# HTTP response status code for this operation
|
19
|
+
field :status_code, ::Integer
|
20
|
+
# Raw HTTP response; suitable for custom response parsing
|
21
|
+
field :raw_response, ::Faraday::Response
|
22
|
+
|
23
|
+
field :headers, Crystalline::Hash.new(Symbol, Crystalline::Array.new(::String))
|
24
|
+
# The request completed successfully.
|
25
|
+
field :statements, Crystalline::Nilable.new(Crystalline::Array.new(Models::Components::Statement))
|
26
|
+
|
27
|
+
sig { params(content_type: ::String, status_code: ::Integer, raw_response: ::Faraday::Response, headers: T::Hash[Symbol, T::Array[::String]], statements: T.nilable(T::Array[Models::Components::Statement])).void }
|
28
|
+
def initialize(content_type:, status_code:, raw_response:, headers:, statements: nil)
|
29
|
+
@content_type = content_type
|
30
|
+
@status_code = status_code
|
31
|
+
@raw_response = raw_response
|
32
|
+
@headers = headers
|
33
|
+
@statements = statements
|
34
|
+
end
|
35
|
+
|
36
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
37
|
+
def ==(other)
|
38
|
+
return false unless other.is_a? self.class
|
39
|
+
return false unless @content_type == other.content_type
|
40
|
+
return false unless @status_code == other.status_code
|
41
|
+
return false unless @raw_response == other.raw_response
|
42
|
+
return false unless @headers == other.headers
|
43
|
+
return false unless @statements == other.statements
|
44
|
+
true
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
|
5
|
+
class Moov::Models::Operations::ListStatementsResponse
|
6
|
+
extend ::Crystalline::MetadataFields::ClassMethods
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
class Moov::Models::Operations::ListStatementsResponse
|
11
|
+
def content_type(); end
|
12
|
+
def content_type=(str_); end
|
13
|
+
def status_code(); end
|
14
|
+
def status_code=(str_); end
|
15
|
+
def raw_response(); end
|
16
|
+
def raw_response=(str_); end
|
17
|
+
def headers(); end
|
18
|
+
def headers=(str_); end
|
19
|
+
def statements(); end
|
20
|
+
def statements=(str_); end
|
21
|
+
end
|
@@ -134,6 +134,8 @@ module Moov
|
|
134
134
|
autoload :GetScheduledOccurrenceResponse, 'moov/models/operations/getscheduledoccurrence_response.rb'
|
135
135
|
autoload :GetSchedulesRequest, 'moov/models/operations/getschedules_request.rb'
|
136
136
|
autoload :GetSchedulesResponse, 'moov/models/operations/getschedules_response.rb'
|
137
|
+
autoload :GetStatementRequest, 'moov/models/operations/getstatement_request.rb'
|
138
|
+
autoload :GetStatementResponse, 'moov/models/operations/getstatement_response.rb'
|
137
139
|
autoload :GetSweepConfigRequest, 'moov/models/operations/getsweepconfig_request.rb'
|
138
140
|
autoload :GetSweepConfigResponse, 'moov/models/operations/getsweepconfig_response.rb'
|
139
141
|
autoload :GetSweepRequest, 'moov/models/operations/getsweep_request.rb'
|
@@ -223,6 +225,8 @@ module Moov
|
|
223
225
|
autoload :ListRepresentativesResponse, 'moov/models/operations/listrepresentatives_response.rb'
|
224
226
|
autoload :ListSchedulesRequest, 'moov/models/operations/listschedules_request.rb'
|
225
227
|
autoload :ListSchedulesResponse, 'moov/models/operations/listschedules_response.rb'
|
228
|
+
autoload :ListStatementsRequest, 'moov/models/operations/liststatements_request.rb'
|
229
|
+
autoload :ListStatementsResponse, 'moov/models/operations/liststatements_response.rb'
|
226
230
|
autoload :ListSweepConfigsRequest, 'moov/models/operations/listsweepconfigs_request.rb'
|
227
231
|
autoload :ListSweepConfigsResponse, 'moov/models/operations/listsweepconfigs_response.rb'
|
228
232
|
autoload :ListSweepsRequest, 'moov/models/operations/listsweeps_request.rb'
|
@@ -95,9 +95,9 @@ module Moov
|
|
95
95
|
@globals = globals.nil? ? {} : globals
|
96
96
|
@language = 'ruby'
|
97
97
|
@openapi_doc_version = 'latest'
|
98
|
-
@sdk_version = '0.1.
|
99
|
-
@gen_version = '2.
|
100
|
-
@user_agent = 'speakeasy-sdk/ruby 0.1.
|
98
|
+
@sdk_version = '0.1.19'
|
99
|
+
@gen_version = '2.709.0'
|
100
|
+
@user_agent = 'speakeasy-sdk/ruby 0.1.19 2.709.0 latest moov_ruby'
|
101
101
|
end
|
102
102
|
|
103
103
|
sig { returns([String, T::Hash[Symbol, String]]) }
|
@@ -0,0 +1,315 @@
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
require 'faraday'
|
7
|
+
require 'faraday/multipart'
|
8
|
+
require 'faraday/retry'
|
9
|
+
require 'sorbet-runtime'
|
10
|
+
require_relative 'sdk_hooks/hooks'
|
11
|
+
require_relative 'utils/retries'
|
12
|
+
|
13
|
+
module Moov
|
14
|
+
extend T::Sig
|
15
|
+
class Statements
|
16
|
+
extend T::Sig
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
sig { params(sdk_config: SDKConfiguration).void }
|
21
|
+
def initialize(sdk_config)
|
22
|
+
@sdk_configuration = sdk_config
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
sig { params(base_url: String, url_variables: T.nilable(T::Hash[Symbol, T.any(String, T::Enum)])).returns(String) }
|
27
|
+
def get_url(base_url:, url_variables: nil)
|
28
|
+
sd_base_url, sd_options = @sdk_configuration.get_server_details
|
29
|
+
|
30
|
+
if base_url.nil?
|
31
|
+
base_url = sd_base_url
|
32
|
+
end
|
33
|
+
|
34
|
+
if url_variables.nil?
|
35
|
+
url_variables = sd_options
|
36
|
+
end
|
37
|
+
|
38
|
+
return Utils.template_url base_url, url_variables
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
sig { params(request: Models::Operations::ListStatementsRequest, timeout_ms: T.nilable(Integer)).returns(Models::Operations::ListStatementsResponse) }
|
43
|
+
def list(request:, timeout_ms: nil)
|
44
|
+
# list - Retrieve all statements associated with an account.
|
45
|
+
#
|
46
|
+
# To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
47
|
+
# you'll need to specify the `/accounts/{accountID}/profile.read` scope.
|
48
|
+
url, params = @sdk_configuration.get_server_details
|
49
|
+
base_url = Utils.template_url(url, params)
|
50
|
+
url = Utils.generate_url(
|
51
|
+
Models::Operations::ListStatementsRequest,
|
52
|
+
base_url,
|
53
|
+
'/accounts/{accountID}/statements',
|
54
|
+
request,
|
55
|
+
@sdk_configuration.globals
|
56
|
+
)
|
57
|
+
headers = Utils.get_headers(request, @sdk_configuration.globals)
|
58
|
+
headers = T.cast(headers, T::Hash[String, String])
|
59
|
+
query_params = Utils.get_query_params(Models::Operations::ListStatementsRequest, request, nil, @sdk_configuration.globals)
|
60
|
+
headers['Accept'] = 'application/json'
|
61
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
62
|
+
|
63
|
+
security = @sdk_configuration.security_source&.call
|
64
|
+
|
65
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
66
|
+
timeout ||= @sdk_configuration.timeout
|
67
|
+
|
68
|
+
|
69
|
+
connection = @sdk_configuration.client
|
70
|
+
|
71
|
+
hook_ctx = SDKHooks::HookContext.new(
|
72
|
+
config: @sdk_configuration,
|
73
|
+
base_url: base_url,
|
74
|
+
oauth2_scopes: [],
|
75
|
+
operation_id: 'listStatements',
|
76
|
+
security_source: @sdk_configuration.security_source
|
77
|
+
)
|
78
|
+
|
79
|
+
error = T.let(nil, T.nilable(StandardError))
|
80
|
+
http_response = T.let(nil, T.nilable(Faraday::Response))
|
81
|
+
|
82
|
+
|
83
|
+
begin
|
84
|
+
http_response = T.must(connection).get(url) do |req|
|
85
|
+
req.headers.merge!(headers)
|
86
|
+
req.options.timeout = timeout unless timeout.nil?
|
87
|
+
req.params = query_params
|
88
|
+
Utils.configure_request_security(req, security)
|
89
|
+
|
90
|
+
@sdk_configuration.hooks.before_request(
|
91
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
92
|
+
hook_ctx: hook_ctx
|
93
|
+
),
|
94
|
+
request: req
|
95
|
+
)
|
96
|
+
end
|
97
|
+
rescue StandardError => e
|
98
|
+
error = e
|
99
|
+
ensure
|
100
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
101
|
+
http_response = @sdk_configuration.hooks.after_error(
|
102
|
+
error: error,
|
103
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
104
|
+
hook_ctx: hook_ctx
|
105
|
+
),
|
106
|
+
response: http_response
|
107
|
+
)
|
108
|
+
else
|
109
|
+
http_response = @sdk_configuration.hooks.after_success(
|
110
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
111
|
+
hook_ctx: hook_ctx
|
112
|
+
),
|
113
|
+
response: http_response
|
114
|
+
)
|
115
|
+
end
|
116
|
+
|
117
|
+
if http_response.nil?
|
118
|
+
raise error if !error.nil?
|
119
|
+
raise 'no response'
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
124
|
+
if Utils.match_status_code(http_response.status, ['200'])
|
125
|
+
if Utils.match_content_type(content_type, 'application/json')
|
126
|
+
http_response = @sdk_configuration.hooks.after_success(
|
127
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
128
|
+
hook_ctx: hook_ctx
|
129
|
+
),
|
130
|
+
response: http_response
|
131
|
+
)
|
132
|
+
response_data = http_response.env.response_body
|
133
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Crystalline::Array.new(Models::Components::Statement))
|
134
|
+
response = Models::Operations::ListStatementsResponse.new(
|
135
|
+
status_code: http_response.status,
|
136
|
+
content_type: content_type,
|
137
|
+
raw_response: http_response,
|
138
|
+
headers: http_response.headers,
|
139
|
+
statements: T.unsafe(obj)
|
140
|
+
)
|
141
|
+
|
142
|
+
return response
|
143
|
+
else
|
144
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
145
|
+
end
|
146
|
+
elsif Utils.match_status_code(http_response.status, ['400'])
|
147
|
+
if Utils.match_content_type(content_type, 'application/json')
|
148
|
+
http_response = @sdk_configuration.hooks.after_success(
|
149
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
150
|
+
hook_ctx: hook_ctx
|
151
|
+
),
|
152
|
+
response: http_response
|
153
|
+
)
|
154
|
+
response_data = http_response.env.response_body
|
155
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::GenericError)
|
156
|
+
obj.raw_response = http_response
|
157
|
+
raise obj
|
158
|
+
else
|
159
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
160
|
+
end
|
161
|
+
elsif Utils.match_status_code(http_response.status, ['401', '403', '429'])
|
162
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
163
|
+
elsif Utils.match_status_code(http_response.status, ['500', '504'])
|
164
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
165
|
+
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
166
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
167
|
+
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
168
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
169
|
+
else
|
170
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
|
171
|
+
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
|
176
|
+
sig { params(account_id: ::String, statement_id: ::String, x_moov_version: T.nilable(::String), timeout_ms: T.nilable(Integer)).returns(Models::Operations::GetStatementResponse) }
|
177
|
+
def get(account_id:, statement_id:, x_moov_version: nil, timeout_ms: nil)
|
178
|
+
# get - Retrieve a statement by its ID.
|
179
|
+
#
|
180
|
+
# Use the `Accept` header to specify the format of the response. Supported formats are `application/json` and `application/pdf`.
|
181
|
+
#
|
182
|
+
# To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
183
|
+
# you'll need to specify the `/accounts/{accountID}/profile.read` scope.
|
184
|
+
request = Models::Operations::GetStatementRequest.new(
|
185
|
+
account_id: account_id,
|
186
|
+
statement_id: statement_id,
|
187
|
+
x_moov_version: x_moov_version
|
188
|
+
)
|
189
|
+
url, params = @sdk_configuration.get_server_details
|
190
|
+
base_url = Utils.template_url(url, params)
|
191
|
+
url = Utils.generate_url(
|
192
|
+
Models::Operations::GetStatementRequest,
|
193
|
+
base_url,
|
194
|
+
'/accounts/{accountID}/statements/{statementID}',
|
195
|
+
request,
|
196
|
+
@sdk_configuration.globals
|
197
|
+
)
|
198
|
+
headers = Utils.get_headers(request, @sdk_configuration.globals)
|
199
|
+
headers = T.cast(headers, T::Hash[String, String])
|
200
|
+
headers['Accept'] = 'application/json;q=1, application/pdf;q=0'
|
201
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
202
|
+
|
203
|
+
security = @sdk_configuration.security_source&.call
|
204
|
+
|
205
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
206
|
+
timeout ||= @sdk_configuration.timeout
|
207
|
+
|
208
|
+
|
209
|
+
connection = @sdk_configuration.client
|
210
|
+
|
211
|
+
hook_ctx = SDKHooks::HookContext.new(
|
212
|
+
config: @sdk_configuration,
|
213
|
+
base_url: base_url,
|
214
|
+
oauth2_scopes: [],
|
215
|
+
operation_id: 'getStatement',
|
216
|
+
security_source: @sdk_configuration.security_source
|
217
|
+
)
|
218
|
+
|
219
|
+
error = T.let(nil, T.nilable(StandardError))
|
220
|
+
http_response = T.let(nil, T.nilable(Faraday::Response))
|
221
|
+
|
222
|
+
|
223
|
+
begin
|
224
|
+
http_response = T.must(connection).get(url) do |req|
|
225
|
+
req.headers.merge!(headers)
|
226
|
+
req.options.timeout = timeout unless timeout.nil?
|
227
|
+
Utils.configure_request_security(req, security)
|
228
|
+
|
229
|
+
@sdk_configuration.hooks.before_request(
|
230
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
231
|
+
hook_ctx: hook_ctx
|
232
|
+
),
|
233
|
+
request: req
|
234
|
+
)
|
235
|
+
end
|
236
|
+
rescue StandardError => e
|
237
|
+
error = e
|
238
|
+
ensure
|
239
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
240
|
+
http_response = @sdk_configuration.hooks.after_error(
|
241
|
+
error: error,
|
242
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
243
|
+
hook_ctx: hook_ctx
|
244
|
+
),
|
245
|
+
response: http_response
|
246
|
+
)
|
247
|
+
else
|
248
|
+
http_response = @sdk_configuration.hooks.after_success(
|
249
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
250
|
+
hook_ctx: hook_ctx
|
251
|
+
),
|
252
|
+
response: http_response
|
253
|
+
)
|
254
|
+
end
|
255
|
+
|
256
|
+
if http_response.nil?
|
257
|
+
raise error if !error.nil?
|
258
|
+
raise 'no response'
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
263
|
+
if Utils.match_status_code(http_response.status, ['200'])
|
264
|
+
if Utils.match_content_type(content_type, 'application/json')
|
265
|
+
http_response = @sdk_configuration.hooks.after_success(
|
266
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
267
|
+
hook_ctx: hook_ctx
|
268
|
+
),
|
269
|
+
response: http_response
|
270
|
+
)
|
271
|
+
response_data = http_response.env.response_body
|
272
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::Statement)
|
273
|
+
response = Models::Operations::GetStatementResponse.new(
|
274
|
+
status_code: http_response.status,
|
275
|
+
content_type: content_type,
|
276
|
+
raw_response: http_response,
|
277
|
+
headers: http_response.headers,
|
278
|
+
statement: T.unsafe(obj)
|
279
|
+
)
|
280
|
+
|
281
|
+
return response
|
282
|
+
elsif Utils.match_content_type(content_type, 'application/pdf')
|
283
|
+
http_response = @sdk_configuration.hooks.after_success(
|
284
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
285
|
+
hook_ctx: hook_ctx
|
286
|
+
),
|
287
|
+
response: http_response
|
288
|
+
)
|
289
|
+
obj = http_response.env.body
|
290
|
+
|
291
|
+
return Models::Operations::GetStatementResponse.new(
|
292
|
+
status_code: http_response.status,
|
293
|
+
content_type: content_type,
|
294
|
+
raw_response: http_response,
|
295
|
+
headers: http_response.headers,
|
296
|
+
bytes: T.unsafe(obj)
|
297
|
+
)
|
298
|
+
else
|
299
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
300
|
+
end
|
301
|
+
elsif Utils.match_status_code(http_response.status, ['401', '403', '404', '429'])
|
302
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
303
|
+
elsif Utils.match_status_code(http_response.status, ['500', '504'])
|
304
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
305
|
+
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
306
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
307
|
+
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
308
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
309
|
+
else
|
310
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
|
311
|
+
|
312
|
+
end
|
313
|
+
end
|
314
|
+
end
|
315
|
+
end
|
data/lib/moov_ruby.rb
CHANGED
@@ -19,6 +19,7 @@ module Moov
|
|
19
19
|
autoload :PaymentMethods, 'moov/payment_methods'
|
20
20
|
autoload :Representatives, 'moov/representatives'
|
21
21
|
autoload :Scheduling, 'moov/scheduling'
|
22
|
+
autoload :Statements, 'moov/statements'
|
22
23
|
autoload :Sweeps, 'moov/sweeps'
|
23
24
|
autoload :AccountTerminalApplications, 'moov/account_terminal_applications'
|
24
25
|
autoload :Support, 'moov/support'
|