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.
- checksums.yaml +7 -0
- data/.ignore +2 -0
- data/CHANGELOG.md +11 -0
- data/README.md +244 -0
- data/SECURITY.md +27 -0
- data/lib/method_ruby/client.rb +114 -0
- data/lib/method_ruby/errors.rb +228 -0
- data/lib/method_ruby/file_part.rb +58 -0
- data/lib/method_ruby/internal/transport/base_client.rb +595 -0
- data/lib/method_ruby/internal/transport/pooled_net_requester.rb +210 -0
- data/lib/method_ruby/internal/type/array_of.rb +168 -0
- data/lib/method_ruby/internal/type/base_model.rb +531 -0
- data/lib/method_ruby/internal/type/base_page.rb +55 -0
- data/lib/method_ruby/internal/type/boolean.rb +77 -0
- data/lib/method_ruby/internal/type/converter.rb +327 -0
- data/lib/method_ruby/internal/type/enum.rb +131 -0
- data/lib/method_ruby/internal/type/file_input.rb +111 -0
- data/lib/method_ruby/internal/type/hash_of.rb +188 -0
- data/lib/method_ruby/internal/type/request_parameters.rb +42 -0
- data/lib/method_ruby/internal/type/union.rb +237 -0
- data/lib/method_ruby/internal/type/unknown.rb +81 -0
- data/lib/method_ruby/internal/util.rb +951 -0
- data/lib/method_ruby/internal.rb +20 -0
- data/lib/method_ruby/models/address.rb +45 -0
- data/lib/method_ruby/models/entity.rb +102 -0
- data/lib/method_ruby/models/entity_corporation.rb +33 -0
- data/lib/method_ruby/models/entity_corporation_owner.rb +45 -0
- data/lib/method_ruby/models/entity_create_params.rb +188 -0
- data/lib/method_ruby/models/entity_create_response.rb +32 -0
- data/lib/method_ruby/models/entity_individual.rb +39 -0
- data/lib/method_ruby/models/entity_list_params.rb +61 -0
- data/lib/method_ruby/models/entity_list_response.rb +32 -0
- data/lib/method_ruby/models/entity_retrieve_params.rb +37 -0
- data/lib/method_ruby/models/entity_retrieve_response.rb +32 -0
- data/lib/method_ruby/models/entity_update_params.rb +75 -0
- data/lib/method_ruby/models/entity_update_response.rb +32 -0
- data/lib/method_ruby/models/ping_check_params.rb +14 -0
- data/lib/method_ruby/models/ping_check_response.rb +49 -0
- data/lib/method_ruby/models/resource_error.rb +33 -0
- data/lib/method_ruby/models.rb +63 -0
- data/lib/method_ruby/request_options.rb +77 -0
- data/lib/method_ruby/resources/entities.rb +141 -0
- data/lib/method_ruby/resources/ping.rb +34 -0
- data/lib/method_ruby/version.rb +5 -0
- data/lib/method_ruby.rb +73 -0
- data/manifest.yaml +17 -0
- data/rbi/method_ruby/client.rbi +85 -0
- data/rbi/method_ruby/errors.rbi +205 -0
- data/rbi/method_ruby/file_part.rbi +37 -0
- data/rbi/method_ruby/internal/transport/base_client.rbi +303 -0
- data/rbi/method_ruby/internal/transport/pooled_net_requester.rbi +84 -0
- data/rbi/method_ruby/internal/type/array_of.rbi +104 -0
- data/rbi/method_ruby/internal/type/base_model.rbi +308 -0
- data/rbi/method_ruby/internal/type/base_page.rbi +42 -0
- data/rbi/method_ruby/internal/type/boolean.rbi +58 -0
- data/rbi/method_ruby/internal/type/converter.rbi +216 -0
- data/rbi/method_ruby/internal/type/enum.rbi +82 -0
- data/rbi/method_ruby/internal/type/file_input.rbi +59 -0
- data/rbi/method_ruby/internal/type/hash_of.rbi +104 -0
- data/rbi/method_ruby/internal/type/request_parameters.rbi +29 -0
- data/rbi/method_ruby/internal/type/union.rbi +128 -0
- data/rbi/method_ruby/internal/type/unknown.rbi +58 -0
- data/rbi/method_ruby/internal/util.rbi +507 -0
- data/rbi/method_ruby/internal.rbi +18 -0
- data/rbi/method_ruby/models/address.rbi +63 -0
- data/rbi/method_ruby/models/entity.rbi +151 -0
- data/rbi/method_ruby/models/entity_corporation.rbi +61 -0
- data/rbi/method_ruby/models/entity_corporation_owner.rbi +86 -0
- data/rbi/method_ruby/models/entity_create_params.rbi +408 -0
- data/rbi/method_ruby/models/entity_create_response.rbi +84 -0
- data/rbi/method_ruby/models/entity_individual.rbi +65 -0
- data/rbi/method_ruby/models/entity_list_params.rbi +132 -0
- data/rbi/method_ruby/models/entity_list_response.rbi +84 -0
- data/rbi/method_ruby/models/entity_retrieve_params.rbi +93 -0
- data/rbi/method_ruby/models/entity_retrieve_response.rbi +89 -0
- data/rbi/method_ruby/models/entity_update_params.rbi +141 -0
- data/rbi/method_ruby/models/entity_update_response.rbi +84 -0
- data/rbi/method_ruby/models/ping_check_params.rbi +27 -0
- data/rbi/method_ruby/models/ping_check_response.rbi +118 -0
- data/rbi/method_ruby/models/resource_error.rbi +55 -0
- data/rbi/method_ruby/models.rbi +25 -0
- data/rbi/method_ruby/request_options.rbi +59 -0
- data/rbi/method_ruby/resources/entities.rbi +119 -0
- data/rbi/method_ruby/resources/ping.rbi +22 -0
- data/rbi/method_ruby/version.rbi +5 -0
- data/sig/method_ruby/client.rbs +39 -0
- data/sig/method_ruby/errors.rbs +117 -0
- data/sig/method_ruby/file_part.rbs +21 -0
- data/sig/method_ruby/internal/transport/base_client.rbs +135 -0
- data/sig/method_ruby/internal/transport/pooled_net_requester.rbs +48 -0
- data/sig/method_ruby/internal/type/array_of.rbs +48 -0
- data/sig/method_ruby/internal/type/base_model.rbs +102 -0
- data/sig/method_ruby/internal/type/base_page.rbs +24 -0
- data/sig/method_ruby/internal/type/boolean.rbs +26 -0
- data/sig/method_ruby/internal/type/converter.rbs +79 -0
- data/sig/method_ruby/internal/type/enum.rbs +32 -0
- data/sig/method_ruby/internal/type/file_input.rbs +25 -0
- data/sig/method_ruby/internal/type/hash_of.rbs +48 -0
- data/sig/method_ruby/internal/type/request_parameters.rbs +19 -0
- data/sig/method_ruby/internal/type/union.rbs +52 -0
- data/sig/method_ruby/internal/type/unknown.rbs +26 -0
- data/sig/method_ruby/internal/util.rbs +195 -0
- data/sig/method_ruby/internal.rbs +9 -0
- data/sig/method_ruby/models/address.rbs +40 -0
- data/sig/method_ruby/models/entity.rbs +94 -0
- data/sig/method_ruby/models/entity_corporation.rbs +43 -0
- data/sig/method_ruby/models/entity_corporation_owner.rbs +57 -0
- data/sig/method_ruby/models/entity_create_params.rbs +215 -0
- data/sig/method_ruby/models/entity_create_response.rbs +41 -0
- data/sig/method_ruby/models/entity_individual.rbs +44 -0
- data/sig/method_ruby/models/entity_list_params.rbs +77 -0
- data/sig/method_ruby/models/entity_list_response.rbs +41 -0
- data/sig/method_ruby/models/entity_retrieve_params.rbs +47 -0
- data/sig/method_ruby/models/entity_retrieve_response.rbs +41 -0
- data/sig/method_ruby/models/entity_update_params.rbs +84 -0
- data/sig/method_ruby/models/entity_update_response.rbs +41 -0
- data/sig/method_ruby/models/ping_check_params.rbs +15 -0
- data/sig/method_ruby/models/ping_check_response.rbs +59 -0
- data/sig/method_ruby/models/resource_error.rbs +38 -0
- data/sig/method_ruby/models.rbs +23 -0
- data/sig/method_ruby/request_options.rbs +36 -0
- data/sig/method_ruby/resources/entities.rbs +41 -0
- data/sig/method_ruby/resources/ping.rbs +11 -0
- data/sig/method_ruby/version.rbs +3 -0
- metadata +196 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MethodRuby
|
|
4
|
+
module Models
|
|
5
|
+
# @see MethodRuby::Resources::Entities#update
|
|
6
|
+
class EntityUpdateParams < MethodRuby::Internal::Type::BaseModel
|
|
7
|
+
extend MethodRuby::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include MethodRuby::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute ent_id
|
|
11
|
+
#
|
|
12
|
+
# @return [String]
|
|
13
|
+
required :ent_id, String
|
|
14
|
+
|
|
15
|
+
# @!attribute address
|
|
16
|
+
#
|
|
17
|
+
# @return [MethodRuby::Models::Address, nil]
|
|
18
|
+
optional :address, -> { MethodRuby::Address }
|
|
19
|
+
|
|
20
|
+
# @!attribute corporation
|
|
21
|
+
#
|
|
22
|
+
# @return [MethodRuby::Models::EntityCorporation, nil]
|
|
23
|
+
optional :corporation, -> { MethodRuby::EntityCorporation }
|
|
24
|
+
|
|
25
|
+
# @!attribute individual
|
|
26
|
+
#
|
|
27
|
+
# @return [MethodRuby::Models::EntityIndividual, nil]
|
|
28
|
+
optional :individual, -> { MethodRuby::EntityIndividual }
|
|
29
|
+
|
|
30
|
+
# @!attribute metadata
|
|
31
|
+
# Custom metadata associated with the resource
|
|
32
|
+
#
|
|
33
|
+
# @return [Hash{Symbol=>Object}, nil]
|
|
34
|
+
optional :metadata, MethodRuby::Internal::Type::HashOf[MethodRuby::Internal::Type::Unknown], nil?: true
|
|
35
|
+
|
|
36
|
+
# @!attribute idempotency_key
|
|
37
|
+
#
|
|
38
|
+
# @return [String, nil]
|
|
39
|
+
optional :idempotency_key, String
|
|
40
|
+
|
|
41
|
+
# @!attribute method_version
|
|
42
|
+
#
|
|
43
|
+
# @return [Symbol, MethodRuby::Models::EntityUpdateParams::MethodVersion, nil]
|
|
44
|
+
optional :method_version, enum: -> { MethodRuby::EntityUpdateParams::MethodVersion }
|
|
45
|
+
|
|
46
|
+
# @!method initialize(ent_id:, address: nil, corporation: nil, individual: nil, metadata: nil, idempotency_key: nil, method_version: nil, request_options: {})
|
|
47
|
+
# @param ent_id [String]
|
|
48
|
+
#
|
|
49
|
+
# @param address [MethodRuby::Models::Address]
|
|
50
|
+
#
|
|
51
|
+
# @param corporation [MethodRuby::Models::EntityCorporation]
|
|
52
|
+
#
|
|
53
|
+
# @param individual [MethodRuby::Models::EntityIndividual]
|
|
54
|
+
#
|
|
55
|
+
# @param metadata [Hash{Symbol=>Object}, nil] Custom metadata associated with the resource
|
|
56
|
+
#
|
|
57
|
+
# @param idempotency_key [String]
|
|
58
|
+
#
|
|
59
|
+
# @param method_version [Symbol, MethodRuby::Models::EntityUpdateParams::MethodVersion]
|
|
60
|
+
#
|
|
61
|
+
# @param request_options [MethodRuby::RequestOptions, Hash{Symbol=>Object}]
|
|
62
|
+
|
|
63
|
+
module MethodVersion
|
|
64
|
+
extend MethodRuby::Internal::Type::Enum
|
|
65
|
+
|
|
66
|
+
METHOD_VERSION_2024_04_04 = :"2024-04-04"
|
|
67
|
+
METHOD_VERSION_2025_07_04 = :"2025-07-04"
|
|
68
|
+
METHOD_VERSION_2025_12_01 = :"2025-12-01"
|
|
69
|
+
|
|
70
|
+
# @!method self.values
|
|
71
|
+
# @return [Array<Symbol>]
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MethodRuby
|
|
4
|
+
module Models
|
|
5
|
+
# @see MethodRuby::Resources::Entities#update
|
|
6
|
+
class EntityUpdateResponse < MethodRuby::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute data
|
|
8
|
+
#
|
|
9
|
+
# @return [MethodRuby::Models::Entity, nil]
|
|
10
|
+
optional :data, -> { MethodRuby::Entity }
|
|
11
|
+
|
|
12
|
+
# @!attribute success
|
|
13
|
+
#
|
|
14
|
+
# @return [Boolean, MethodRuby::Models::EntityUpdateResponse::Success, nil]
|
|
15
|
+
optional :success, enum: -> { MethodRuby::Models::EntityUpdateResponse::Success }
|
|
16
|
+
|
|
17
|
+
# @!method initialize(data: nil, success: nil)
|
|
18
|
+
# @param data [MethodRuby::Models::Entity]
|
|
19
|
+
# @param success [Boolean, MethodRuby::Models::EntityUpdateResponse::Success]
|
|
20
|
+
|
|
21
|
+
# @see MethodRuby::Models::EntityUpdateResponse#success
|
|
22
|
+
module Success
|
|
23
|
+
extend MethodRuby::Internal::Type::Enum
|
|
24
|
+
|
|
25
|
+
TRUE = true
|
|
26
|
+
|
|
27
|
+
# @!method self.values
|
|
28
|
+
# @return [Array<Boolean>]
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MethodRuby
|
|
4
|
+
module Models
|
|
5
|
+
# @see MethodRuby::Resources::Ping#check
|
|
6
|
+
class PingCheckParams < MethodRuby::Internal::Type::BaseModel
|
|
7
|
+
extend MethodRuby::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include MethodRuby::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!method initialize(request_options: {})
|
|
11
|
+
# @param request_options [MethodRuby::RequestOptions, Hash{Symbol=>Object}]
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MethodRuby
|
|
4
|
+
module Models
|
|
5
|
+
# @see MethodRuby::Resources::Ping#check
|
|
6
|
+
class PingCheckResponse < MethodRuby::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute data
|
|
8
|
+
#
|
|
9
|
+
# @return [MethodRuby::Models::PingCheckResponse::Data, nil]
|
|
10
|
+
optional :data, -> { MethodRuby::Models::PingCheckResponse::Data }
|
|
11
|
+
|
|
12
|
+
# @!attribute success
|
|
13
|
+
#
|
|
14
|
+
# @return [Boolean, MethodRuby::Models::PingCheckResponse::Success, nil]
|
|
15
|
+
optional :success, enum: -> { MethodRuby::Models::PingCheckResponse::Success }
|
|
16
|
+
|
|
17
|
+
# @!method initialize(data: nil, success: nil)
|
|
18
|
+
# @param data [MethodRuby::Models::PingCheckResponse::Data]
|
|
19
|
+
# @param success [Boolean, MethodRuby::Models::PingCheckResponse::Success]
|
|
20
|
+
|
|
21
|
+
# @see MethodRuby::Models::PingCheckResponse#data
|
|
22
|
+
class Data < MethodRuby::Internal::Type::BaseModel
|
|
23
|
+
# @!attribute status
|
|
24
|
+
#
|
|
25
|
+
# @return [String, nil]
|
|
26
|
+
optional :status, String
|
|
27
|
+
|
|
28
|
+
# @!attribute version
|
|
29
|
+
#
|
|
30
|
+
# @return [String, nil]
|
|
31
|
+
optional :version, String
|
|
32
|
+
|
|
33
|
+
# @!method initialize(status: nil, version: nil)
|
|
34
|
+
# @param status [String]
|
|
35
|
+
# @param version [String]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# @see MethodRuby::Models::PingCheckResponse#success
|
|
39
|
+
module Success
|
|
40
|
+
extend MethodRuby::Internal::Type::Enum
|
|
41
|
+
|
|
42
|
+
TRUE = true
|
|
43
|
+
|
|
44
|
+
# @!method self.values
|
|
45
|
+
# @return [Array<Boolean>]
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MethodRuby
|
|
4
|
+
module Models
|
|
5
|
+
class ResourceError < MethodRuby::Internal::Type::BaseModel
|
|
6
|
+
# @!attribute code
|
|
7
|
+
#
|
|
8
|
+
# @return [Integer, nil]
|
|
9
|
+
optional :code, Integer
|
|
10
|
+
|
|
11
|
+
# @!attribute message
|
|
12
|
+
#
|
|
13
|
+
# @return [String, nil]
|
|
14
|
+
optional :message, String
|
|
15
|
+
|
|
16
|
+
# @!attribute sub_type
|
|
17
|
+
#
|
|
18
|
+
# @return [String, nil]
|
|
19
|
+
optional :sub_type, String
|
|
20
|
+
|
|
21
|
+
# @!attribute type
|
|
22
|
+
#
|
|
23
|
+
# @return [String, nil]
|
|
24
|
+
optional :type, String
|
|
25
|
+
|
|
26
|
+
# @!method initialize(code: nil, message: nil, sub_type: nil, type: nil)
|
|
27
|
+
# @param code [Integer]
|
|
28
|
+
# @param message [String]
|
|
29
|
+
# @param sub_type [String]
|
|
30
|
+
# @param type [String]
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MethodRuby
|
|
4
|
+
[MethodRuby::Internal::Type::BaseModel, *MethodRuby::Internal::Type::BaseModel.subclasses].each do |cls|
|
|
5
|
+
cls.define_sorbet_constant!(:OrHash) { T.type_alias { T.any(cls, MethodRuby::Internal::AnyHash) } }
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
MethodRuby::Internal::Util.walk_namespaces(MethodRuby::Models).each do |mod|
|
|
9
|
+
case mod
|
|
10
|
+
in MethodRuby::Internal::Type::Enum | MethodRuby::Internal::Type::Union
|
|
11
|
+
mod.constants.each do |name|
|
|
12
|
+
case mod.const_get(name)
|
|
13
|
+
in true | false
|
|
14
|
+
mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T::Boolean } }
|
|
15
|
+
mod.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } }
|
|
16
|
+
in Integer
|
|
17
|
+
mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { Integer } }
|
|
18
|
+
mod.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } }
|
|
19
|
+
in Float
|
|
20
|
+
mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { Float } }
|
|
21
|
+
mod.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } }
|
|
22
|
+
in Symbol
|
|
23
|
+
mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { Symbol } }
|
|
24
|
+
mod.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } }
|
|
25
|
+
else
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
else
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
MethodRuby::Internal::Util.walk_namespaces(MethodRuby::Models)
|
|
33
|
+
.lazy
|
|
34
|
+
.grep(MethodRuby::Internal::Type::Union)
|
|
35
|
+
.each do |mod|
|
|
36
|
+
const = :Variants
|
|
37
|
+
next if mod.sorbet_constant_defined?(const)
|
|
38
|
+
|
|
39
|
+
mod.define_sorbet_constant!(const) { T.type_alias { mod.to_sorbet_type } }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
Address = MethodRuby::Models::Address
|
|
43
|
+
|
|
44
|
+
Entity = MethodRuby::Models::Entity
|
|
45
|
+
|
|
46
|
+
EntityCorporation = MethodRuby::Models::EntityCorporation
|
|
47
|
+
|
|
48
|
+
EntityCorporationOwner = MethodRuby::Models::EntityCorporationOwner
|
|
49
|
+
|
|
50
|
+
EntityCreateParams = MethodRuby::Models::EntityCreateParams
|
|
51
|
+
|
|
52
|
+
EntityIndividual = MethodRuby::Models::EntityIndividual
|
|
53
|
+
|
|
54
|
+
EntityListParams = MethodRuby::Models::EntityListParams
|
|
55
|
+
|
|
56
|
+
EntityRetrieveParams = MethodRuby::Models::EntityRetrieveParams
|
|
57
|
+
|
|
58
|
+
EntityUpdateParams = MethodRuby::Models::EntityUpdateParams
|
|
59
|
+
|
|
60
|
+
PingCheckParams = MethodRuby::Models::PingCheckParams
|
|
61
|
+
|
|
62
|
+
ResourceError = MethodRuby::Models::ResourceError
|
|
63
|
+
end
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
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
|
+
# @api private
|
|
11
|
+
#
|
|
12
|
+
# @param opts [MethodRuby::RequestOptions, Hash{Symbol=>Object}]
|
|
13
|
+
#
|
|
14
|
+
# @raise [ArgumentError]
|
|
15
|
+
def self.validate!(opts)
|
|
16
|
+
case opts
|
|
17
|
+
in MethodRuby::RequestOptions | Hash
|
|
18
|
+
opts.to_h.each_key do |k|
|
|
19
|
+
unless fields.include?(k)
|
|
20
|
+
raise ArgumentError.new("Request `opts` keys must be one of #{fields.keys}, got #{k.inspect}")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
else
|
|
24
|
+
raise ArgumentError.new("Request `opts` must be a Hash or RequestOptions, got #{opts.inspect}")
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# @!attribute idempotency_key
|
|
29
|
+
# Idempotency key to send with request and all associated retries. Will only be
|
|
30
|
+
# sent for write requests.
|
|
31
|
+
#
|
|
32
|
+
# @return [String, nil]
|
|
33
|
+
optional :idempotency_key, String
|
|
34
|
+
|
|
35
|
+
# @!attribute extra_query
|
|
36
|
+
# Extra query params to send with the request. These are `.merge`’d into any
|
|
37
|
+
# `query` given at the client level.
|
|
38
|
+
#
|
|
39
|
+
# @return [Hash{String=>Array<String>, String, nil}, nil]
|
|
40
|
+
optional :extra_query, MethodRuby::Internal::Type::HashOf[MethodRuby::Internal::Type::ArrayOf[String]]
|
|
41
|
+
|
|
42
|
+
# @!attribute extra_headers
|
|
43
|
+
# Extra headers to send with the request. These are `.merged`’d into any
|
|
44
|
+
# `extra_headers` given at the client level.
|
|
45
|
+
#
|
|
46
|
+
# @return [Hash{String=>String, nil}, nil]
|
|
47
|
+
optional :extra_headers, MethodRuby::Internal::Type::HashOf[String, nil?: true]
|
|
48
|
+
|
|
49
|
+
# @!attribute extra_body
|
|
50
|
+
# Extra data to send with the request. These are deep merged into any data
|
|
51
|
+
# generated as part of the normal request.
|
|
52
|
+
#
|
|
53
|
+
# @return [Object, nil]
|
|
54
|
+
optional :extra_body, MethodRuby::Internal::Type::HashOf[MethodRuby::Internal::Type::Unknown]
|
|
55
|
+
|
|
56
|
+
# @!attribute max_retries
|
|
57
|
+
# Maximum number of retries to attempt after a failed initial request.
|
|
58
|
+
#
|
|
59
|
+
# @return [Integer, nil]
|
|
60
|
+
optional :max_retries, Integer
|
|
61
|
+
|
|
62
|
+
# @!attribute timeout
|
|
63
|
+
# Request timeout in seconds.
|
|
64
|
+
#
|
|
65
|
+
# @return [Float, nil]
|
|
66
|
+
optional :timeout, Float
|
|
67
|
+
|
|
68
|
+
# @!method initialize(values = {})
|
|
69
|
+
# Returns a new instance of RequestOptions.
|
|
70
|
+
#
|
|
71
|
+
# @param values [Hash{Symbol=>Object}]
|
|
72
|
+
|
|
73
|
+
define_sorbet_constant!(:OrHash) do
|
|
74
|
+
T.type_alias { T.any(MethodRuby::RequestOptions, MethodRuby::Internal::AnyHash) }
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
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
|
+
#
|
|
10
|
+
# @overload create(body:, idempotency_key: nil, method_version: nil, request_options: {})
|
|
11
|
+
#
|
|
12
|
+
# @param body [MethodRuby::Models::EntityCreateParams::Body::Individual, MethodRuby::Models::EntityCreateParams::Body::Corporation] Body param
|
|
13
|
+
#
|
|
14
|
+
# @param idempotency_key [String] Header param: Unique key to ensure idempotent requests.
|
|
15
|
+
#
|
|
16
|
+
# @param method_version [Symbol, MethodRuby::Models::EntityCreateParams::MethodVersion] Header param: API version to use for this request.
|
|
17
|
+
#
|
|
18
|
+
# @param request_options [MethodRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
19
|
+
#
|
|
20
|
+
# @return [MethodRuby::Models::EntityCreateResponse]
|
|
21
|
+
#
|
|
22
|
+
# @see MethodRuby::Models::EntityCreateParams
|
|
23
|
+
def create(params)
|
|
24
|
+
parsed, options = MethodRuby::EntityCreateParams.dump_request(params)
|
|
25
|
+
@client.request(
|
|
26
|
+
method: :post,
|
|
27
|
+
path: "entities",
|
|
28
|
+
headers: parsed.except(:body).transform_keys(
|
|
29
|
+
idempotency_key: "idempotency-key",
|
|
30
|
+
method_version: "method-version"
|
|
31
|
+
),
|
|
32
|
+
body: parsed[:body],
|
|
33
|
+
model: MethodRuby::Models::EntityCreateResponse,
|
|
34
|
+
options: options
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Returns the Entity associated with the ID.
|
|
39
|
+
#
|
|
40
|
+
# @overload retrieve(ent_id, method_version: nil, request_options: {})
|
|
41
|
+
#
|
|
42
|
+
# @param ent_id [String] Entity identifier
|
|
43
|
+
#
|
|
44
|
+
# @param method_version [Symbol, MethodRuby::Models::EntityRetrieveParams::MethodVersion] API version to use for this request.
|
|
45
|
+
#
|
|
46
|
+
# @param request_options [MethodRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
47
|
+
#
|
|
48
|
+
# @return [MethodRuby::Models::EntityRetrieveResponse]
|
|
49
|
+
#
|
|
50
|
+
# @see MethodRuby::Models::EntityRetrieveParams
|
|
51
|
+
def retrieve(ent_id, params = {})
|
|
52
|
+
parsed, options = MethodRuby::EntityRetrieveParams.dump_request(params)
|
|
53
|
+
@client.request(
|
|
54
|
+
method: :get,
|
|
55
|
+
path: ["entities/%1$s", ent_id],
|
|
56
|
+
headers: parsed.transform_keys(method_version: "method-version"),
|
|
57
|
+
model: MethodRuby::Models::EntityRetrieveResponse,
|
|
58
|
+
options: options
|
|
59
|
+
)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Updates an Entity with the provided data.
|
|
63
|
+
#
|
|
64
|
+
# @overload update(ent_id, address: nil, corporation: nil, individual: nil, metadata: nil, idempotency_key: nil, method_version: nil, request_options: {})
|
|
65
|
+
#
|
|
66
|
+
# @param ent_id [String] Path param: Entity identifier
|
|
67
|
+
#
|
|
68
|
+
# @param address [MethodRuby::Models::Address] Body param
|
|
69
|
+
#
|
|
70
|
+
# @param corporation [MethodRuby::Models::EntityCorporation] Body param
|
|
71
|
+
#
|
|
72
|
+
# @param individual [MethodRuby::Models::EntityIndividual] Body param
|
|
73
|
+
#
|
|
74
|
+
# @param metadata [Hash{Symbol=>Object}, nil] Body param: Custom metadata associated with the resource
|
|
75
|
+
#
|
|
76
|
+
# @param idempotency_key [String] Header param: Unique key to ensure idempotent requests.
|
|
77
|
+
#
|
|
78
|
+
# @param method_version [Symbol, MethodRuby::Models::EntityUpdateParams::MethodVersion] Header param: API version to use for this request.
|
|
79
|
+
#
|
|
80
|
+
# @param request_options [MethodRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
81
|
+
#
|
|
82
|
+
# @return [MethodRuby::Models::EntityUpdateResponse]
|
|
83
|
+
#
|
|
84
|
+
# @see MethodRuby::Models::EntityUpdateParams
|
|
85
|
+
def update(ent_id, params = {})
|
|
86
|
+
parsed, options = MethodRuby::EntityUpdateParams.dump_request(params)
|
|
87
|
+
header_params = {idempotency_key: "idempotency-key", method_version: "method-version"}
|
|
88
|
+
@client.request(
|
|
89
|
+
method: :put,
|
|
90
|
+
path: ["entities/%1$s", ent_id],
|
|
91
|
+
headers: parsed.slice(*header_params.keys).transform_keys(header_params),
|
|
92
|
+
body: parsed.except(*header_params.keys),
|
|
93
|
+
model: MethodRuby::Models::EntityUpdateResponse,
|
|
94
|
+
options: options
|
|
95
|
+
)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Returns all entities associated with your team.
|
|
99
|
+
#
|
|
100
|
+
# @overload list(from_date: nil, page: nil, page_cursor: nil, page_limit: nil, to_date: nil, method_version: nil, request_options: {})
|
|
101
|
+
#
|
|
102
|
+
# @param from_date [Date] Query param
|
|
103
|
+
#
|
|
104
|
+
# @param page [Integer] Query param
|
|
105
|
+
#
|
|
106
|
+
# @param page_cursor [String] Query param
|
|
107
|
+
#
|
|
108
|
+
# @param page_limit [Integer] Query param
|
|
109
|
+
#
|
|
110
|
+
# @param to_date [Date] Query param
|
|
111
|
+
#
|
|
112
|
+
# @param method_version [Symbol, MethodRuby::Models::EntityListParams::MethodVersion] Header param: API version to use for this request.
|
|
113
|
+
#
|
|
114
|
+
# @param request_options [MethodRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
115
|
+
#
|
|
116
|
+
# @return [MethodRuby::Models::EntityListResponse]
|
|
117
|
+
#
|
|
118
|
+
# @see MethodRuby::Models::EntityListParams
|
|
119
|
+
def list(params = {})
|
|
120
|
+
query_params = [:from_date, :page, :page_cursor, :page_limit, :to_date]
|
|
121
|
+
parsed, options = MethodRuby::EntityListParams.dump_request(params)
|
|
122
|
+
query = MethodRuby::Internal::Util.encode_query_params(parsed.slice(*query_params))
|
|
123
|
+
@client.request(
|
|
124
|
+
method: :get,
|
|
125
|
+
path: "entities",
|
|
126
|
+
query: query,
|
|
127
|
+
headers: parsed.except(*query_params).transform_keys(method_version: "method-version"),
|
|
128
|
+
model: MethodRuby::Models::EntityListResponse,
|
|
129
|
+
options: options
|
|
130
|
+
)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# @api private
|
|
134
|
+
#
|
|
135
|
+
# @param client [MethodRuby::Client]
|
|
136
|
+
def initialize(client:)
|
|
137
|
+
@client = client
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MethodRuby
|
|
4
|
+
module Resources
|
|
5
|
+
# API health check endpoint.
|
|
6
|
+
class Ping
|
|
7
|
+
# Returns the API health status and version.
|
|
8
|
+
#
|
|
9
|
+
# @overload check(request_options: {})
|
|
10
|
+
#
|
|
11
|
+
# @param request_options [MethodRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
12
|
+
#
|
|
13
|
+
# @return [MethodRuby::Models::PingCheckResponse]
|
|
14
|
+
#
|
|
15
|
+
# @see MethodRuby::Models::PingCheckParams
|
|
16
|
+
def check(params = {})
|
|
17
|
+
@client.request(
|
|
18
|
+
method: :get,
|
|
19
|
+
path: "ping",
|
|
20
|
+
model: MethodRuby::Models::PingCheckResponse,
|
|
21
|
+
security: {},
|
|
22
|
+
options: params[:request_options]
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# @api private
|
|
27
|
+
#
|
|
28
|
+
# @param client [MethodRuby::Client]
|
|
29
|
+
def initialize(client:)
|
|
30
|
+
@client = client
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
data/lib/method_ruby.rb
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Standard libraries.
|
|
4
|
+
# rubocop:disable Lint/RedundantRequireStatement
|
|
5
|
+
require "English"
|
|
6
|
+
require "base64"
|
|
7
|
+
require "cgi"
|
|
8
|
+
require "date"
|
|
9
|
+
require "erb"
|
|
10
|
+
require "etc"
|
|
11
|
+
require "json"
|
|
12
|
+
require "net/http"
|
|
13
|
+
require "openssl"
|
|
14
|
+
require "pathname"
|
|
15
|
+
require "rbconfig"
|
|
16
|
+
require "securerandom"
|
|
17
|
+
require "set"
|
|
18
|
+
require "stringio"
|
|
19
|
+
require "time"
|
|
20
|
+
require "uri"
|
|
21
|
+
# rubocop:enable Lint/RedundantRequireStatement
|
|
22
|
+
|
|
23
|
+
# We already ship the preferred sorbet manifests in the package itself.
|
|
24
|
+
# `tapioca` currently does not offer us a way to opt out of unnecessary compilation.
|
|
25
|
+
if Object.const_defined?(:Tapioca) &&
|
|
26
|
+
caller.chain([$PROGRAM_NAME]).chain(ARGV).any?(/tapioca/) &&
|
|
27
|
+
ARGV.none?(/dsl/)
|
|
28
|
+
return
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Gems.
|
|
32
|
+
require "connection_pool"
|
|
33
|
+
|
|
34
|
+
# Package files.
|
|
35
|
+
require_relative "method_ruby/version"
|
|
36
|
+
require_relative "method_ruby/internal/util"
|
|
37
|
+
require_relative "method_ruby/internal/type/converter"
|
|
38
|
+
require_relative "method_ruby/internal/type/unknown"
|
|
39
|
+
require_relative "method_ruby/internal/type/boolean"
|
|
40
|
+
require_relative "method_ruby/internal/type/file_input"
|
|
41
|
+
require_relative "method_ruby/internal/type/enum"
|
|
42
|
+
require_relative "method_ruby/internal/type/union"
|
|
43
|
+
require_relative "method_ruby/internal/type/array_of"
|
|
44
|
+
require_relative "method_ruby/internal/type/hash_of"
|
|
45
|
+
require_relative "method_ruby/internal/type/base_model"
|
|
46
|
+
require_relative "method_ruby/internal/type/base_page"
|
|
47
|
+
require_relative "method_ruby/internal/type/request_parameters"
|
|
48
|
+
require_relative "method_ruby/internal"
|
|
49
|
+
require_relative "method_ruby/request_options"
|
|
50
|
+
require_relative "method_ruby/file_part"
|
|
51
|
+
require_relative "method_ruby/errors"
|
|
52
|
+
require_relative "method_ruby/internal/transport/base_client"
|
|
53
|
+
require_relative "method_ruby/internal/transport/pooled_net_requester"
|
|
54
|
+
require_relative "method_ruby/client"
|
|
55
|
+
require_relative "method_ruby/models/address"
|
|
56
|
+
require_relative "method_ruby/models/entity"
|
|
57
|
+
require_relative "method_ruby/models/entity_corporation"
|
|
58
|
+
require_relative "method_ruby/models/entity_corporation_owner"
|
|
59
|
+
require_relative "method_ruby/models/entity_create_params"
|
|
60
|
+
require_relative "method_ruby/models/entity_create_response"
|
|
61
|
+
require_relative "method_ruby/models/entity_individual"
|
|
62
|
+
require_relative "method_ruby/models/entity_list_params"
|
|
63
|
+
require_relative "method_ruby/models/entity_list_response"
|
|
64
|
+
require_relative "method_ruby/models/entity_retrieve_params"
|
|
65
|
+
require_relative "method_ruby/models/entity_retrieve_response"
|
|
66
|
+
require_relative "method_ruby/models/entity_update_params"
|
|
67
|
+
require_relative "method_ruby/models/entity_update_response"
|
|
68
|
+
require_relative "method_ruby/models/ping_check_params"
|
|
69
|
+
require_relative "method_ruby/models/ping_check_response"
|
|
70
|
+
require_relative "method_ruby/models/resource_error"
|
|
71
|
+
require_relative "method_ruby/models"
|
|
72
|
+
require_relative "method_ruby/resources/entities"
|
|
73
|
+
require_relative "method_ruby/resources/ping"
|