jamm 0.0.1 → 1.0.2
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/.gitignore +6 -57
- data/.rubocop.yml +18 -25
- data/Gemfile +4 -0
- data/Gemfile.lock +99 -0
- data/README.md +4 -4
- data/Rakefile +2 -0
- data/jamm.gemspec +16 -3
- data/lib/jamm/api/api/customer_api.rb +265 -0
- data/lib/jamm/api/api/healthcheck_api.rb +76 -0
- data/lib/jamm/api/api/payment_api.rb +203 -0
- data/lib/jamm/api/api_client.rb +385 -0
- data/lib/jamm/api/api_error.rb +58 -0
- data/lib/jamm/api/configuration.rb +293 -0
- data/lib/jamm/api/models/customer_service_update_customer_body.rb +247 -0
- data/lib/jamm/api/models/protobuf_any.rb +209 -0
- data/lib/jamm/api/models/rpc_status.rb +218 -0
- data/lib/jamm/api/models/v1_buyer.rb +274 -0
- data/lib/jamm/api/models/v1_charge.rb +233 -0
- data/lib/jamm/api/models/v1_contract.rb +225 -0
- data/lib/jamm/api/models/v1_create_contract_with_charge_request.rb +217 -0
- data/lib/jamm/api/models/v1_create_contract_with_charge_response.rb +222 -0
- data/lib/jamm/api/models/v1_create_contract_without_charge_request.rb +212 -0
- data/lib/jamm/api/models/v1_create_contract_without_charge_response.rb +217 -0
- data/lib/jamm/api/models/v1_create_customer_request.rb +207 -0
- data/lib/jamm/api/models/v1_create_customer_response.rb +207 -0
- data/lib/jamm/api/models/v1_customer.rb +223 -0
- data/lib/jamm/api/models/v1_delete_customer_response.rb +207 -0
- data/lib/jamm/api/models/v1_get_contract_response.rb +212 -0
- data/lib/jamm/api/models/v1_get_customer_response.rb +207 -0
- data/lib/jamm/api/models/v1_initial_charge.rb +225 -0
- data/lib/jamm/api/models/v1_merchant.rb +212 -0
- data/lib/jamm/api/models/v1_merchant_customer.rb +213 -0
- data/lib/jamm/api/models/v1_payment_link.rb +221 -0
- data/lib/jamm/api/models/v1_ping_response.rb +207 -0
- data/lib/jamm/api/models/v1_update_customer_response.rb +207 -0
- data/lib/jamm/api/models/v1_url.rb +216 -0
- data/lib/jamm/api/version.rb +15 -0
- data/lib/jamm/api.rb +65 -0
- data/lib/jamm/client.rb +14 -0
- data/lib/jamm/customer.rb +28 -0
- data/lib/jamm/errors.rb +4 -14
- data/lib/jamm/oauth.rb +5 -5
- data/lib/jamm/payment.rb +19 -11
- data/lib/jamm/version.rb +3 -1
- data/lib/jamm.rb +37 -117
- metadata +62 -37
- data/.github/workflows/build.yml +0 -23
- data/.github/workflows/ruby-publish.yml +0 -24
- data/CONTRIBUTORS +0 -1
- data/images/jamm_logo.png +0 -0
- data/lib/jamm/api_operations/create.rb +0 -16
- data/lib/jamm/api_operations/get.rb +0 -16
- data/lib/jamm/api_operations/list.rb +0 -16
- data/lib/jamm/api_operations/update.rb +0 -16
- data/lib/jamm/api_resource.rb +0 -5
- data/lib/jamm/charge.rb +0 -10
- data/lib/jamm/jamm_object.rb +0 -249
- data/lib/jamm/request.rb +0 -13
- data/lib/jamm/time_util.rb +0 -41
- data/lib/jamm/token.rb +0 -10
- data/lib/jamm/util.rb +0 -76
- data/test/jamm/charge_test.rb +0 -56
- data/test/jamm/oauth_test.rb +0 -47
- data/test/jamm/payment_test.rb +0 -17
- data/test/jamm/time_util_test.rb +0 -18
- data/test/jamm/token_test.rb +0 -52
- data/test/test_data.rb +0 -118
- data/test/test_helper.rb +0 -59
@@ -0,0 +1,209 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# #api/v1/common.proto
|
4
|
+
#
|
5
|
+
# No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
6
|
+
#
|
7
|
+
# The version of the OpenAPI document: version not set
|
8
|
+
#
|
9
|
+
# Generated by: https://openapi-generator.tech
|
10
|
+
# Generator version: 7.9.0
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Api
|
17
|
+
# `Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message. Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type. Example 1: Pack and unpack a message in C++. Foo foo = ...; Any any; any.PackFrom(foo); ... if (any.UnpackTo(&foo)) { ... } Example 2: Pack and unpack a message in Java. Foo foo = ...; Any any = Any.pack(foo); ... if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } // or ... if (any.isSameTypeAs(Foo.getDefaultInstance())) { foo = any.unpack(Foo.getDefaultInstance()); } Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() any.Pack(foo) ... if any.Is(Foo.DESCRIPTOR): any.Unpack(foo) ... Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) if err != nil { ... } ... foo := &pb.Foo{} if err := any.UnmarshalTo(foo); err != nil { ... } The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example \"foo.bar.com/x/y.z\" will yield type name \"y.z\". JSON ==== The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example: package google.profile; message Person { string first_name = 1; string last_name = 2; } { \"@type\": \"type.googleapis.com/google.profile.Person\", \"firstName\": <string>, \"lastName\": <string> } If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]): { \"@type\": \"type.googleapis.com/google.protobuf.Duration\", \"value\": \"1.212s\" }
|
18
|
+
class ProtobufAny
|
19
|
+
# A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one \"/\" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading \".\" is not accepted). In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows: * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a [google.protobuf.Type][] value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the URL, or have them precompiled into a binary to avoid any lookup. Therefore, binary compatibility needs to be preserved on changes to types. (Use versioned type names to manage breaking changes.) Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com. As of May 2023, there are no widely used type server implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics.
|
20
|
+
attr_accessor :type
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:type => :'@type'
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Returns all the JSON keys this model knows about
|
30
|
+
def self.acceptable_attributes
|
31
|
+
attribute_map.values
|
32
|
+
end
|
33
|
+
|
34
|
+
# Attribute type mapping.
|
35
|
+
def self.openapi_types
|
36
|
+
{
|
37
|
+
:type => :String
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# List of attributes with nullable: true
|
42
|
+
def self.openapi_nullable
|
43
|
+
Set.new([])
|
44
|
+
end
|
45
|
+
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
+
def initialize(attributes = {})
|
49
|
+
raise ArgumentError, 'The input argument (attributes) must be a hash in `Api::ProtobufAny` initialize method' unless attributes.is_a?(Hash)
|
50
|
+
|
51
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
52
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
53
|
+
raise ArgumentError, "`#{k}` is not a valid attribute in `Api::ProtobufAny`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect unless self.class.attribute_map.key?(k.to_sym)
|
54
|
+
|
55
|
+
h[k.to_sym] = v
|
56
|
+
end
|
57
|
+
|
58
|
+
return unless attributes.key?(:type)
|
59
|
+
|
60
|
+
self.type = attributes[:type]
|
61
|
+
end
|
62
|
+
|
63
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
64
|
+
# @return Array for valid properties with the reasons
|
65
|
+
def list_invalid_properties
|
66
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
67
|
+
[]
|
68
|
+
end
|
69
|
+
|
70
|
+
# Check to see if the all the properties in the model are valid
|
71
|
+
# @return true if the model is valid
|
72
|
+
def valid?
|
73
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
74
|
+
true
|
75
|
+
end
|
76
|
+
|
77
|
+
# Checks equality by comparing each attribute.
|
78
|
+
# @param [Object] Object to be compared
|
79
|
+
def ==(other)
|
80
|
+
return true if equal?(other)
|
81
|
+
|
82
|
+
self.class == other.class &&
|
83
|
+
type == other.type
|
84
|
+
end
|
85
|
+
|
86
|
+
# @see the `==` method
|
87
|
+
# @param [Object] Object to be compared
|
88
|
+
def eql?(other)
|
89
|
+
self == other
|
90
|
+
end
|
91
|
+
|
92
|
+
# Calculates hash code according to all attributes.
|
93
|
+
# @return [Integer] Hash code
|
94
|
+
def hash
|
95
|
+
[type].hash
|
96
|
+
end
|
97
|
+
|
98
|
+
# Builds the object from hash
|
99
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
100
|
+
# @return [Object] Returns the model itself
|
101
|
+
def self.build_from_hash(attributes)
|
102
|
+
return nil unless attributes.is_a?(Hash)
|
103
|
+
|
104
|
+
attributes = attributes.transform_keys(&:to_sym)
|
105
|
+
transformed_hash = {}
|
106
|
+
openapi_types.each_pair do |key, type|
|
107
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
108
|
+
transformed_hash[key.to_s] = nil
|
109
|
+
elsif type =~ /\AArray<(.*)>/i
|
110
|
+
# check to ensure the input is an array given that the attribute
|
111
|
+
# is documented as an array but the input is not
|
112
|
+
transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) } if attributes[attribute_map[key]].is_a?(Array)
|
113
|
+
elsif !attributes[attribute_map[key]].nil?
|
114
|
+
transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
|
115
|
+
end
|
116
|
+
end
|
117
|
+
new(transformed_hash)
|
118
|
+
end
|
119
|
+
|
120
|
+
# Deserializes the data based on type
|
121
|
+
# @param string type Data type
|
122
|
+
# @param string value Value to be deserialized
|
123
|
+
# @return [Object] Deserialized data
|
124
|
+
def self._deserialize(type, value)
|
125
|
+
case type.to_sym
|
126
|
+
when :Time
|
127
|
+
Time.parse(value)
|
128
|
+
when :Date
|
129
|
+
Date.parse(value)
|
130
|
+
when :String
|
131
|
+
value.to_s
|
132
|
+
when :Integer
|
133
|
+
value.to_i
|
134
|
+
when :Float
|
135
|
+
value.to_f
|
136
|
+
when :Boolean
|
137
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
138
|
+
true
|
139
|
+
else
|
140
|
+
false
|
141
|
+
end
|
142
|
+
when :Object
|
143
|
+
# generic object (usually a Hash), return directly
|
144
|
+
value
|
145
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
146
|
+
inner_type = Regexp.last_match[:inner_type]
|
147
|
+
value.map { |v| _deserialize(inner_type, v) }
|
148
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
149
|
+
k_type = Regexp.last_match[:k_type]
|
150
|
+
v_type = Regexp.last_match[:v_type]
|
151
|
+
{}.tap do |hash|
|
152
|
+
value.each do |k, v|
|
153
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
else # model
|
157
|
+
# models (e.g. Pet) or oneOf
|
158
|
+
klass = Api.const_get(type)
|
159
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
# Returns the string representation of the object
|
164
|
+
# @return [String] String presentation of the object
|
165
|
+
def to_s
|
166
|
+
to_hash.to_s
|
167
|
+
end
|
168
|
+
|
169
|
+
# to_body is an alias to to_hash (backward compatibility)
|
170
|
+
# @return [Hash] Returns the object in the form of hash
|
171
|
+
def to_body
|
172
|
+
to_hash
|
173
|
+
end
|
174
|
+
|
175
|
+
# Returns the object in the form of hash
|
176
|
+
# @return [Hash] Returns the object in the form of hash
|
177
|
+
def to_hash
|
178
|
+
hash = {}
|
179
|
+
self.class.attribute_map.each_pair do |attr, param|
|
180
|
+
value = send(attr)
|
181
|
+
if value.nil?
|
182
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
183
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
184
|
+
end
|
185
|
+
|
186
|
+
hash[param] = _to_hash(value)
|
187
|
+
end
|
188
|
+
hash
|
189
|
+
end
|
190
|
+
|
191
|
+
# Outputs non-array value in the form of hash
|
192
|
+
# For object, use to_hash. Otherwise, just return the value
|
193
|
+
# @param [Object] value Any valid value
|
194
|
+
# @return [Hash] Returns the value in the form of hash
|
195
|
+
def _to_hash(value)
|
196
|
+
if value.is_a?(Array)
|
197
|
+
value.compact.map { |v| _to_hash(v) }
|
198
|
+
elsif value.is_a?(Hash)
|
199
|
+
{}.tap do |hash|
|
200
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
201
|
+
end
|
202
|
+
elsif value.respond_to? :to_hash
|
203
|
+
value.to_hash
|
204
|
+
else
|
205
|
+
value
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
@@ -0,0 +1,218 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# #api/v1/common.proto
|
4
|
+
#
|
5
|
+
# No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
6
|
+
#
|
7
|
+
# The version of the OpenAPI document: version not set
|
8
|
+
#
|
9
|
+
# Generated by: https://openapi-generator.tech
|
10
|
+
# Generator version: 7.9.0
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Api
|
17
|
+
class RpcStatus
|
18
|
+
attr_accessor :code, :message, :details
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:code => :code,
|
24
|
+
:message => :message,
|
25
|
+
:details => :details
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Returns all the JSON keys this model knows about
|
30
|
+
def self.acceptable_attributes
|
31
|
+
attribute_map.values
|
32
|
+
end
|
33
|
+
|
34
|
+
# Attribute type mapping.
|
35
|
+
def self.openapi_types
|
36
|
+
{
|
37
|
+
:code => :Integer,
|
38
|
+
:message => :String,
|
39
|
+
:details => :'Array<ProtobufAny>'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# List of attributes with nullable: true
|
44
|
+
def self.openapi_nullable
|
45
|
+
Set.new([])
|
46
|
+
end
|
47
|
+
|
48
|
+
# Initializes the object
|
49
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
50
|
+
def initialize(attributes = {})
|
51
|
+
raise ArgumentError, 'The input argument (attributes) must be a hash in `Api::RpcStatus` initialize method' unless attributes.is_a?(Hash)
|
52
|
+
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
54
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
55
|
+
raise ArgumentError, "`#{k}` is not a valid attribute in `Api::RpcStatus`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect unless self.class.attribute_map.key?(k.to_sym)
|
56
|
+
|
57
|
+
h[k.to_sym] = v
|
58
|
+
end
|
59
|
+
|
60
|
+
self.code = attributes[:code] if attributes.key?(:code)
|
61
|
+
|
62
|
+
self.message = attributes[:message] if attributes.key?(:message)
|
63
|
+
|
64
|
+
return unless attributes.key?(:details)
|
65
|
+
return unless (value = attributes[:details]).is_a?(Array)
|
66
|
+
|
67
|
+
self.details = value
|
68
|
+
end
|
69
|
+
|
70
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
71
|
+
# @return Array for valid properties with the reasons
|
72
|
+
def list_invalid_properties
|
73
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
74
|
+
[]
|
75
|
+
end
|
76
|
+
|
77
|
+
# Check to see if the all the properties in the model are valid
|
78
|
+
# @return true if the model is valid
|
79
|
+
def valid?
|
80
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
81
|
+
true
|
82
|
+
end
|
83
|
+
|
84
|
+
# Checks equality by comparing each attribute.
|
85
|
+
# @param [Object] Object to be compared
|
86
|
+
def ==(other)
|
87
|
+
return true if equal?(other)
|
88
|
+
|
89
|
+
self.class == other.class &&
|
90
|
+
code == other.code &&
|
91
|
+
message == other.message &&
|
92
|
+
details == other.details
|
93
|
+
end
|
94
|
+
|
95
|
+
# @see the `==` method
|
96
|
+
# @param [Object] Object to be compared
|
97
|
+
def eql?(other)
|
98
|
+
self == other
|
99
|
+
end
|
100
|
+
|
101
|
+
# Calculates hash code according to all attributes.
|
102
|
+
# @return [Integer] Hash code
|
103
|
+
def hash
|
104
|
+
[code, message, details].hash
|
105
|
+
end
|
106
|
+
|
107
|
+
# Builds the object from hash
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
109
|
+
# @return [Object] Returns the model itself
|
110
|
+
def self.build_from_hash(attributes)
|
111
|
+
return nil unless attributes.is_a?(Hash)
|
112
|
+
|
113
|
+
attributes = attributes.transform_keys(&:to_sym)
|
114
|
+
transformed_hash = {}
|
115
|
+
openapi_types.each_pair do |key, type|
|
116
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
117
|
+
transformed_hash[key.to_s] = nil
|
118
|
+
elsif type =~ /\AArray<(.*)>/i
|
119
|
+
# check to ensure the input is an array given that the attribute
|
120
|
+
# is documented as an array but the input is not
|
121
|
+
transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) } if attributes[attribute_map[key]].is_a?(Array)
|
122
|
+
elsif !attributes[attribute_map[key]].nil?
|
123
|
+
transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
|
124
|
+
end
|
125
|
+
end
|
126
|
+
new(transformed_hash)
|
127
|
+
end
|
128
|
+
|
129
|
+
# Deserializes the data based on type
|
130
|
+
# @param string type Data type
|
131
|
+
# @param string value Value to be deserialized
|
132
|
+
# @return [Object] Deserialized data
|
133
|
+
def self._deserialize(type, value)
|
134
|
+
case type.to_sym
|
135
|
+
when :Time
|
136
|
+
Time.parse(value)
|
137
|
+
when :Date
|
138
|
+
Date.parse(value)
|
139
|
+
when :String
|
140
|
+
value.to_s
|
141
|
+
when :Integer
|
142
|
+
value.to_i
|
143
|
+
when :Float
|
144
|
+
value.to_f
|
145
|
+
when :Boolean
|
146
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
147
|
+
true
|
148
|
+
else
|
149
|
+
false
|
150
|
+
end
|
151
|
+
when :Object
|
152
|
+
# generic object (usually a Hash), return directly
|
153
|
+
value
|
154
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
155
|
+
inner_type = Regexp.last_match[:inner_type]
|
156
|
+
value.map { |v| _deserialize(inner_type, v) }
|
157
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
158
|
+
k_type = Regexp.last_match[:k_type]
|
159
|
+
v_type = Regexp.last_match[:v_type]
|
160
|
+
{}.tap do |hash|
|
161
|
+
value.each do |k, v|
|
162
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
else # model
|
166
|
+
# models (e.g. Pet) or oneOf
|
167
|
+
klass = Api.const_get(type)
|
168
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
# Returns the string representation of the object
|
173
|
+
# @return [String] String presentation of the object
|
174
|
+
def to_s
|
175
|
+
to_hash.to_s
|
176
|
+
end
|
177
|
+
|
178
|
+
# to_body is an alias to to_hash (backward compatibility)
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
180
|
+
def to_body
|
181
|
+
to_hash
|
182
|
+
end
|
183
|
+
|
184
|
+
# Returns the object in the form of hash
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
186
|
+
def to_hash
|
187
|
+
hash = {}
|
188
|
+
self.class.attribute_map.each_pair do |attr, param|
|
189
|
+
value = send(attr)
|
190
|
+
if value.nil?
|
191
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
192
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
193
|
+
end
|
194
|
+
|
195
|
+
hash[param] = _to_hash(value)
|
196
|
+
end
|
197
|
+
hash
|
198
|
+
end
|
199
|
+
|
200
|
+
# Outputs non-array value in the form of hash
|
201
|
+
# For object, use to_hash. Otherwise, just return the value
|
202
|
+
# @param [Object] value Any valid value
|
203
|
+
# @return [Hash] Returns the value in the form of hash
|
204
|
+
def _to_hash(value)
|
205
|
+
if value.is_a?(Array)
|
206
|
+
value.compact.map { |v| _to_hash(v) }
|
207
|
+
elsif value.is_a?(Hash)
|
208
|
+
{}.tap do |hash|
|
209
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
210
|
+
end
|
211
|
+
elsif value.respond_to? :to_hash
|
212
|
+
value.to_hash
|
213
|
+
else
|
214
|
+
value
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
@@ -0,0 +1,274 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# #api/v1/common.proto
|
4
|
+
#
|
5
|
+
# No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
6
|
+
#
|
7
|
+
# The version of the OpenAPI document: version not set
|
8
|
+
#
|
9
|
+
# Generated by: https://openapi-generator.tech
|
10
|
+
# Generator version: 7.9.0
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Api
|
17
|
+
# Buyer is a representation of a customer in your e-commerce site. We require this information to process the payment. 購入者とは、あなたのECサイトの顧客を表します。 この情報は決済を処理するために必要です。
|
18
|
+
class Buyer
|
19
|
+
# Email of the customer. You can update this value later through the UpdateCustomer endpoint. Customerのメールアドレス。 この値は UpdateCustomer エンドポイントを通じて後で更新できます。
|
20
|
+
attr_accessor :email
|
21
|
+
|
22
|
+
# A flag whether Jamm to force KYC for the customer. 初回購入時に購入者に対してKYCを強制するかどうかのフラグです。
|
23
|
+
attr_accessor :force_kyc
|
24
|
+
|
25
|
+
# Name of the customer. You can update this value later through the UpdateCustomer endpoint. e.g. - John Appleseed - 山田太郎 購入者の氏名。 この値は UpdateCustomer エンドポイントを通じて後で更新できます。
|
26
|
+
attr_accessor :name
|
27
|
+
|
28
|
+
# Katakana name of the customer. You can update this value later through the UpdateCustomer endpoint. e.g. ヤマダ Customerのカタカナ(姓)。 この値は UpdateCustomer エンドポイントを通じて後で更新できます。
|
29
|
+
attr_accessor :katakana_last_name
|
30
|
+
|
31
|
+
# Katakana name of the customer. You can update this value later through the UpdateCustomer endpoint. e.g. タロウ Customerのカタカナ(名)。 この値は UpdateCustomer エンドポイントを通じて後で更新できます。
|
32
|
+
attr_accessor :katakana_first_name
|
33
|
+
|
34
|
+
# Address of the customer. You can update this value later through the UpdateCustomer endpoint. e.g. - 東京都港区六本木1-1-1 Customerの住所。 この値は UpdateCustomer エンドポイントを通じて後で更新できます。
|
35
|
+
attr_accessor :address
|
36
|
+
|
37
|
+
# Birth date of the customer. You can update this value later through the UpdateCustomer endpoint. e.g. - 1990-01-01 Customerの生年月日。 この値は UpdateCustomer エンドポイントを通じて後で更新できます。
|
38
|
+
attr_accessor :birth_date
|
39
|
+
|
40
|
+
# Gender of the customer. Customerの性別。
|
41
|
+
attr_accessor :gender
|
42
|
+
|
43
|
+
# Arbitrary key-value additional information about the customer. You can see this information in our merchant dashboard. Customerに関する任意のキーと値の追加情報。 加盟店ダッシュボードで確認できます。
|
44
|
+
attr_accessor :metadata
|
45
|
+
|
46
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
47
|
+
def self.attribute_map
|
48
|
+
{
|
49
|
+
:email => :email,
|
50
|
+
:force_kyc => :forceKyc,
|
51
|
+
:name => :name,
|
52
|
+
:katakana_last_name => :katakanaLastName,
|
53
|
+
:katakana_first_name => :katakanaFirstName,
|
54
|
+
:address => :address,
|
55
|
+
:birth_date => :birthDate,
|
56
|
+
:gender => :gender,
|
57
|
+
:metadata => :metadata
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
# Returns all the JSON keys this model knows about
|
62
|
+
def self.acceptable_attributes
|
63
|
+
attribute_map.values
|
64
|
+
end
|
65
|
+
|
66
|
+
# Attribute type mapping.
|
67
|
+
def self.openapi_types
|
68
|
+
{
|
69
|
+
:email => :String,
|
70
|
+
:force_kyc => :Boolean,
|
71
|
+
:name => :String,
|
72
|
+
:katakana_last_name => :String,
|
73
|
+
:katakana_first_name => :String,
|
74
|
+
:address => :String,
|
75
|
+
:birth_date => :String,
|
76
|
+
:gender => :String,
|
77
|
+
:metadata => :'Hash<String, String>'
|
78
|
+
}
|
79
|
+
end
|
80
|
+
|
81
|
+
# List of attributes with nullable: true
|
82
|
+
def self.openapi_nullable
|
83
|
+
Set.new([])
|
84
|
+
end
|
85
|
+
|
86
|
+
# Initializes the object
|
87
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
88
|
+
def initialize(attributes = {})
|
89
|
+
raise ArgumentError, 'The input argument (attributes) must be a hash in `Api::Buyer` initialize method' unless attributes.is_a?(Hash)
|
90
|
+
|
91
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
92
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
93
|
+
raise ArgumentError, "`#{k}` is not a valid attribute in `Api::Buyer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect unless self.class.attribute_map.key?(k.to_sym)
|
94
|
+
|
95
|
+
h[k.to_sym] = v
|
96
|
+
end
|
97
|
+
|
98
|
+
self.email = attributes[:email] if attributes.key?(:email)
|
99
|
+
|
100
|
+
self.force_kyc = attributes[:force_kyc] if attributes.key?(:force_kyc)
|
101
|
+
|
102
|
+
self.name = attributes[:name] if attributes.key?(:name)
|
103
|
+
|
104
|
+
self.katakana_last_name = attributes[:katakana_last_name] if attributes.key?(:katakana_last_name)
|
105
|
+
|
106
|
+
self.katakana_first_name = attributes[:katakana_first_name] if attributes.key?(:katakana_first_name)
|
107
|
+
|
108
|
+
self.address = attributes[:address] if attributes.key?(:address)
|
109
|
+
|
110
|
+
self.birth_date = attributes[:birth_date] if attributes.key?(:birth_date)
|
111
|
+
|
112
|
+
self.gender = attributes[:gender] if attributes.key?(:gender)
|
113
|
+
|
114
|
+
return unless attributes.key?(:metadata)
|
115
|
+
return unless (value = attributes[:metadata]).is_a?(Hash)
|
116
|
+
|
117
|
+
self.metadata = value
|
118
|
+
end
|
119
|
+
|
120
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
121
|
+
# @return Array for valid properties with the reasons
|
122
|
+
def list_invalid_properties
|
123
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
124
|
+
[]
|
125
|
+
end
|
126
|
+
|
127
|
+
# Check to see if the all the properties in the model are valid
|
128
|
+
# @return true if the model is valid
|
129
|
+
def valid?
|
130
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
131
|
+
true
|
132
|
+
end
|
133
|
+
|
134
|
+
# Checks equality by comparing each attribute.
|
135
|
+
# @param [Object] Object to be compared
|
136
|
+
def ==(other)
|
137
|
+
return true if equal?(other)
|
138
|
+
|
139
|
+
self.class == other.class &&
|
140
|
+
email == other.email &&
|
141
|
+
force_kyc == other.force_kyc &&
|
142
|
+
name == other.name &&
|
143
|
+
katakana_last_name == other.katakana_last_name &&
|
144
|
+
katakana_first_name == other.katakana_first_name &&
|
145
|
+
address == other.address &&
|
146
|
+
birth_date == other.birth_date &&
|
147
|
+
gender == other.gender &&
|
148
|
+
metadata == other.metadata
|
149
|
+
end
|
150
|
+
|
151
|
+
# @see the `==` method
|
152
|
+
# @param [Object] Object to be compared
|
153
|
+
def eql?(other)
|
154
|
+
self == other
|
155
|
+
end
|
156
|
+
|
157
|
+
# Calculates hash code according to all attributes.
|
158
|
+
# @return [Integer] Hash code
|
159
|
+
def hash
|
160
|
+
[email, force_kyc, name, katakana_last_name, katakana_first_name, address, birth_date, gender, metadata].hash
|
161
|
+
end
|
162
|
+
|
163
|
+
# Builds the object from hash
|
164
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
165
|
+
# @return [Object] Returns the model itself
|
166
|
+
def self.build_from_hash(attributes)
|
167
|
+
return nil unless attributes.is_a?(Hash)
|
168
|
+
|
169
|
+
attributes = attributes.transform_keys(&:to_sym)
|
170
|
+
transformed_hash = {}
|
171
|
+
openapi_types.each_pair do |key, type|
|
172
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
173
|
+
transformed_hash[key.to_s] = nil
|
174
|
+
elsif type =~ /\AArray<(.*)>/i
|
175
|
+
# check to ensure the input is an array given that the attribute
|
176
|
+
# is documented as an array but the input is not
|
177
|
+
transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) } if attributes[attribute_map[key]].is_a?(Array)
|
178
|
+
elsif !attributes[attribute_map[key]].nil?
|
179
|
+
transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
|
180
|
+
end
|
181
|
+
end
|
182
|
+
new(transformed_hash)
|
183
|
+
end
|
184
|
+
|
185
|
+
# Deserializes the data based on type
|
186
|
+
# @param string type Data type
|
187
|
+
# @param string value Value to be deserialized
|
188
|
+
# @return [Object] Deserialized data
|
189
|
+
def self._deserialize(type, value)
|
190
|
+
case type.to_sym
|
191
|
+
when :Time
|
192
|
+
Time.parse(value)
|
193
|
+
when :Date
|
194
|
+
Date.parse(value)
|
195
|
+
when :String
|
196
|
+
value.to_s
|
197
|
+
when :Integer
|
198
|
+
value.to_i
|
199
|
+
when :Float
|
200
|
+
value.to_f
|
201
|
+
when :Boolean
|
202
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
203
|
+
true
|
204
|
+
else
|
205
|
+
false
|
206
|
+
end
|
207
|
+
when :Object
|
208
|
+
# generic object (usually a Hash), return directly
|
209
|
+
value
|
210
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
211
|
+
inner_type = Regexp.last_match[:inner_type]
|
212
|
+
value.map { |v| _deserialize(inner_type, v) }
|
213
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
214
|
+
k_type = Regexp.last_match[:k_type]
|
215
|
+
v_type = Regexp.last_match[:v_type]
|
216
|
+
{}.tap do |hash|
|
217
|
+
value.each do |k, v|
|
218
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
else # model
|
222
|
+
# models (e.g. Pet) or oneOf
|
223
|
+
klass = Api.const_get(type)
|
224
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
# Returns the string representation of the object
|
229
|
+
# @return [String] String presentation of the object
|
230
|
+
def to_s
|
231
|
+
to_hash.to_s
|
232
|
+
end
|
233
|
+
|
234
|
+
# to_body is an alias to to_hash (backward compatibility)
|
235
|
+
# @return [Hash] Returns the object in the form of hash
|
236
|
+
def to_body
|
237
|
+
to_hash
|
238
|
+
end
|
239
|
+
|
240
|
+
# Returns the object in the form of hash
|
241
|
+
# @return [Hash] Returns the object in the form of hash
|
242
|
+
def to_hash
|
243
|
+
hash = {}
|
244
|
+
self.class.attribute_map.each_pair do |attr, param|
|
245
|
+
value = send(attr)
|
246
|
+
if value.nil?
|
247
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
248
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
249
|
+
end
|
250
|
+
|
251
|
+
hash[param] = _to_hash(value)
|
252
|
+
end
|
253
|
+
hash
|
254
|
+
end
|
255
|
+
|
256
|
+
# Outputs non-array value in the form of hash
|
257
|
+
# For object, use to_hash. Otherwise, just return the value
|
258
|
+
# @param [Object] value Any valid value
|
259
|
+
# @return [Hash] Returns the value in the form of hash
|
260
|
+
def _to_hash(value)
|
261
|
+
if value.is_a?(Array)
|
262
|
+
value.compact.map { |v| _to_hash(v) }
|
263
|
+
elsif value.is_a?(Hash)
|
264
|
+
{}.tap do |hash|
|
265
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
266
|
+
end
|
267
|
+
elsif value.respond_to? :to_hash
|
268
|
+
value.to_hash
|
269
|
+
else
|
270
|
+
value
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|