method-ruby 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.
Files changed (125) hide show
  1. checksums.yaml +7 -0
  2. data/.ignore +2 -0
  3. data/CHANGELOG.md +11 -0
  4. data/README.md +244 -0
  5. data/SECURITY.md +27 -0
  6. data/lib/method_ruby/client.rb +114 -0
  7. data/lib/method_ruby/errors.rb +228 -0
  8. data/lib/method_ruby/file_part.rb +58 -0
  9. data/lib/method_ruby/internal/transport/base_client.rb +595 -0
  10. data/lib/method_ruby/internal/transport/pooled_net_requester.rb +210 -0
  11. data/lib/method_ruby/internal/type/array_of.rb +168 -0
  12. data/lib/method_ruby/internal/type/base_model.rb +531 -0
  13. data/lib/method_ruby/internal/type/base_page.rb +55 -0
  14. data/lib/method_ruby/internal/type/boolean.rb +77 -0
  15. data/lib/method_ruby/internal/type/converter.rb +327 -0
  16. data/lib/method_ruby/internal/type/enum.rb +131 -0
  17. data/lib/method_ruby/internal/type/file_input.rb +111 -0
  18. data/lib/method_ruby/internal/type/hash_of.rb +188 -0
  19. data/lib/method_ruby/internal/type/request_parameters.rb +42 -0
  20. data/lib/method_ruby/internal/type/union.rb +237 -0
  21. data/lib/method_ruby/internal/type/unknown.rb +81 -0
  22. data/lib/method_ruby/internal/util.rb +951 -0
  23. data/lib/method_ruby/internal.rb +20 -0
  24. data/lib/method_ruby/models/address.rb +45 -0
  25. data/lib/method_ruby/models/entity.rb +102 -0
  26. data/lib/method_ruby/models/entity_corporation.rb +33 -0
  27. data/lib/method_ruby/models/entity_corporation_owner.rb +45 -0
  28. data/lib/method_ruby/models/entity_create_params.rb +188 -0
  29. data/lib/method_ruby/models/entity_create_response.rb +32 -0
  30. data/lib/method_ruby/models/entity_individual.rb +39 -0
  31. data/lib/method_ruby/models/entity_list_params.rb +61 -0
  32. data/lib/method_ruby/models/entity_list_response.rb +32 -0
  33. data/lib/method_ruby/models/entity_retrieve_params.rb +37 -0
  34. data/lib/method_ruby/models/entity_retrieve_response.rb +32 -0
  35. data/lib/method_ruby/models/entity_update_params.rb +75 -0
  36. data/lib/method_ruby/models/entity_update_response.rb +32 -0
  37. data/lib/method_ruby/models/ping_check_params.rb +14 -0
  38. data/lib/method_ruby/models/ping_check_response.rb +49 -0
  39. data/lib/method_ruby/models/resource_error.rb +33 -0
  40. data/lib/method_ruby/models.rb +63 -0
  41. data/lib/method_ruby/request_options.rb +77 -0
  42. data/lib/method_ruby/resources/entities.rb +141 -0
  43. data/lib/method_ruby/resources/ping.rb +34 -0
  44. data/lib/method_ruby/version.rb +5 -0
  45. data/lib/method_ruby.rb +73 -0
  46. data/manifest.yaml +17 -0
  47. data/rbi/method_ruby/client.rbi +85 -0
  48. data/rbi/method_ruby/errors.rbi +205 -0
  49. data/rbi/method_ruby/file_part.rbi +37 -0
  50. data/rbi/method_ruby/internal/transport/base_client.rbi +303 -0
  51. data/rbi/method_ruby/internal/transport/pooled_net_requester.rbi +84 -0
  52. data/rbi/method_ruby/internal/type/array_of.rbi +104 -0
  53. data/rbi/method_ruby/internal/type/base_model.rbi +308 -0
  54. data/rbi/method_ruby/internal/type/base_page.rbi +42 -0
  55. data/rbi/method_ruby/internal/type/boolean.rbi +58 -0
  56. data/rbi/method_ruby/internal/type/converter.rbi +216 -0
  57. data/rbi/method_ruby/internal/type/enum.rbi +82 -0
  58. data/rbi/method_ruby/internal/type/file_input.rbi +59 -0
  59. data/rbi/method_ruby/internal/type/hash_of.rbi +104 -0
  60. data/rbi/method_ruby/internal/type/request_parameters.rbi +29 -0
  61. data/rbi/method_ruby/internal/type/union.rbi +128 -0
  62. data/rbi/method_ruby/internal/type/unknown.rbi +58 -0
  63. data/rbi/method_ruby/internal/util.rbi +507 -0
  64. data/rbi/method_ruby/internal.rbi +18 -0
  65. data/rbi/method_ruby/models/address.rbi +63 -0
  66. data/rbi/method_ruby/models/entity.rbi +151 -0
  67. data/rbi/method_ruby/models/entity_corporation.rbi +61 -0
  68. data/rbi/method_ruby/models/entity_corporation_owner.rbi +86 -0
  69. data/rbi/method_ruby/models/entity_create_params.rbi +408 -0
  70. data/rbi/method_ruby/models/entity_create_response.rbi +84 -0
  71. data/rbi/method_ruby/models/entity_individual.rbi +65 -0
  72. data/rbi/method_ruby/models/entity_list_params.rbi +132 -0
  73. data/rbi/method_ruby/models/entity_list_response.rbi +84 -0
  74. data/rbi/method_ruby/models/entity_retrieve_params.rbi +93 -0
  75. data/rbi/method_ruby/models/entity_retrieve_response.rbi +89 -0
  76. data/rbi/method_ruby/models/entity_update_params.rbi +141 -0
  77. data/rbi/method_ruby/models/entity_update_response.rbi +84 -0
  78. data/rbi/method_ruby/models/ping_check_params.rbi +27 -0
  79. data/rbi/method_ruby/models/ping_check_response.rbi +118 -0
  80. data/rbi/method_ruby/models/resource_error.rbi +55 -0
  81. data/rbi/method_ruby/models.rbi +25 -0
  82. data/rbi/method_ruby/request_options.rbi +59 -0
  83. data/rbi/method_ruby/resources/entities.rbi +119 -0
  84. data/rbi/method_ruby/resources/ping.rbi +22 -0
  85. data/rbi/method_ruby/version.rbi +5 -0
  86. data/sig/method_ruby/client.rbs +39 -0
  87. data/sig/method_ruby/errors.rbs +117 -0
  88. data/sig/method_ruby/file_part.rbs +21 -0
  89. data/sig/method_ruby/internal/transport/base_client.rbs +135 -0
  90. data/sig/method_ruby/internal/transport/pooled_net_requester.rbs +48 -0
  91. data/sig/method_ruby/internal/type/array_of.rbs +48 -0
  92. data/sig/method_ruby/internal/type/base_model.rbs +102 -0
  93. data/sig/method_ruby/internal/type/base_page.rbs +24 -0
  94. data/sig/method_ruby/internal/type/boolean.rbs +26 -0
  95. data/sig/method_ruby/internal/type/converter.rbs +79 -0
  96. data/sig/method_ruby/internal/type/enum.rbs +32 -0
  97. data/sig/method_ruby/internal/type/file_input.rbs +25 -0
  98. data/sig/method_ruby/internal/type/hash_of.rbs +48 -0
  99. data/sig/method_ruby/internal/type/request_parameters.rbs +19 -0
  100. data/sig/method_ruby/internal/type/union.rbs +52 -0
  101. data/sig/method_ruby/internal/type/unknown.rbs +26 -0
  102. data/sig/method_ruby/internal/util.rbs +195 -0
  103. data/sig/method_ruby/internal.rbs +9 -0
  104. data/sig/method_ruby/models/address.rbs +40 -0
  105. data/sig/method_ruby/models/entity.rbs +94 -0
  106. data/sig/method_ruby/models/entity_corporation.rbs +43 -0
  107. data/sig/method_ruby/models/entity_corporation_owner.rbs +57 -0
  108. data/sig/method_ruby/models/entity_create_params.rbs +215 -0
  109. data/sig/method_ruby/models/entity_create_response.rbs +41 -0
  110. data/sig/method_ruby/models/entity_individual.rbs +44 -0
  111. data/sig/method_ruby/models/entity_list_params.rbs +77 -0
  112. data/sig/method_ruby/models/entity_list_response.rbs +41 -0
  113. data/sig/method_ruby/models/entity_retrieve_params.rbs +47 -0
  114. data/sig/method_ruby/models/entity_retrieve_response.rbs +41 -0
  115. data/sig/method_ruby/models/entity_update_params.rbs +84 -0
  116. data/sig/method_ruby/models/entity_update_response.rbs +41 -0
  117. data/sig/method_ruby/models/ping_check_params.rbs +15 -0
  118. data/sig/method_ruby/models/ping_check_response.rbs +59 -0
  119. data/sig/method_ruby/models/resource_error.rbs +38 -0
  120. data/sig/method_ruby/models.rbs +23 -0
  121. data/sig/method_ruby/request_options.rbs +36 -0
  122. data/sig/method_ruby/resources/entities.rbs +41 -0
  123. data/sig/method_ruby/resources/ping.rbs +11 -0
  124. data/sig/method_ruby/version.rbs +3 -0
  125. metadata +196 -0
