square_connect 2.20180712.2.237 → 2.20180918.0.244
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +20 -1
- data/README.md +33 -1
- data/docs/BatchChangeInventoryRequest.md +14 -0
- data/docs/BatchChangeInventoryResponse.md +13 -0
- data/docs/BatchRetrieveInventoryChangesRequest.md +18 -0
- data/docs/BatchRetrieveInventoryChangesResponse.md +14 -0
- data/docs/BatchRetrieveInventoryCountsRequest.md +15 -0
- data/docs/BatchRetrieveInventoryCountsResponse.md +14 -0
- data/docs/Card.md +1 -1
- data/docs/CreateCustomerRequest.md +1 -0
- data/docs/Customer.md +1 -0
- data/docs/CustomersApi.md +2 -2
- data/docs/ErrorCode.md +2 -0
- data/docs/InventoryAdjustment.md +28 -0
- data/docs/InventoryApi.md +391 -0
- data/docs/InventoryChange.md +15 -0
- data/docs/InventoryChangeType.md +14 -0
- data/docs/InventoryCount.md +17 -0
- data/docs/InventoryPhysicalCount.md +22 -0
- data/docs/InventoryState.md +23 -0
- data/docs/InventoryTransfer.md +23 -0
- data/docs/Product.md +19 -0
- data/docs/RetrieveInventoryAdjustmentRequest.md +11 -0
- data/docs/RetrieveInventoryAdjustmentResponse.md +13 -0
- data/docs/RetrieveInventoryChangesRequest.md +13 -0
- data/docs/RetrieveInventoryChangesResponse.md +14 -0
- data/docs/RetrieveInventoryCountRequest.md +13 -0
- data/docs/RetrieveInventoryCountResponse.md +14 -0
- data/docs/RetrieveInventoryPhysicalCountRequest.md +11 -0
- data/docs/RetrieveInventoryPhysicalCountResponse.md +13 -0
- data/docs/SourceApplication.md +14 -0
- data/docs/TransactionsApi.md +1 -1
- data/docs/UpdateCustomerRequest.md +1 -0
- data/docs/V1Timecard.md +4 -1
- data/lib/square_connect.rb +24 -0
- data/lib/square_connect/api/apple_pay_api.rb +1 -1
- data/lib/square_connect/api/catalog_api.rb +11 -11
- data/lib/square_connect/api/checkout_api.rb +1 -1
- data/lib/square_connect/api/customers_api.rb +12 -12
- data/lib/square_connect/api/inventory_api.rb +417 -0
- data/lib/square_connect/api/locations_api.rb +1 -1
- data/lib/square_connect/api/mobile_authorization_api.rb +1 -1
- data/lib/square_connect/api/o_auth_api.rb +3 -3
- data/lib/square_connect/api/orders_api.rb +2 -2
- data/lib/square_connect/api/reporting_api.rb +2 -2
- data/lib/square_connect/api/transactions_api.rb +9 -9
- data/lib/square_connect/api_client.rb +1 -1
- data/lib/square_connect/models/batch_change_inventory_request.rb +208 -0
- data/lib/square_connect/models/batch_change_inventory_response.rb +200 -0
- data/lib/square_connect/models/batch_retrieve_inventory_changes_request.rb +275 -0
- data/lib/square_connect/models/batch_retrieve_inventory_changes_response.rb +210 -0
- data/lib/square_connect/models/batch_retrieve_inventory_counts_request.rb +220 -0
- data/lib/square_connect/models/batch_retrieve_inventory_counts_response.rb +210 -0
- data/lib/square_connect/models/card.rb +1 -1
- data/lib/square_connect/models/create_customer_request.rb +14 -4
- data/lib/square_connect/models/customer.rb +11 -1
- data/lib/square_connect/models/error.rb +2 -2
- data/lib/square_connect/models/error_code.rb +2 -0
- data/lib/square_connect/models/inventory_adjustment.rb +391 -0
- data/lib/square_connect/models/inventory_change.rb +249 -0
- data/lib/square_connect/models/inventory_change_type.rb +20 -0
- data/lib/square_connect/models/inventory_count.rb +269 -0
- data/lib/square_connect/models/inventory_physical_count.rb +319 -0
- data/lib/square_connect/models/inventory_state.rb +29 -0
- data/lib/square_connect/models/inventory_transfer.rb +329 -0
- data/lib/square_connect/models/money.rb +0 -9
- data/lib/square_connect/models/product.rb +25 -0
- data/lib/square_connect/models/retrieve_inventory_adjustment_request.rb +176 -0
- data/lib/square_connect/models/retrieve_inventory_adjustment_response.rb +198 -0
- data/lib/square_connect/models/retrieve_inventory_changes_request.rb +196 -0
- data/lib/square_connect/models/retrieve_inventory_changes_response.rb +210 -0
- data/lib/square_connect/models/retrieve_inventory_count_request.rb +196 -0
- data/lib/square_connect/models/retrieve_inventory_count_response.rb +210 -0
- data/lib/square_connect/models/retrieve_inventory_physical_count_request.rb +176 -0
- data/lib/square_connect/models/retrieve_inventory_physical_count_response.rb +198 -0
- data/lib/square_connect/models/source_application.rb +239 -0
- data/lib/square_connect/models/update_customer_request.rb +14 -4
- data/lib/square_connect/models/v1_timecard.rb +35 -5
- data/lib/square_connect/version.rb +1 -1
- data/spec/api/inventory_api_spec.rb +120 -0
- data/spec/models/batch_change_inventory_request_spec.rb +51 -0
- data/spec/models/batch_change_inventory_response_spec.rb +45 -0
- data/spec/models/batch_retrieve_inventory_changes_request_spec.rb +83 -0
- data/spec/models/batch_retrieve_inventory_changes_response_spec.rb +51 -0
- data/spec/models/batch_retrieve_inventory_counts_request_spec.rb +57 -0
- data/spec/models/batch_retrieve_inventory_counts_response_spec.rb +51 -0
- data/spec/models/inventory_adjustment_spec.rb +143 -0
- data/spec/models/inventory_change_spec.rb +61 -0
- data/spec/models/inventory_change_type_spec.rb +33 -0
- data/spec/models/inventory_count_spec.rb +73 -0
- data/spec/models/inventory_physical_count_spec.rb +103 -0
- data/spec/models/inventory_state_spec.rb +33 -0
- data/spec/models/inventory_transfer_spec.rb +109 -0
- data/spec/models/product_spec.rb +33 -0
- data/spec/models/retrieve_inventory_adjustment_request_spec.rb +33 -0
- data/spec/models/retrieve_inventory_adjustment_response_spec.rb +45 -0
- data/spec/models/retrieve_inventory_changes_request_spec.rb +45 -0
- data/spec/models/retrieve_inventory_changes_response_spec.rb +51 -0
- data/spec/models/retrieve_inventory_count_request_spec.rb +45 -0
- data/spec/models/retrieve_inventory_count_response_spec.rb +51 -0
- data/spec/models/retrieve_inventory_physical_count_request_spec.rb +33 -0
- data/spec/models/retrieve_inventory_physical_count_response_spec.rb +45 -0
- data/spec/models/source_application_spec.rb +55 -0
- metadata +99 -3
@@ -0,0 +1,220 @@
|
|
1
|
+
=begin
|
2
|
+
#Square Connect API
|
3
|
+
|
4
|
+
OpenAPI spec version: 2.0
|
5
|
+
Contact: developers@squareup.com
|
6
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
7
|
+
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'date'
|
11
|
+
|
12
|
+
module SquareConnect
|
13
|
+
#
|
14
|
+
class BatchRetrieveInventoryCountsRequest
|
15
|
+
# Filters results by [CatalogObject](#type-catalogobject) ID. Only applied when set. Default: unset.
|
16
|
+
attr_accessor :catalog_object_ids
|
17
|
+
|
18
|
+
# Filters results by [Location](#type-location) ID. Only applied when set. Default: unset.
|
19
|
+
attr_accessor :location_ids
|
20
|
+
|
21
|
+
# Provided as an RFC 3339 timestamp. Returns results whose `calculated_at` value is after the given time. Default: UNIX epoch (`1970-01-01T00:00:00Z`).
|
22
|
+
attr_accessor :updated_after
|
23
|
+
|
24
|
+
# A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query. See [Paginating results](#paginatingresults) for more information.
|
25
|
+
attr_accessor :cursor
|
26
|
+
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'catalog_object_ids' => :'catalog_object_ids',
|
32
|
+
:'location_ids' => :'location_ids',
|
33
|
+
:'updated_after' => :'updated_after',
|
34
|
+
:'cursor' => :'cursor'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.swagger_types
|
40
|
+
{
|
41
|
+
:'catalog_object_ids' => :'Array<String>',
|
42
|
+
:'location_ids' => :'Array<String>',
|
43
|
+
:'updated_after' => :'String',
|
44
|
+
:'cursor' => :'String'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# Initializes the object
|
49
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
50
|
+
def initialize(attributes = {})
|
51
|
+
return unless attributes.is_a?(Hash)
|
52
|
+
|
53
|
+
# convert string to symbol for hash key
|
54
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
55
|
+
|
56
|
+
if attributes.has_key?(:'catalog_object_ids')
|
57
|
+
if (value = attributes[:'catalog_object_ids']).is_a?(Array)
|
58
|
+
self.catalog_object_ids = value
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'location_ids')
|
63
|
+
if (value = attributes[:'location_ids']).is_a?(Array)
|
64
|
+
self.location_ids = value
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.has_key?(:'updated_after')
|
69
|
+
self.updated_after = attributes[:'updated_after']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.has_key?(:'cursor')
|
73
|
+
self.cursor = attributes[:'cursor']
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
79
|
+
# @return Array for valid properies with the reasons
|
80
|
+
def list_invalid_properties
|
81
|
+
invalid_properties = Array.new
|
82
|
+
return invalid_properties
|
83
|
+
end
|
84
|
+
|
85
|
+
# Check to see if the all the properties in the model are valid
|
86
|
+
# @return true if the model is valid
|
87
|
+
def valid?
|
88
|
+
return true
|
89
|
+
end
|
90
|
+
|
91
|
+
# Checks equality by comparing each attribute.
|
92
|
+
# @param [Object] Object to be compared
|
93
|
+
def ==(o)
|
94
|
+
return true if self.equal?(o)
|
95
|
+
self.class == o.class &&
|
96
|
+
catalog_object_ids == o.catalog_object_ids &&
|
97
|
+
location_ids == o.location_ids &&
|
98
|
+
updated_after == o.updated_after &&
|
99
|
+
cursor == o.cursor
|
100
|
+
end
|
101
|
+
|
102
|
+
# @see the `==` method
|
103
|
+
# @param [Object] Object to be compared
|
104
|
+
def eql?(o)
|
105
|
+
self == o
|
106
|
+
end
|
107
|
+
|
108
|
+
# Calculates hash code according to all attributes.
|
109
|
+
# @return [Fixnum] Hash code
|
110
|
+
def hash
|
111
|
+
[catalog_object_ids, location_ids, updated_after, cursor].hash
|
112
|
+
end
|
113
|
+
|
114
|
+
# Builds the object from hash
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
116
|
+
# @return [Object] Returns the model itself
|
117
|
+
def build_from_hash(attributes)
|
118
|
+
return nil unless attributes.is_a?(Hash)
|
119
|
+
self.class.swagger_types.each_pair do |key, type|
|
120
|
+
if type =~ /\AArray<(.*)>/i
|
121
|
+
# check to ensure the input is an array given that the the attribute
|
122
|
+
# is documented as an array but the input is not
|
123
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
124
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
125
|
+
end
|
126
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
127
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
128
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
129
|
+
end
|
130
|
+
|
131
|
+
self
|
132
|
+
end
|
133
|
+
|
134
|
+
# Deserializes the data based on type
|
135
|
+
# @param string type Data type
|
136
|
+
# @param string value Value to be deserialized
|
137
|
+
# @return [Object] Deserialized data
|
138
|
+
def _deserialize(type, value)
|
139
|
+
case type.to_sym
|
140
|
+
when :DateTime
|
141
|
+
DateTime.parse(value)
|
142
|
+
when :Date
|
143
|
+
Date.parse(value)
|
144
|
+
when :String
|
145
|
+
value.to_s
|
146
|
+
when :Integer
|
147
|
+
value.to_i
|
148
|
+
when :Float
|
149
|
+
value.to_f
|
150
|
+
when :BOOLEAN
|
151
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
152
|
+
true
|
153
|
+
else
|
154
|
+
false
|
155
|
+
end
|
156
|
+
when :Object
|
157
|
+
# generic object (usually a Hash), return directly
|
158
|
+
value
|
159
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
160
|
+
inner_type = Regexp.last_match[:inner_type]
|
161
|
+
value.map { |v| _deserialize(inner_type, v) }
|
162
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
163
|
+
k_type = Regexp.last_match[:k_type]
|
164
|
+
v_type = Regexp.last_match[:v_type]
|
165
|
+
{}.tap do |hash|
|
166
|
+
value.each do |k, v|
|
167
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
else # model
|
171
|
+
temp_model = SquareConnect.const_get(type).new
|
172
|
+
temp_model.build_from_hash(value)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
# Returns the string representation of the object
|
177
|
+
# @return [String] String presentation of the object
|
178
|
+
def to_s
|
179
|
+
to_hash.to_s
|
180
|
+
end
|
181
|
+
|
182
|
+
# to_body is an alias to to_hash (backward compatibility)
|
183
|
+
# @return [Hash] Returns the object in the form of hash
|
184
|
+
def to_body
|
185
|
+
to_hash
|
186
|
+
end
|
187
|
+
|
188
|
+
# Returns the object in the form of hash
|
189
|
+
# @return [Hash] Returns the object in the form of hash
|
190
|
+
def to_hash
|
191
|
+
hash = {}
|
192
|
+
self.class.attribute_map.each_pair do |attr, param|
|
193
|
+
value = self.send(attr)
|
194
|
+
next if value.nil?
|
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
|
+
|
218
|
+
end
|
219
|
+
|
220
|
+
end
|
@@ -0,0 +1,210 @@
|
|
1
|
+
=begin
|
2
|
+
#Square Connect API
|
3
|
+
|
4
|
+
OpenAPI spec version: 2.0
|
5
|
+
Contact: developers@squareup.com
|
6
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
7
|
+
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'date'
|
11
|
+
|
12
|
+
module SquareConnect
|
13
|
+
#
|
14
|
+
class BatchRetrieveInventoryCountsResponse
|
15
|
+
# Any errors that occurred during the request.
|
16
|
+
attr_accessor :errors
|
17
|
+
|
18
|
+
# The current calculated inventory counts for the requested objects and locations.
|
19
|
+
attr_accessor :counts
|
20
|
+
|
21
|
+
# The pagination cursor to be used in a subsequent request. If unset, this is the final response. See [Paginating results](#paginatingresults) for more information.
|
22
|
+
attr_accessor :cursor
|
23
|
+
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'errors' => :'errors',
|
29
|
+
:'counts' => :'counts',
|
30
|
+
:'cursor' => :'cursor'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Attribute type mapping.
|
35
|
+
def self.swagger_types
|
36
|
+
{
|
37
|
+
:'errors' => :'Array<Error>',
|
38
|
+
:'counts' => :'Array<InventoryCount>',
|
39
|
+
:'cursor' => :'String'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# Initializes the object
|
44
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
45
|
+
def initialize(attributes = {})
|
46
|
+
return unless attributes.is_a?(Hash)
|
47
|
+
|
48
|
+
# convert string to symbol for hash key
|
49
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
50
|
+
|
51
|
+
if attributes.has_key?(:'errors')
|
52
|
+
if (value = attributes[:'errors']).is_a?(Array)
|
53
|
+
self.errors = value
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
if attributes.has_key?(:'counts')
|
58
|
+
if (value = attributes[:'counts']).is_a?(Array)
|
59
|
+
self.counts = value
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
if attributes.has_key?(:'cursor')
|
64
|
+
self.cursor = attributes[:'cursor']
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
70
|
+
# @return Array for valid properies with the reasons
|
71
|
+
def list_invalid_properties
|
72
|
+
invalid_properties = Array.new
|
73
|
+
return invalid_properties
|
74
|
+
end
|
75
|
+
|
76
|
+
# Check to see if the all the properties in the model are valid
|
77
|
+
# @return true if the model is valid
|
78
|
+
def valid?
|
79
|
+
return true
|
80
|
+
end
|
81
|
+
|
82
|
+
# Checks equality by comparing each attribute.
|
83
|
+
# @param [Object] Object to be compared
|
84
|
+
def ==(o)
|
85
|
+
return true if self.equal?(o)
|
86
|
+
self.class == o.class &&
|
87
|
+
errors == o.errors &&
|
88
|
+
counts == o.counts &&
|
89
|
+
cursor == o.cursor
|
90
|
+
end
|
91
|
+
|
92
|
+
# @see the `==` method
|
93
|
+
# @param [Object] Object to be compared
|
94
|
+
def eql?(o)
|
95
|
+
self == o
|
96
|
+
end
|
97
|
+
|
98
|
+
# Calculates hash code according to all attributes.
|
99
|
+
# @return [Fixnum] Hash code
|
100
|
+
def hash
|
101
|
+
[errors, counts, cursor].hash
|
102
|
+
end
|
103
|
+
|
104
|
+
# Builds the object from hash
|
105
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
106
|
+
# @return [Object] Returns the model itself
|
107
|
+
def build_from_hash(attributes)
|
108
|
+
return nil unless attributes.is_a?(Hash)
|
109
|
+
self.class.swagger_types.each_pair do |key, type|
|
110
|
+
if type =~ /\AArray<(.*)>/i
|
111
|
+
# check to ensure the input is an array given that the the attribute
|
112
|
+
# is documented as an array but the input is not
|
113
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
114
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
115
|
+
end
|
116
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
117
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
118
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
119
|
+
end
|
120
|
+
|
121
|
+
self
|
122
|
+
end
|
123
|
+
|
124
|
+
# Deserializes the data based on type
|
125
|
+
# @param string type Data type
|
126
|
+
# @param string value Value to be deserialized
|
127
|
+
# @return [Object] Deserialized data
|
128
|
+
def _deserialize(type, value)
|
129
|
+
case type.to_sym
|
130
|
+
when :DateTime
|
131
|
+
DateTime.parse(value)
|
132
|
+
when :Date
|
133
|
+
Date.parse(value)
|
134
|
+
when :String
|
135
|
+
value.to_s
|
136
|
+
when :Integer
|
137
|
+
value.to_i
|
138
|
+
when :Float
|
139
|
+
value.to_f
|
140
|
+
when :BOOLEAN
|
141
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
142
|
+
true
|
143
|
+
else
|
144
|
+
false
|
145
|
+
end
|
146
|
+
when :Object
|
147
|
+
# generic object (usually a Hash), return directly
|
148
|
+
value
|
149
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
150
|
+
inner_type = Regexp.last_match[:inner_type]
|
151
|
+
value.map { |v| _deserialize(inner_type, v) }
|
152
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
153
|
+
k_type = Regexp.last_match[:k_type]
|
154
|
+
v_type = Regexp.last_match[:v_type]
|
155
|
+
{}.tap do |hash|
|
156
|
+
value.each do |k, v|
|
157
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
else # model
|
161
|
+
temp_model = SquareConnect.const_get(type).new
|
162
|
+
temp_model.build_from_hash(value)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
# Returns the string representation of the object
|
167
|
+
# @return [String] String presentation of the object
|
168
|
+
def to_s
|
169
|
+
to_hash.to_s
|
170
|
+
end
|
171
|
+
|
172
|
+
# to_body is an alias to to_hash (backward compatibility)
|
173
|
+
# @return [Hash] Returns the object in the form of hash
|
174
|
+
def to_body
|
175
|
+
to_hash
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns the object in the form of hash
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
180
|
+
def to_hash
|
181
|
+
hash = {}
|
182
|
+
self.class.attribute_map.each_pair do |attr, param|
|
183
|
+
value = self.send(attr)
|
184
|
+
next if value.nil?
|
185
|
+
hash[param] = _to_hash(value)
|
186
|
+
end
|
187
|
+
hash
|
188
|
+
end
|
189
|
+
|
190
|
+
# Outputs non-array value in the form of hash
|
191
|
+
# For object, use to_hash. Otherwise, just return the value
|
192
|
+
# @param [Object] value Any valid value
|
193
|
+
# @return [Hash] Returns the value in the form of hash
|
194
|
+
def _to_hash(value)
|
195
|
+
if value.is_a?(Array)
|
196
|
+
value.compact.map{ |v| _to_hash(v) }
|
197
|
+
elsif value.is_a?(Hash)
|
198
|
+
{}.tap do |hash|
|
199
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
200
|
+
end
|
201
|
+
elsif value.respond_to? :to_hash
|
202
|
+
value.to_hash
|
203
|
+
else
|
204
|
+
value
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
end
|
209
|
+
|
210
|
+
end
|
@@ -33,7 +33,7 @@ module SquareConnect
|
|
33
33
|
# The card's billing address. This value is present only if this object represents a customer's card on file.
|
34
34
|
attr_accessor :billing_address
|
35
35
|
|
36
|
-
# The unique string fingerprint for the card.
|
36
|
+
# The unique string fingerprint for the card. The fingerprint is based on the credit card number and is unique to the merchant. If a card is used at multiple locations for the same merchant, it will have the same fingerprint in each case. Note: Fingerprint may not exist on old transactions.
|
37
37
|
attr_accessor :fingerprint
|
38
38
|
|
39
39
|
class EnumAttributeValidator
|
@@ -39,6 +39,9 @@ module SquareConnect
|
|
39
39
|
# An optional note to associate with the customer.
|
40
40
|
attr_accessor :note
|
41
41
|
|
42
|
+
# The customer birthday in RFC-3339 format. Year is optional, timezone and times are not allowed. Example: `0000-09-01T00:00:00-00:00` for a birthday on September 1st. `1998-09-01T00:00:00-00:00` for a birthday on September 1st 1998.
|
43
|
+
attr_accessor :birthday
|
44
|
+
|
42
45
|
|
43
46
|
# Attribute mapping from ruby-style variable name to JSON key.
|
44
47
|
def self.attribute_map
|
@@ -51,7 +54,8 @@ module SquareConnect
|
|
51
54
|
:'address' => :'address',
|
52
55
|
:'phone_number' => :'phone_number',
|
53
56
|
:'reference_id' => :'reference_id',
|
54
|
-
:'note' => :'note'
|
57
|
+
:'note' => :'note',
|
58
|
+
:'birthday' => :'birthday'
|
55
59
|
}
|
56
60
|
end
|
57
61
|
|
@@ -66,7 +70,8 @@ module SquareConnect
|
|
66
70
|
:'address' => :'Address',
|
67
71
|
:'phone_number' => :'String',
|
68
72
|
:'reference_id' => :'String',
|
69
|
-
:'note' => :'String'
|
73
|
+
:'note' => :'String',
|
74
|
+
:'birthday' => :'String'
|
70
75
|
}
|
71
76
|
end
|
72
77
|
|
@@ -114,6 +119,10 @@ module SquareConnect
|
|
114
119
|
self.note = attributes[:'note']
|
115
120
|
end
|
116
121
|
|
122
|
+
if attributes.has_key?(:'birthday')
|
123
|
+
self.birthday = attributes[:'birthday']
|
124
|
+
end
|
125
|
+
|
117
126
|
end
|
118
127
|
|
119
128
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -142,7 +151,8 @@ module SquareConnect
|
|
142
151
|
address == o.address &&
|
143
152
|
phone_number == o.phone_number &&
|
144
153
|
reference_id == o.reference_id &&
|
145
|
-
note == o.note
|
154
|
+
note == o.note &&
|
155
|
+
birthday == o.birthday
|
146
156
|
end
|
147
157
|
|
148
158
|
# @see the `==` method
|
@@ -154,7 +164,7 @@ module SquareConnect
|
|
154
164
|
# Calculates hash code according to all attributes.
|
155
165
|
# @return [Fixnum] Hash code
|
156
166
|
def hash
|
157
|
-
[given_name, family_name, company_name, nickname, email_address, address, phone_number, reference_id, note].hash
|
167
|
+
[given_name, family_name, company_name, nickname, email_address, address, phone_number, reference_id, note, birthday].hash
|
158
168
|
end
|
159
169
|
|
160
170
|
# Builds the object from hash
|