@@ -0,0 +1,84 @@
1
+ # typed: strong
2
+
3
+ module MethodRuby
4
+ module Models
5
+ class EntityUpdateResponse < MethodRuby::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ MethodRuby::Models::EntityUpdateResponse,
10
+ MethodRuby::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ sig { returns(T.nilable(MethodRuby::Entity)) }
15
+ attr_reader :data
16
+
17
+ sig { params(data: MethodRuby::Entity::OrHash).void }
18
+ attr_writer :data
19
+
20
+ sig do
21
+ returns(
22
+ T.nilable(
23
+ MethodRuby::Models::EntityUpdateResponse::Success::TaggedBoolean
24
+ )
25
+ )
26
+ end
27
+ attr_reader :success
28
+
29
+ sig do
30
+ params(
31
+ success: MethodRuby::Models::EntityUpdateResponse::Success::OrBoolean
32
+ ).void
33
+ end
34
+ attr_writer :success
35
+
36
+ sig do
37
+ params(
38
+ data: MethodRuby::Entity::OrHash,
39
+ success: MethodRuby::Models::EntityUpdateResponse::Success::OrBoolean
40
+ ).returns(T.attached_class)
41
+ end
42
+ def self.new(data: nil, success: nil)
43
+ end
44
+
45
+ sig do
46
+ override.returns(
47
+ {
48
+ data: MethodRuby::Entity,
49
+ success:
50
+ MethodRuby::Models::EntityUpdateResponse::Success::TaggedBoolean
51
+ }
52
+ )
53
+ end
54
+ def to_hash
55
+ end
56
+
57
+ module Success
58
+ extend MethodRuby::Internal::Type::Enum
59
+
60
+ TaggedBoolean =
61
+ T.type_alias do
62
+ T.all(T::Boolean, MethodRuby::Models::EntityUpdateResponse::Success)
63
+ end
64
+ OrBoolean = T.type_alias { T::Boolean }
65
+
66
+ TRUE =
67
+ T.let(
68
+ true,
69
+ MethodRuby::Models::EntityUpdateResponse::Success::TaggedBoolean
70
+ )
71
+
72
+ sig do
73
+ override.returns(
74
+ T::Array[
75
+ MethodRuby::Models::EntityUpdateResponse::Success::TaggedBoolean
76
+ ]
77
+ )
78
+ end
79
+ def self.values
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,27 @@
1
+ # typed: strong
2
+
3
+ module MethodRuby
4
+ module Models
5
+ class PingCheckParams < MethodRuby::Internal::Type::BaseModel
6
+ extend MethodRuby::Internal::Type::RequestParameters::Converter
7
+ include MethodRuby::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(MethodRuby::PingCheckParams, MethodRuby::Internal::AnyHash)
12
+ end
13
+
14
+ sig do
15
+ params(request_options: MethodRuby::RequestOptions::OrHash).returns(
16
+ T.attached_class
17
+ )
18
+ end
19
+ def self.new(request_options: {})
20
+ end
21
+
22
+ sig { override.returns({ request_options: MethodRuby::RequestOptions }) }
23
+ def to_hash
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,118 @@
1
+ # typed: strong
2
+
3
+ module MethodRuby
4
+ module Models
5
+ class PingCheckResponse < MethodRuby::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ MethodRuby::Models::PingCheckResponse,
10
+ MethodRuby::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ sig { returns(T.nilable(MethodRuby::Models::PingCheckResponse::Data)) }
15
+ attr_reader :data
16
+
17
+ sig do
18
+ params(data: MethodRuby::Models::PingCheckResponse::Data::OrHash).void
19
+ end
20
+ attr_writer :data
21
+
22
+ sig do
23
+ returns(
24
+ T.nilable(
25
+ MethodRuby::Models::PingCheckResponse::Success::TaggedBoolean
26
+ )
27
+ )
28
+ end
29
+ attr_reader :success
30
+
31
+ sig do
32
+ params(
33
+ success: MethodRuby::Models::PingCheckResponse::Success::OrBoolean
34
+ ).void
35
+ end
36
+ attr_writer :success
37
+
38
+ sig do
39
+ params(
40
+ data: MethodRuby::Models::PingCheckResponse::Data::OrHash,
41
+ success: MethodRuby::Models::PingCheckResponse::Success::OrBoolean
42
+ ).returns(T.attached_class)
43
+ end
44
+ def self.new(data: nil, success: nil)
45
+ end
46
+
47
+ sig do
48
+ override.returns(
49
+ {
50
+ data: MethodRuby::Models::PingCheckResponse::Data,
51
+ success:
52
+ MethodRuby::Models::PingCheckResponse::Success::TaggedBoolean
53
+ }
54
+ )
55
+ end
56
+ def to_hash
57
+ end
58
+
59
+ class Data < MethodRuby::Internal::Type::BaseModel
60
+ OrHash =
61
+ T.type_alias do
62
+ T.any(
63
+ MethodRuby::Models::PingCheckResponse::Data,
64
+ MethodRuby::Internal::AnyHash
65
+ )
66
+ end
67
+
68
+ sig { returns(T.nilable(String)) }
69
+ attr_reader :status
70
+
71
+ sig { params(status: String).void }
72
+ attr_writer :status
73
+
74
+ sig { returns(T.nilable(String)) }
75
+ attr_reader :version
76
+
77
+ sig { params(version: String).void }
78
+ attr_writer :version
79
+
80
+ sig do
81
+ params(status: String, version: String).returns(T.attached_class)
82
+ end
83
+ def self.new(status: nil, version: nil)
84
+ end
85
+
86
+ sig { override.returns({ status: String, version: String }) }
87
+ def to_hash
88
+ end
89
+ end
90
+
91
+ module Success
92
+ extend MethodRuby::Internal::Type::Enum
93
+
94
+ TaggedBoolean =
95
+ T.type_alias do
96
+ T.all(T::Boolean, MethodRuby::Models::PingCheckResponse::Success)
97
+ end
98
+ OrBoolean = T.type_alias { T::Boolean }
99
+
100
+ TRUE =
101
+ T.let(
102
+ true,
103
+ MethodRuby::Models::PingCheckResponse::Success::TaggedBoolean
104
+ )
105
+
106
+ sig do
107
+ override.returns(
108
+ T::Array[
109
+ MethodRuby::Models::PingCheckResponse::Success::TaggedBoolean
110
+ ]
111
+ )
112
+ end
113
+ def self.values
114
+ end
115
+ end
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,55 @@
1
+ # typed: strong
2
+
3
+ module MethodRuby
4
+ module Models
5
+ class ResourceError < MethodRuby::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(MethodRuby::ResourceError, MethodRuby::Internal::AnyHash)
9
+ end
10
+
11
+ sig { returns(T.nilable(Integer)) }
12
+ attr_reader :code
13
+
14
+ sig { params(code: Integer).void }
15
+ attr_writer :code
16
+
17
+ sig { returns(T.nilable(String)) }
18
+ attr_reader :message
19
+
20
+ sig { params(message: String).void }
21
+ attr_writer :message
22
+
23
+ sig { returns(T.nilable(String)) }
24
+ attr_reader :sub_type
25
+
26
+ sig { params(sub_type: String).void }
27
+ attr_writer :sub_type
28
+
29
+ sig { returns(T.nilable(String)) }
30
+ attr_reader :type
31
+
32
+ sig { params(type: String).void }
33
+ attr_writer :type
34
+
35
+ sig do
36
+ params(
37
+ code: Integer,
38
+ message: String,
39
+ sub_type: String,
40
+ type: String
41
+ ).returns(T.attached_class)
42
+ end
43
+ def self.new(code: nil, message: nil, sub_type: nil, type: nil)
44
+ end
45
+
46
+ sig do
47
+ override.returns(
48
+ { code: Integer, message: String, sub_type: String, type: String }
49
+ )
50
+ end
51
+ def to_hash
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,25 @@
1
+ # typed: strong
2
+
3
+ module MethodRuby
4
+ Address = MethodRuby::Models::Address
5
+
6
+ Entity = MethodRuby::Models::Entity
7
+
8
+ EntityCorporation = MethodRuby::Models::EntityCorporation
9
+
10
+ EntityCorporationOwner = MethodRuby::Models::EntityCorporationOwner
11
+
12
+ EntityCreateParams = MethodRuby::Models::EntityCreateParams
13
+
14
+ EntityIndividual = MethodRuby::Models::EntityIndividual
15
+
16
+ EntityListParams = MethodRuby::Models::EntityListParams
17
+
18
+ EntityRetrieveParams = MethodRuby::Models::EntityRetrieveParams
19
+
20
+ EntityUpdateParams = MethodRuby::Models::EntityUpdateParams
21
+
22
+ PingCheckParams = MethodRuby::Models::PingCheckParams
23
+
24
+ ResourceError = MethodRuby::Models::ResourceError
25
+ end
@@ -0,0 +1,59 @@
1
+ # typed: strong
2
+
3
+ module MethodRuby
4
+ # Specify HTTP behaviour to use for a specific request. These options supplement
5
+ # or override those provided at the client level.
6
+ #
7
+ # When making a request, you can pass an actual {RequestOptions} instance, or
8
+ # simply pass a Hash with symbol keys matching the attributes on this class.
9
+ class RequestOptions < MethodRuby::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(MethodRuby::RequestOptions, MethodRuby::Internal::AnyHash)
13
+ end
14
+
15
+ # @api private
16
+ sig { params(opts: MethodRuby::RequestOptions::OrHash).void }
17
+ def self.validate!(opts)
18
+ end
19
+
20
+ # Idempotency key to send with request and all associated retries. Will only be
21
+ # sent for write requests.
22
+ sig { returns(T.nilable(String)) }
23
+ attr_accessor :idempotency_key
24
+
25
+ # Extra query params to send with the request. These are `.merge`’d into any
26
+ # `query` given at the client level.
27
+ sig do
28
+ returns(
29
+ T.nilable(T::Hash[String, T.nilable(T.any(T::Array[String], String))])
30
+ )
31
+ end
32
+ attr_accessor :extra_query
33
+
34
+ # Extra headers to send with the request. These are `.merged`’d into any
35
+ # `extra_headers` given at the client level.
36
+ sig { returns(T.nilable(T::Hash[String, T.nilable(String)])) }
37
+ attr_accessor :extra_headers
38
+
39
+ # Extra data to send with the request. These are deep merged into any data
40
+ # generated as part of the normal request.
41
+ sig { returns(T.nilable(T.anything)) }
42
+ attr_accessor :extra_body
43
+
44
+ # Maximum number of retries to attempt after a failed initial request.
45
+ sig { returns(T.nilable(Integer)) }
46
+ attr_accessor :max_retries
47
+
48
+ # Request timeout in seconds.
49
+ sig { returns(T.nilable(Float)) }
50
+ attr_accessor :timeout
51
+
52
+ # Returns a new instance of RequestOptions.
53
+ sig do
54
+ params(values: MethodRuby::Internal::AnyHash).returns(T.attached_class)
55
+ end
56
+ def self.new(values = {})
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,119 @@
1
+ # typed: strong
2
+
3
+ module MethodRuby
4
+ module Resources
5
+ # Entities represent your application's end-users. An Entity is the legal holder
6
+ # of an Account and can be either an individual or a corporation.
7
+ class Entities
8
+ # Creates a new Entity.
9
+ sig do
10
+ params(
11
+ body:
12
+ T.any(
13
+ MethodRuby::EntityCreateParams::Body::Individual::OrHash,
14
+ MethodRuby::EntityCreateParams::Body::Corporation::OrHash
15
+ ),
16
+ idempotency_key: String,
17
+ method_version:
18
+ MethodRuby::EntityCreateParams::MethodVersion::OrSymbol,
19
+ request_options: MethodRuby::RequestOptions::OrHash
20
+ ).returns(MethodRuby::Models::EntityCreateResponse)
21
+ end
22
+ def create(
23
+ # Body param
24
+ body:,
25
+ # Header param: Unique key to ensure idempotent requests.
26
+ idempotency_key: nil,
27
+ # Header param: API version to use for this request.
28
+ method_version: nil,
29
+ request_options: {}
30
+ )
31
+ end
32
+
33
+ # Returns the Entity associated with the ID.
34
+ sig do
35
+ params(
36
+ ent_id: String,
37
+ method_version:
38
+ MethodRuby::EntityRetrieveParams::MethodVersion::OrSymbol,
39
+ request_options: MethodRuby::RequestOptions::OrHash
40
+ ).returns(MethodRuby::Models::EntityRetrieveResponse)
41
+ end
42
+ def retrieve(
43
+ # Entity identifier
44
+ ent_id,
45
+ # API version to use for this request.
46
+ method_version: nil,
47
+ request_options: {}
48
+ )
49
+ end
50
+
51
+ # Updates an Entity with the provided data.
52
+ sig do
53
+ params(
54
+ ent_id: String,
55
+ address: MethodRuby::Address::OrHash,
56
+ corporation: MethodRuby::EntityCorporation::OrHash,
57
+ individual: MethodRuby::EntityIndividual::OrHash,
58
+ metadata: T.nilable(T::Hash[Symbol, T.anything]),
59
+ idempotency_key: String,
60
+ method_version:
61
+ MethodRuby::EntityUpdateParams::MethodVersion::OrSymbol,
62
+ request_options: MethodRuby::RequestOptions::OrHash
63
+ ).returns(MethodRuby::Models::EntityUpdateResponse)
64
+ end
65
+ def update(
66
+ # Path param: Entity identifier
67
+ ent_id,
68
+ # Body param
69
+ address: nil,
70
+ # Body param
71
+ corporation: nil,
72
+ # Body param
73
+ individual: nil,
74
+ # Body param: Custom metadata associated with the resource
75
+ metadata: nil,
76
+ # Header param: Unique key to ensure idempotent requests.
77
+ idempotency_key: nil,
78
+ # Header param: API version to use for this request.
79
+ method_version: nil,
80
+ request_options: {}
81
+ )
82
+ end
83
+
84
+ # Returns all entities associated with your team.
85
+ sig do
86
+ params(
87
+ from_date: Date,
88
+ page: Integer,
89
+ page_cursor: String,
90
+ page_limit: Integer,
91
+ to_date: Date,
92
+ method_version: MethodRuby::EntityListParams::MethodVersion::OrSymbol,
93
+ request_options: MethodRuby::RequestOptions::OrHash
94
+ ).returns(MethodRuby::Models::EntityListResponse)
95
+ end
96
+ def list(
97
+ # Query param
98
+ from_date: nil,
99
+ # Query param
100
+ page: nil,
101
+ # Query param
102
+ page_cursor: nil,
103
+ # Query param
104
+ page_limit: nil,
105
+ # Query param
106
+ to_date: nil,
107
+ # Header param: API version to use for this request.
108
+ method_version: nil,
109
+ request_options: {}
110
+ )
111
+ end
112
+
113
+ # @api private
114
+ sig { params(client: MethodRuby::Client).returns(T.attached_class) }
115
+ def self.new(client:)
116
+ end
117
+ end
118
+ end
119
+ end
@@ -0,0 +1,22 @@
1
+ # typed: strong
2
+
3
+ module MethodRuby
4
+ module Resources
5
+ # API health check endpoint.
6
+ class Ping
7
+ # Returns the API health status and version.
8
+ sig do
9
+ params(request_options: MethodRuby::RequestOptions::OrHash).returns(
10
+ MethodRuby::Models::PingCheckResponse
11
+ )
12
+ end
13
+ def check(request_options: {})
14
+ end
15
+
16
+ # @api private
17
+ sig { params(client: MethodRuby::Client).returns(T.attached_class) }
18
+ def self.new(client:)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,5 @@
1
+ # typed: strong
2
+
3
+ module MethodRuby
4
+ VERSION = T.let(T.unsafe(nil), String)
5
+ end
@@ -0,0 +1,39 @@
1
+ module MethodRuby
2
+ class Client < MethodRuby::Internal::Transport::BaseClient
3
+ DEFAULT_MAX_RETRIES: 2
4
+
5
+ DEFAULT_TIMEOUT_IN_SECONDS: Float
6
+
7
+ DEFAULT_INITIAL_RETRY_DELAY: Float
8
+
9
+ DEFAULT_MAX_RETRY_DELAY: Float
10
+
11
+ ENVIRONMENTS: {
12
+ production: "https://production.methodfi.com",
13
+ sandbox: "https://sandbox.methodfi.com",
14
+ dev: "https://dev.methodfi.com"
15
+ }
16
+
17
+ attr_reader api_key: String
18
+
19
+ attr_reader entities: MethodRuby::Resources::Entities
20
+
21
+ attr_reader ping: MethodRuby::Resources::Ping
22
+
23
+ private def auth_headers: (
24
+ security: { bearer_auth: bool }
25
+ ) -> ::Hash[String, String]
26
+
27
+ private def bearer_auth: -> ::Hash[String, String]
28
+
29
+ def initialize: (
30
+ ?api_key: String?,
31
+ ?environment: :production | :sandbox | :dev | nil,
32
+ ?base_url: String?,
33
+ ?max_retries: Integer,
34
+ ?timeout: Float,
35
+ ?initial_retry_delay: Float,
36
+ ?max_retry_delay: Float
37
+ ) -> void
38
+ end
39
+ end
@@ -0,0 +1,117 @@
1
+ module MethodRuby
2
+ module Errors
3
+ class Error < StandardError
4
+ attr_accessor cause: StandardError?
5
+ end
6
+
7
+ class ConversionError < MethodRuby::Errors::Error
8
+ def cause: -> StandardError?
9
+
10
+ def initialize: (
11
+ on: Class,
12
+ method: Symbol,
13
+ target: top,
14
+ value: top,
15
+ ?cause: StandardError?
16
+ ) -> void
17
+ end
18
+
19
+ class APIError < MethodRuby::Errors::Error
20
+ attr_accessor url: URI::Generic
21
+
22
+ attr_accessor status: Integer?
23
+
24
+ attr_accessor headers: ::Hash[String, String]?
25
+
26
+ attr_accessor body: top?
27
+
28
+ def initialize: (
29
+ url: URI::Generic,
30
+ ?status: Integer?,
31
+ ?headers: ::Hash[String, String]?,
32
+ ?body: Object?,
33
+ ?request: nil,
34
+ ?response: nil,
35
+ ?message: String?
36
+ ) -> void
37
+ end
38
+
39
+ class APIConnectionError < MethodRuby::Errors::APIError
40
+ def initialize: (
41
+ url: URI::Generic,
42
+ ?status: nil,
43
+ ?headers: ::Hash[String, String]?,
44
+ ?body: nil,
45
+ ?request: nil,
46
+ ?response: nil,
47
+ ?message: String?
48
+ ) -> void
49
+ end
50
+
51
+ class APITimeoutError < MethodRuby::Errors::APIConnectionError
52
+ def initialize: (
53
+ url: URI::Generic,
54
+ ?status: nil,
55
+ ?headers: ::Hash[String, String]?,
56
+ ?body: nil,
57
+ ?request: nil,
58
+ ?response: nil,
59
+ ?message: String?
60
+ ) -> void
61
+ end
62
+
63
+ class APIStatusError < MethodRuby::Errors::APIError
64
+ def self.for: (
65
+ url: URI::Generic,
66
+ status: Integer,
67
+ headers: ::Hash[String, String]?,
68
+ body: Object?,
69
+ request: nil,
70
+ response: nil,
71
+ ?message: String?
72
+ ) -> instance
73
+
74
+ def initialize: (
75
+ url: URI::Generic,
76
+ status: Integer,
77
+ headers: ::Hash[String, String]?,
78
+ body: Object?,
79
+ request: nil,
80
+ response: nil,
81
+ ?message: String?
82
+ ) -> void
83
+ end
84
+
85
+ class BadRequestError < MethodRuby::Errors::APIStatusError
86
+ HTTP_STATUS: 400
87
+ end
88
+
89
+ class AuthenticationError < MethodRuby::Errors::APIStatusError
90
+ HTTP_STATUS: 401
91
+ end
92
+
93
+ class PermissionDeniedError < MethodRuby::Errors::APIStatusError
94
+ HTTP_STATUS: 403
95
+ end
96
+
97
+ class NotFoundError < MethodRuby::Errors::APIStatusError
98
+ HTTP_STATUS: 404
99
+ end
100
+
101
+ class ConflictError < MethodRuby::Errors::APIStatusError
102
+ HTTP_STATUS: 409
103
+ end
104
+
105
+ class UnprocessableEntityError < MethodRuby::Errors::APIStatusError
106
+ HTTP_STATUS: 422
107
+ end
108
+
109
+ class RateLimitError < MethodRuby::Errors::APIStatusError
110
+ HTTP_STATUS: 429
111
+ end
112
+
113
+ class InternalServerError < MethodRuby::Errors::APIStatusError
114
+ HTTP_STATUS: Range[Integer]
115
+ end
116
+ end
117
+ end
@@ -0,0 +1,21 @@
1
+ module MethodRuby
2
+ class FilePart
3
+ attr_reader content: Pathname | StringIO | IO | String
4
+
5
+ attr_reader content_type: String?
6
+
7
+ attr_reader filename: String?
8
+
9
+ private def read: -> String
10
+
11
+ def to_json: (*top a) -> String
12
+
13
+ def to_yaml: (*top a) -> String
14
+
15
+ def initialize: (
16
+ Pathname | StringIO | IO | String content,
17
+ ?filename: (Pathname | String)?,
18
+ ?content_type: String?
19
+ ) -> void
20
+ end
21
+ end