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.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +20 -1
  3. data/README.md +33 -1
  4. data/docs/BatchChangeInventoryRequest.md +14 -0
  5. data/docs/BatchChangeInventoryResponse.md +13 -0
  6. data/docs/BatchRetrieveInventoryChangesRequest.md +18 -0
  7. data/docs/BatchRetrieveInventoryChangesResponse.md +14 -0
  8. data/docs/BatchRetrieveInventoryCountsRequest.md +15 -0
  9. data/docs/BatchRetrieveInventoryCountsResponse.md +14 -0
  10. data/docs/Card.md +1 -1
  11. data/docs/CreateCustomerRequest.md +1 -0
  12. data/docs/Customer.md +1 -0
  13. data/docs/CustomersApi.md +2 -2
  14. data/docs/ErrorCode.md +2 -0
  15. data/docs/InventoryAdjustment.md +28 -0
  16. data/docs/InventoryApi.md +391 -0
  17. data/docs/InventoryChange.md +15 -0
  18. data/docs/InventoryChangeType.md +14 -0
  19. data/docs/InventoryCount.md +17 -0
  20. data/docs/InventoryPhysicalCount.md +22 -0
  21. data/docs/InventoryState.md +23 -0
  22. data/docs/InventoryTransfer.md +23 -0
  23. data/docs/Product.md +19 -0
  24. data/docs/RetrieveInventoryAdjustmentRequest.md +11 -0
  25. data/docs/RetrieveInventoryAdjustmentResponse.md +13 -0
  26. data/docs/RetrieveInventoryChangesRequest.md +13 -0
  27. data/docs/RetrieveInventoryChangesResponse.md +14 -0
  28. data/docs/RetrieveInventoryCountRequest.md +13 -0
  29. data/docs/RetrieveInventoryCountResponse.md +14 -0
  30. data/docs/RetrieveInventoryPhysicalCountRequest.md +11 -0
  31. data/docs/RetrieveInventoryPhysicalCountResponse.md +13 -0
  32. data/docs/SourceApplication.md +14 -0
  33. data/docs/TransactionsApi.md +1 -1
  34. data/docs/UpdateCustomerRequest.md +1 -0
  35. data/docs/V1Timecard.md +4 -1
  36. data/lib/square_connect.rb +24 -0
  37. data/lib/square_connect/api/apple_pay_api.rb +1 -1
  38. data/lib/square_connect/api/catalog_api.rb +11 -11
  39. data/lib/square_connect/api/checkout_api.rb +1 -1
  40. data/lib/square_connect/api/customers_api.rb +12 -12
  41. data/lib/square_connect/api/inventory_api.rb +417 -0
  42. data/lib/square_connect/api/locations_api.rb +1 -1
  43. data/lib/square_connect/api/mobile_authorization_api.rb +1 -1
  44. data/lib/square_connect/api/o_auth_api.rb +3 -3
  45. data/lib/square_connect/api/orders_api.rb +2 -2
  46. data/lib/square_connect/api/reporting_api.rb +2 -2
  47. data/lib/square_connect/api/transactions_api.rb +9 -9
  48. data/lib/square_connect/api_client.rb +1 -1
  49. data/lib/square_connect/models/batch_change_inventory_request.rb +208 -0
  50. data/lib/square_connect/models/batch_change_inventory_response.rb +200 -0
  51. data/lib/square_connect/models/batch_retrieve_inventory_changes_request.rb +275 -0
  52. data/lib/square_connect/models/batch_retrieve_inventory_changes_response.rb +210 -0
  53. data/lib/square_connect/models/batch_retrieve_inventory_counts_request.rb +220 -0
  54. data/lib/square_connect/models/batch_retrieve_inventory_counts_response.rb +210 -0
  55. data/lib/square_connect/models/card.rb +1 -1
  56. data/lib/square_connect/models/create_customer_request.rb +14 -4
  57. data/lib/square_connect/models/customer.rb +11 -1
  58. data/lib/square_connect/models/error.rb +2 -2
  59. data/lib/square_connect/models/error_code.rb +2 -0
  60. data/lib/square_connect/models/inventory_adjustment.rb +391 -0
  61. data/lib/square_connect/models/inventory_change.rb +249 -0
  62. data/lib/square_connect/models/inventory_change_type.rb +20 -0
  63. data/lib/square_connect/models/inventory_count.rb +269 -0
  64. data/lib/square_connect/models/inventory_physical_count.rb +319 -0
  65. data/lib/square_connect/models/inventory_state.rb +29 -0
  66. data/lib/square_connect/models/inventory_transfer.rb +329 -0
  67. data/lib/square_connect/models/money.rb +0 -9
  68. data/lib/square_connect/models/product.rb +25 -0
  69. data/lib/square_connect/models/retrieve_inventory_adjustment_request.rb +176 -0
  70. data/lib/square_connect/models/retrieve_inventory_adjustment_response.rb +198 -0
  71. data/lib/square_connect/models/retrieve_inventory_changes_request.rb +196 -0
  72. data/lib/square_connect/models/retrieve_inventory_changes_response.rb +210 -0
  73. data/lib/square_connect/models/retrieve_inventory_count_request.rb +196 -0
  74. data/lib/square_connect/models/retrieve_inventory_count_response.rb +210 -0
  75. data/lib/square_connect/models/retrieve_inventory_physical_count_request.rb +176 -0
  76. data/lib/square_connect/models/retrieve_inventory_physical_count_response.rb +198 -0
  77. data/lib/square_connect/models/source_application.rb +239 -0
  78. data/lib/square_connect/models/update_customer_request.rb +14 -4
  79. data/lib/square_connect/models/v1_timecard.rb +35 -5
  80. data/lib/square_connect/version.rb +1 -1
  81. data/spec/api/inventory_api_spec.rb +120 -0
  82. data/spec/models/batch_change_inventory_request_spec.rb +51 -0
  83. data/spec/models/batch_change_inventory_response_spec.rb +45 -0
  84. data/spec/models/batch_retrieve_inventory_changes_request_spec.rb +83 -0
  85. data/spec/models/batch_retrieve_inventory_changes_response_spec.rb +51 -0
  86. data/spec/models/batch_retrieve_inventory_counts_request_spec.rb +57 -0
  87. data/spec/models/batch_retrieve_inventory_counts_response_spec.rb +51 -0
  88. data/spec/models/inventory_adjustment_spec.rb +143 -0
  89. data/spec/models/inventory_change_spec.rb +61 -0
  90. data/spec/models/inventory_change_type_spec.rb +33 -0
  91. data/spec/models/inventory_count_spec.rb +73 -0
  92. data/spec/models/inventory_physical_count_spec.rb +103 -0
  93. data/spec/models/inventory_state_spec.rb +33 -0
  94. data/spec/models/inventory_transfer_spec.rb +109 -0
  95. data/spec/models/product_spec.rb +33 -0
  96. data/spec/models/retrieve_inventory_adjustment_request_spec.rb +33 -0
  97. data/spec/models/retrieve_inventory_adjustment_response_spec.rb +45 -0
  98. data/spec/models/retrieve_inventory_changes_request_spec.rb +45 -0
  99. data/spec/models/retrieve_inventory_changes_response_spec.rb +51 -0
  100. data/spec/models/retrieve_inventory_count_request_spec.rb +45 -0
  101. data/spec/models/retrieve_inventory_count_response_spec.rb +51 -0
  102. data/spec/models/retrieve_inventory_physical_count_request_spec.rb +33 -0
  103. data/spec/models/retrieve_inventory_physical_count_response_spec.rb +45 -0
  104. data/spec/models/source_application_spec.rb +55 -0
  105. metadata +99 -3
@@ -45,6 +45,9 @@ module SquareConnect
45
45
  # The customer's phone number.
46
46
  attr_accessor :phone_number
47
47
 
48
+ # The customer's 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.
49
+ attr_accessor :birthday
50
+
48
51
  # A second ID you can set to associate the customer with an entity in another system.
49
52
  attr_accessor :reference_id
50
53
 
@@ -96,6 +99,7 @@ module SquareConnect
96
99
  :'email_address' => :'email_address',
97
100
  :'address' => :'address',
98
101
  :'phone_number' => :'phone_number',
102
+ :'birthday' => :'birthday',
99
103
  :'reference_id' => :'reference_id',
100
104
  :'note' => :'note',
101
105
  :'preferences' => :'preferences',
@@ -118,6 +122,7 @@ module SquareConnect
118
122
  :'email_address' => :'String',
119
123
  :'address' => :'Address',
120
124
  :'phone_number' => :'String',
125
+ :'birthday' => :'String',
121
126
  :'reference_id' => :'String',
122
127
  :'note' => :'String',
123
128
  :'preferences' => :'CustomerPreferences',
@@ -180,6 +185,10 @@ module SquareConnect
180
185
  self.phone_number = attributes[:'phone_number']
181
186
  end
182
187
 
188
+ if attributes.has_key?(:'birthday')
189
+ self.birthday = attributes[:'birthday']
190
+ end
191
+
183
192
  if attributes.has_key?(:'reference_id')
184
193
  self.reference_id = attributes[:'reference_id']
185
194
  end
@@ -260,6 +269,7 @@ module SquareConnect
260
269
  email_address == o.email_address &&
261
270
  address == o.address &&
262
271
  phone_number == o.phone_number &&
272
+ birthday == o.birthday &&
263
273
  reference_id == o.reference_id &&
264
274
  note == o.note &&
265
275
  preferences == o.preferences &&
@@ -276,7 +286,7 @@ module SquareConnect
276
286
  # Calculates hash code according to all attributes.
277
287
  # @return [Fixnum] Hash code
278
288
  def hash
279
- [id, created_at, updated_at, cards, given_name, family_name, nickname, company_name, email_address, address, phone_number, reference_id, note, preferences, groups, creation_source].hash
289
+ [id, created_at, updated_at, cards, given_name, family_name, nickname, company_name, email_address, address, phone_number, birthday, reference_id, note, preferences, groups, creation_source].hash
280
290
  end
281
291
 
282
292
  # Builds the object from hash
@@ -114,7 +114,7 @@ module SquareConnect
114
114
  category_validator = EnumAttributeValidator.new('String', ["API_ERROR", "AUTHENTICATION_ERROR", "INVALID_REQUEST_ERROR", "RATE_LIMIT_ERROR", "PAYMENT_METHOD_ERROR", "REFUND_ERROR"])
115
115
  return false unless category_validator.valid?(@category)
116
116
  return false if @code.nil?
117
- code_validator = EnumAttributeValidator.new('String', ["INTERNAL_SERVER_ERROR", "UNAUTHORIZED", "ACCESS_TOKEN_EXPIRED", "ACCESS_TOKEN_REVOKED", "FORBIDDEN", "INSUFFICIENT_SCOPES", "APPLICATION_DISABLED", "V1_APPLICATION", "V1_ACCESS_TOKEN", "CARD_PROCESSING_NOT_ENABLED", "BAD_REQUEST", "MISSING_REQUIRED_PARAMETER", "INCORRECT_TYPE", "INVALID_TIME", "INVALID_TIME_RANGE", "INVALID_VALUE", "INVALID_CURSOR", "UNKNOWN_QUERY_PARAMETER", "CONFLICTING_PARAMETERS", "EXPECTED_JSON_BODY", "INVALID_SORT_ORDER", "VALUE_REGEX_MISMATCH", "VALUE_TOO_SHORT", "VALUE_TOO_LONG", "VALUE_TOO_LOW", "VALUE_TOO_HIGH", "VALUE_EMPTY", "ARRAY_LENGTH_TOO_LONG", "ARRAY_LENGTH_TOO_SHORT", "ARRAY_EMPTY", "EXPECTED_BOOLEAN", "EXPECTED_INTEGER", "EXPECTED_FLOAT", "EXPECTED_STRING", "EXPECTED_OBJECT", "EXPECTED_ARRAY", "EXPECTED_BASE64_ENCODED_BYTE_ARRAY", "INVALID_ARRAY_VALUE", "INVALID_ENUM_VALUE", "INVALID_CONTENT_TYPE", "INVALID_FORM_VALUE", "ONE_INSTRUMENT_EXPECTED", "NO_FIELDS_SET", "DEPRECATED_FIELD_SET", "CARD_EXPIRED", "INVALID_EXPIRATION", "INVALID_EXPIRATION_YEAR", "INVALID_EXPIRATION_DATE", "UNSUPPORTED_CARD_BRAND", "UNSUPPORTED_ENTRY_METHOD", "INVALID_CARD", "DELAYED_TRANSACTION_EXPIRED", "DELAYED_TRANSACTION_CANCELED", "DELAYED_TRANSACTION_CAPTURED", "DELAYED_TRANSACTION_FAILED", "CARD_TOKEN_EXPIRED", "CARD_TOKEN_USED", "AMOUNT_TOO_HIGH", "UNSUPPORTED_INSTRUMENT_TYPE", "REFUND_AMOUNT_INVALID", "REFUND_ALREADY_PENDING", "PAYMENT_NOT_REFUNDABLE", "INVALID_CARD_DATA", "LOCATION_MISMATCH", "IDEMPOTENCY_KEY_REUSED", "UNEXPECTED_VALUE", "SANDBOX_NOT_SUPPORTED", "INVALID_EMAIL_ADDRESS", "INVALID_PHONE_NUMBER", "CHECKOUT_EXPIRED", "CARD_DECLINED", "VERIFY_CVV_FAILURE", "VERIFY_AVS_FAILURE", "CARD_DECLINED_CALL_ISSUER", "NOT_FOUND", "METHOD_NOT_ALLOWED", "REQUEST_TIMEOUT", "CONFLICT", "REQUEST_ENTITY_TOO_LARGE", "UNSUPPORTED_MEDIA_TYPE", "RATE_LIMITED", "NOT_IMPLEMENTED", "SERVICE_UNAVAILABLE", "GATEWAY_TIMEOUT"])
117
+ code_validator = EnumAttributeValidator.new('String', ["INTERNAL_SERVER_ERROR", "UNAUTHORIZED", "ACCESS_TOKEN_EXPIRED", "ACCESS_TOKEN_REVOKED", "FORBIDDEN", "INSUFFICIENT_SCOPES", "APPLICATION_DISABLED", "V1_APPLICATION", "V1_ACCESS_TOKEN", "CARD_PROCESSING_NOT_ENABLED", "BAD_REQUEST", "MISSING_REQUIRED_PARAMETER", "INCORRECT_TYPE", "INVALID_TIME", "INVALID_TIME_RANGE", "INVALID_VALUE", "INVALID_CURSOR", "UNKNOWN_QUERY_PARAMETER", "CONFLICTING_PARAMETERS", "EXPECTED_JSON_BODY", "INVALID_SORT_ORDER", "VALUE_REGEX_MISMATCH", "VALUE_TOO_SHORT", "VALUE_TOO_LONG", "VALUE_TOO_LOW", "VALUE_TOO_HIGH", "VALUE_EMPTY", "ARRAY_LENGTH_TOO_LONG", "ARRAY_LENGTH_TOO_SHORT", "ARRAY_EMPTY", "EXPECTED_BOOLEAN", "EXPECTED_INTEGER", "EXPECTED_FLOAT", "EXPECTED_STRING", "EXPECTED_OBJECT", "EXPECTED_ARRAY", "EXPECTED_BASE64_ENCODED_BYTE_ARRAY", "INVALID_ARRAY_VALUE", "INVALID_ENUM_VALUE", "INVALID_CONTENT_TYPE", "INVALID_FORM_VALUE", "ONE_INSTRUMENT_EXPECTED", "NO_FIELDS_SET", "DEPRECATED_FIELD_SET", "CARD_EXPIRED", "INVALID_EXPIRATION", "INVALID_EXPIRATION_YEAR", "INVALID_EXPIRATION_DATE", "UNSUPPORTED_CARD_BRAND", "UNSUPPORTED_ENTRY_METHOD", "INVALID_CARD", "DELAYED_TRANSACTION_EXPIRED", "DELAYED_TRANSACTION_CANCELED", "DELAYED_TRANSACTION_CAPTURED", "DELAYED_TRANSACTION_FAILED", "CARD_TOKEN_EXPIRED", "CARD_TOKEN_USED", "AMOUNT_TOO_HIGH", "UNSUPPORTED_INSTRUMENT_TYPE", "REFUND_AMOUNT_INVALID", "REFUND_ALREADY_PENDING", "PAYMENT_NOT_REFUNDABLE", "INVALID_CARD_DATA", "LOCATION_MISMATCH", "IDEMPOTENCY_KEY_REUSED", "UNEXPECTED_VALUE", "SANDBOX_NOT_SUPPORTED", "INVALID_EMAIL_ADDRESS", "INVALID_PHONE_NUMBER", "CHECKOUT_EXPIRED", "BAD_CERTIFICATE", "CARD_DECLINED", "VERIFY_CVV_FAILURE", "VERIFY_AVS_FAILURE", "CARD_DECLINED_CALL_ISSUER", "NOT_FOUND", "APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND", "METHOD_NOT_ALLOWED", "REQUEST_TIMEOUT", "CONFLICT", "REQUEST_ENTITY_TOO_LARGE", "UNSUPPORTED_MEDIA_TYPE", "RATE_LIMITED", "NOT_IMPLEMENTED", "SERVICE_UNAVAILABLE", "GATEWAY_TIMEOUT"])
118
118
  return false unless code_validator.valid?(@code)
119
119
  return true
120
120
  end
@@ -132,7 +132,7 @@ module SquareConnect
132
132
  # Custom attribute writer method checking allowed values (enum).
133
133
  # @param [Object] code Object to be assigned
134
134
  def code=(code)
135
- validator = EnumAttributeValidator.new('String', ["INTERNAL_SERVER_ERROR", "UNAUTHORIZED", "ACCESS_TOKEN_EXPIRED", "ACCESS_TOKEN_REVOKED", "FORBIDDEN", "INSUFFICIENT_SCOPES", "APPLICATION_DISABLED", "V1_APPLICATION", "V1_ACCESS_TOKEN", "CARD_PROCESSING_NOT_ENABLED", "BAD_REQUEST", "MISSING_REQUIRED_PARAMETER", "INCORRECT_TYPE", "INVALID_TIME", "INVALID_TIME_RANGE", "INVALID_VALUE", "INVALID_CURSOR", "UNKNOWN_QUERY_PARAMETER", "CONFLICTING_PARAMETERS", "EXPECTED_JSON_BODY", "INVALID_SORT_ORDER", "VALUE_REGEX_MISMATCH", "VALUE_TOO_SHORT", "VALUE_TOO_LONG", "VALUE_TOO_LOW", "VALUE_TOO_HIGH", "VALUE_EMPTY", "ARRAY_LENGTH_TOO_LONG", "ARRAY_LENGTH_TOO_SHORT", "ARRAY_EMPTY", "EXPECTED_BOOLEAN", "EXPECTED_INTEGER", "EXPECTED_FLOAT", "EXPECTED_STRING", "EXPECTED_OBJECT", "EXPECTED_ARRAY", "EXPECTED_BASE64_ENCODED_BYTE_ARRAY", "INVALID_ARRAY_VALUE", "INVALID_ENUM_VALUE", "INVALID_CONTENT_TYPE", "INVALID_FORM_VALUE", "ONE_INSTRUMENT_EXPECTED", "NO_FIELDS_SET", "DEPRECATED_FIELD_SET", "CARD_EXPIRED", "INVALID_EXPIRATION", "INVALID_EXPIRATION_YEAR", "INVALID_EXPIRATION_DATE", "UNSUPPORTED_CARD_BRAND", "UNSUPPORTED_ENTRY_METHOD", "INVALID_CARD", "DELAYED_TRANSACTION_EXPIRED", "DELAYED_TRANSACTION_CANCELED", "DELAYED_TRANSACTION_CAPTURED", "DELAYED_TRANSACTION_FAILED", "CARD_TOKEN_EXPIRED", "CARD_TOKEN_USED", "AMOUNT_TOO_HIGH", "UNSUPPORTED_INSTRUMENT_TYPE", "REFUND_AMOUNT_INVALID", "REFUND_ALREADY_PENDING", "PAYMENT_NOT_REFUNDABLE", "INVALID_CARD_DATA", "LOCATION_MISMATCH", "IDEMPOTENCY_KEY_REUSED", "UNEXPECTED_VALUE", "SANDBOX_NOT_SUPPORTED", "INVALID_EMAIL_ADDRESS", "INVALID_PHONE_NUMBER", "CHECKOUT_EXPIRED", "CARD_DECLINED", "VERIFY_CVV_FAILURE", "VERIFY_AVS_FAILURE", "CARD_DECLINED_CALL_ISSUER", "NOT_FOUND", "METHOD_NOT_ALLOWED", "REQUEST_TIMEOUT", "CONFLICT", "REQUEST_ENTITY_TOO_LARGE", "UNSUPPORTED_MEDIA_TYPE", "RATE_LIMITED", "NOT_IMPLEMENTED", "SERVICE_UNAVAILABLE", "GATEWAY_TIMEOUT"])
135
+ validator = EnumAttributeValidator.new('String', ["INTERNAL_SERVER_ERROR", "UNAUTHORIZED", "ACCESS_TOKEN_EXPIRED", "ACCESS_TOKEN_REVOKED", "FORBIDDEN", "INSUFFICIENT_SCOPES", "APPLICATION_DISABLED", "V1_APPLICATION", "V1_ACCESS_TOKEN", "CARD_PROCESSING_NOT_ENABLED", "BAD_REQUEST", "MISSING_REQUIRED_PARAMETER", "INCORRECT_TYPE", "INVALID_TIME", "INVALID_TIME_RANGE", "INVALID_VALUE", "INVALID_CURSOR", "UNKNOWN_QUERY_PARAMETER", "CONFLICTING_PARAMETERS", "EXPECTED_JSON_BODY", "INVALID_SORT_ORDER", "VALUE_REGEX_MISMATCH", "VALUE_TOO_SHORT", "VALUE_TOO_LONG", "VALUE_TOO_LOW", "VALUE_TOO_HIGH", "VALUE_EMPTY", "ARRAY_LENGTH_TOO_LONG", "ARRAY_LENGTH_TOO_SHORT", "ARRAY_EMPTY", "EXPECTED_BOOLEAN", "EXPECTED_INTEGER", "EXPECTED_FLOAT", "EXPECTED_STRING", "EXPECTED_OBJECT", "EXPECTED_ARRAY", "EXPECTED_BASE64_ENCODED_BYTE_ARRAY", "INVALID_ARRAY_VALUE", "INVALID_ENUM_VALUE", "INVALID_CONTENT_TYPE", "INVALID_FORM_VALUE", "ONE_INSTRUMENT_EXPECTED", "NO_FIELDS_SET", "DEPRECATED_FIELD_SET", "CARD_EXPIRED", "INVALID_EXPIRATION", "INVALID_EXPIRATION_YEAR", "INVALID_EXPIRATION_DATE", "UNSUPPORTED_CARD_BRAND", "UNSUPPORTED_ENTRY_METHOD", "INVALID_CARD", "DELAYED_TRANSACTION_EXPIRED", "DELAYED_TRANSACTION_CANCELED", "DELAYED_TRANSACTION_CAPTURED", "DELAYED_TRANSACTION_FAILED", "CARD_TOKEN_EXPIRED", "CARD_TOKEN_USED", "AMOUNT_TOO_HIGH", "UNSUPPORTED_INSTRUMENT_TYPE", "REFUND_AMOUNT_INVALID", "REFUND_ALREADY_PENDING", "PAYMENT_NOT_REFUNDABLE", "INVALID_CARD_DATA", "LOCATION_MISMATCH", "IDEMPOTENCY_KEY_REUSED", "UNEXPECTED_VALUE", "SANDBOX_NOT_SUPPORTED", "INVALID_EMAIL_ADDRESS", "INVALID_PHONE_NUMBER", "CHECKOUT_EXPIRED", "BAD_CERTIFICATE", "CARD_DECLINED", "VERIFY_CVV_FAILURE", "VERIFY_AVS_FAILURE", "CARD_DECLINED_CALL_ISSUER", "NOT_FOUND", "APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND", "METHOD_NOT_ALLOWED", "REQUEST_TIMEOUT", "CONFLICT", "REQUEST_ENTITY_TOO_LARGE", "UNSUPPORTED_MEDIA_TYPE", "RATE_LIMITED", "NOT_IMPLEMENTED", "SERVICE_UNAVAILABLE", "GATEWAY_TIMEOUT"])
136
136
  unless validator.valid?(code)
137
137
  fail ArgumentError, "invalid value for 'code', must be one of #{validator.allowable_values}."
138
138
  end
@@ -82,11 +82,13 @@ module SquareConnect
82
82
  INVALID_EMAIL_ADDRESS = "INVALID_EMAIL_ADDRESS".freeze
83
83
  INVALID_PHONE_NUMBER = "INVALID_PHONE_NUMBER".freeze
84
84
  CHECKOUT_EXPIRED = "CHECKOUT_EXPIRED".freeze
85
+ BAD_CERTIFICATE = "BAD_CERTIFICATE".freeze
85
86
  CARD_DECLINED = "CARD_DECLINED".freeze
86
87
  VERIFY_CVV_FAILURE = "VERIFY_CVV_FAILURE".freeze
87
88
  VERIFY_AVS_FAILURE = "VERIFY_AVS_FAILURE".freeze
88
89
  CARD_DECLINED_CALL_ISSUER = "CARD_DECLINED_CALL_ISSUER".freeze
89
90
  NOT_FOUND = "NOT_FOUND".freeze
91
+ APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND = "APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND".freeze
90
92
  METHOD_NOT_ALLOWED = "METHOD_NOT_ALLOWED".freeze
91
93
  REQUEST_TIMEOUT = "REQUEST_TIMEOUT".freeze
92
94
  CONFLICT = "CONFLICT".freeze
@@ -0,0 +1,391 @@
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
+ # Represents a change in state or quantity of product inventory at a particular time and location.
14
+ class InventoryAdjustment
15
+ # A unique ID generated by Square for the [InventoryAdjustment](#type-inventoryadjustment).
16
+ attr_accessor :id
17
+
18
+ # An optional ID provided by the application to tie the [InventoryAdjustment](#type-inventoryadjustment) to an external system.
19
+ attr_accessor :reference_id
20
+
21
+ # The [InventoryState](#type-inventorystate) of the related quantity of items before the adjustment.
22
+ attr_accessor :from_state
23
+
24
+ # The [InventoryState](#type-inventorystate) of the related quantity of items after the adjustment.
25
+ attr_accessor :to_state
26
+
27
+ # The Square ID of the [Location](#type-location) where the related quantity of items are being tracked.
28
+ attr_accessor :location_id
29
+
30
+ # The Square generated ID of the [CatalogObject](#type-catalogobject) being tracked.
31
+ attr_accessor :catalog_object_id
32
+
33
+ # The [CatalogObjectType](#type-catalogobjecttype) of the [CatalogObject](#type-catalogobject) being tracked. Tracking is only supported for the `ITEM_VARIATION` type.
34
+ attr_accessor :catalog_object_type
35
+
36
+ # The number of items affected by the adjustment as a decimal string. Fractional quantities are not supported.
37
+ attr_accessor :quantity
38
+
39
+ # The read-only total price paid for goods associated with the adjustment. Present if and only if `to_state` is `SOLD`. Always non-negative.
40
+ attr_accessor :total_price_money
41
+
42
+ # A client-generated timestamp in RFC 3339 format that indicates when the adjustment took place. For write actions, the `occurred_at` timestamp cannot be older than 24 hours or in the future relative to the time of the request.
43
+ attr_accessor :occurred_at
44
+
45
+ # A read-only timestamp in RFC 3339 format that indicates when Square received the adjustment.
46
+ attr_accessor :created_at
47
+
48
+ # Read-only information about the application that caused the inventory adjustment.
49
+ attr_accessor :source
50
+
51
+ # The Square ID of the [Employee](#type-employee) responsible for the inventory adjustment.
52
+ attr_accessor :employee_id
53
+
54
+ # The read-only Square ID of the [Transaction][#type-transaction] that caused the adjustment. Only relevant for payment-related state transitions.
55
+ attr_accessor :transaction_id
56
+
57
+ # The read-only Square ID of the [Refund][#type-refund] that caused the adjustment. Only relevant for refund-related state transitions.
58
+ attr_accessor :refund_id
59
+
60
+ # The read-only Square ID of the purchase order that caused the adjustment. Only relevant for state transitions from the Square for Retail app.
61
+ attr_accessor :purchase_order_id
62
+
63
+ # The read-only Square ID of the Square goods receipt that caused the adjustment. Only relevant for state transitions from the Square for Retail app.
64
+ attr_accessor :goods_receipt_id
65
+
66
+ class EnumAttributeValidator
67
+ attr_reader :datatype
68
+ attr_reader :allowable_values
69
+
70
+ def initialize(datatype, allowable_values)
71
+ @allowable_values = allowable_values.map do |value|
72
+ case datatype.to_s
73
+ when /Integer/i
74
+ value.to_i
75
+ when /Float/i
76
+ value.to_f
77
+ else
78
+ value
79
+ end
80
+ end
81
+ end
82
+
83
+ def valid?(value)
84
+ !value || allowable_values.include?(value)
85
+ end
86
+ end
87
+
88
+ # Attribute mapping from ruby-style variable name to JSON key.
89
+ def self.attribute_map
90
+ {
91
+ :'id' => :'id',
92
+ :'reference_id' => :'reference_id',
93
+ :'from_state' => :'from_state',
94
+ :'to_state' => :'to_state',
95
+ :'location_id' => :'location_id',
96
+ :'catalog_object_id' => :'catalog_object_id',
97
+ :'catalog_object_type' => :'catalog_object_type',
98
+ :'quantity' => :'quantity',
99
+ :'total_price_money' => :'total_price_money',
100
+ :'occurred_at' => :'occurred_at',
101
+ :'created_at' => :'created_at',
102
+ :'source' => :'source',
103
+ :'employee_id' => :'employee_id',
104
+ :'transaction_id' => :'transaction_id',
105
+ :'refund_id' => :'refund_id',
106
+ :'purchase_order_id' => :'purchase_order_id',
107
+ :'goods_receipt_id' => :'goods_receipt_id'
108
+ }
109
+ end
110
+
111
+ # Attribute type mapping.
112
+ def self.swagger_types
113
+ {
114
+ :'id' => :'String',
115
+ :'reference_id' => :'String',
116
+ :'from_state' => :'String',
117
+ :'to_state' => :'String',
118
+ :'location_id' => :'String',
119
+ :'catalog_object_id' => :'String',
120
+ :'catalog_object_type' => :'String',
121
+ :'quantity' => :'String',
122
+ :'total_price_money' => :'Money',
123
+ :'occurred_at' => :'String',
124
+ :'created_at' => :'String',
125
+ :'source' => :'SourceApplication',
126
+ :'employee_id' => :'String',
127
+ :'transaction_id' => :'String',
128
+ :'refund_id' => :'String',
129
+ :'purchase_order_id' => :'String',
130
+ :'goods_receipt_id' => :'String'
131
+ }
132
+ end
133
+
134
+ # Initializes the object
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ def initialize(attributes = {})
137
+ return unless attributes.is_a?(Hash)
138
+
139
+ # convert string to symbol for hash key
140
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
141
+
142
+ if attributes.has_key?(:'id')
143
+ self.id = attributes[:'id']
144
+ end
145
+
146
+ if attributes.has_key?(:'reference_id')
147
+ self.reference_id = attributes[:'reference_id']
148
+ end
149
+
150
+ if attributes.has_key?(:'from_state')
151
+ self.from_state = attributes[:'from_state']
152
+ end
153
+
154
+ if attributes.has_key?(:'to_state')
155
+ self.to_state = attributes[:'to_state']
156
+ end
157
+
158
+ if attributes.has_key?(:'location_id')
159
+ self.location_id = attributes[:'location_id']
160
+ end
161
+
162
+ if attributes.has_key?(:'catalog_object_id')
163
+ self.catalog_object_id = attributes[:'catalog_object_id']
164
+ end
165
+
166
+ if attributes.has_key?(:'catalog_object_type')
167
+ self.catalog_object_type = attributes[:'catalog_object_type']
168
+ end
169
+
170
+ if attributes.has_key?(:'quantity')
171
+ self.quantity = attributes[:'quantity']
172
+ end
173
+
174
+ if attributes.has_key?(:'total_price_money')
175
+ self.total_price_money = attributes[:'total_price_money']
176
+ end
177
+
178
+ if attributes.has_key?(:'occurred_at')
179
+ self.occurred_at = attributes[:'occurred_at']
180
+ end
181
+
182
+ if attributes.has_key?(:'created_at')
183
+ self.created_at = attributes[:'created_at']
184
+ end
185
+
186
+ if attributes.has_key?(:'source')
187
+ self.source = attributes[:'source']
188
+ end
189
+
190
+ if attributes.has_key?(:'employee_id')
191
+ self.employee_id = attributes[:'employee_id']
192
+ end
193
+
194
+ if attributes.has_key?(:'transaction_id')
195
+ self.transaction_id = attributes[:'transaction_id']
196
+ end
197
+
198
+ if attributes.has_key?(:'refund_id')
199
+ self.refund_id = attributes[:'refund_id']
200
+ end
201
+
202
+ if attributes.has_key?(:'purchase_order_id')
203
+ self.purchase_order_id = attributes[:'purchase_order_id']
204
+ end
205
+
206
+ if attributes.has_key?(:'goods_receipt_id')
207
+ self.goods_receipt_id = attributes[:'goods_receipt_id']
208
+ end
209
+
210
+ end
211
+
212
+ # Show invalid properties with the reasons. Usually used together with valid?
213
+ # @return Array for valid properies with the reasons
214
+ def list_invalid_properties
215
+ invalid_properties = Array.new
216
+ return invalid_properties
217
+ end
218
+
219
+ # Check to see if the all the properties in the model are valid
220
+ # @return true if the model is valid
221
+ def valid?
222
+ from_state_validator = EnumAttributeValidator.new('String', ["CUSTOM", "IN_STOCK", "SOLD", "RETURNED_BY_CUSTOMER", "RESERVED_FOR_SALE", "SOLD_ONLINE", "ORDERED_FROM_VENDOR", "RECEIVED_FROM_VENDOR", "IN_TRANSIT_TO", "NONE", "WASTE", "UNLINKED_RETURN"])
223
+ return false unless from_state_validator.valid?(@from_state)
224
+ to_state_validator = EnumAttributeValidator.new('String', ["CUSTOM", "IN_STOCK", "SOLD", "RETURNED_BY_CUSTOMER", "RESERVED_FOR_SALE", "SOLD_ONLINE", "ORDERED_FROM_VENDOR", "RECEIVED_FROM_VENDOR", "IN_TRANSIT_TO", "NONE", "WASTE", "UNLINKED_RETURN"])
225
+ return false unless to_state_validator.valid?(@to_state)
226
+ return true
227
+ end
228
+
229
+ # Custom attribute writer method checking allowed values (enum).
230
+ # @param [Object] from_state Object to be assigned
231
+ def from_state=(from_state)
232
+ validator = EnumAttributeValidator.new('String', ["CUSTOM", "IN_STOCK", "SOLD", "RETURNED_BY_CUSTOMER", "RESERVED_FOR_SALE", "SOLD_ONLINE", "ORDERED_FROM_VENDOR", "RECEIVED_FROM_VENDOR", "IN_TRANSIT_TO", "NONE", "WASTE", "UNLINKED_RETURN"])
233
+ unless validator.valid?(from_state)
234
+ fail ArgumentError, "invalid value for 'from_state', must be one of #{validator.allowable_values}."
235
+ end
236
+ @from_state = from_state
237
+ end
238
+
239
+ # Custom attribute writer method checking allowed values (enum).
240
+ # @param [Object] to_state Object to be assigned
241
+ def to_state=(to_state)
242
+ validator = EnumAttributeValidator.new('String', ["CUSTOM", "IN_STOCK", "SOLD", "RETURNED_BY_CUSTOMER", "RESERVED_FOR_SALE", "SOLD_ONLINE", "ORDERED_FROM_VENDOR", "RECEIVED_FROM_VENDOR", "IN_TRANSIT_TO", "NONE", "WASTE", "UNLINKED_RETURN"])
243
+ unless validator.valid?(to_state)
244
+ fail ArgumentError, "invalid value for 'to_state', must be one of #{validator.allowable_values}."
245
+ end
246
+ @to_state = to_state
247
+ end
248
+
249
+ # Checks equality by comparing each attribute.
250
+ # @param [Object] Object to be compared
251
+ def ==(o)
252
+ return true if self.equal?(o)
253
+ self.class == o.class &&
254
+ id == o.id &&
255
+ reference_id == o.reference_id &&
256
+ from_state == o.from_state &&
257
+ to_state == o.to_state &&
258
+ location_id == o.location_id &&
259
+ catalog_object_id == o.catalog_object_id &&
260
+ catalog_object_type == o.catalog_object_type &&
261
+ quantity == o.quantity &&
262
+ total_price_money == o.total_price_money &&
263
+ occurred_at == o.occurred_at &&
264
+ created_at == o.created_at &&
265
+ source == o.source &&
266
+ employee_id == o.employee_id &&
267
+ transaction_id == o.transaction_id &&
268
+ refund_id == o.refund_id &&
269
+ purchase_order_id == o.purchase_order_id &&
270
+ goods_receipt_id == o.goods_receipt_id
271
+ end
272
+
273
+ # @see the `==` method
274
+ # @param [Object] Object to be compared
275
+ def eql?(o)
276
+ self == o
277
+ end
278
+
279
+ # Calculates hash code according to all attributes.
280
+ # @return [Fixnum] Hash code
281
+ def hash
282
+ [id, reference_id, from_state, to_state, location_id, catalog_object_id, catalog_object_type, quantity, total_price_money, occurred_at, created_at, source, employee_id, transaction_id, refund_id, purchase_order_id, goods_receipt_id].hash
283
+ end
284
+
285
+ # Builds the object from hash
286
+ # @param [Hash] attributes Model attributes in the form of hash
287
+ # @return [Object] Returns the model itself
288
+ def build_from_hash(attributes)
289
+ return nil unless attributes.is_a?(Hash)
290
+ self.class.swagger_types.each_pair do |key, type|
291
+ if type =~ /\AArray<(.*)>/i
292
+ # check to ensure the input is an array given that the the attribute
293
+ # is documented as an array but the input is not
294
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
295
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
296
+ end
297
+ elsif !attributes[self.class.attribute_map[key]].nil?
298
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
299
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
300
+ end
301
+
302
+ self
303
+ end
304
+
305
+ # Deserializes the data based on type
306
+ # @param string type Data type
307
+ # @param string value Value to be deserialized
308
+ # @return [Object] Deserialized data
309
+ def _deserialize(type, value)
310
+ case type.to_sym
311
+ when :DateTime
312
+ DateTime.parse(value)
313
+ when :Date
314
+ Date.parse(value)
315
+ when :String
316
+ value.to_s
317
+ when :Integer
318
+ value.to_i
319
+ when :Float
320
+ value.to_f
321
+ when :BOOLEAN
322
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
323
+ true
324
+ else
325
+ false
326
+ end
327
+ when :Object
328
+ # generic object (usually a Hash), return directly
329
+ value
330
+ when /\AArray<(?<inner_type>.+)>\z/
331
+ inner_type = Regexp.last_match[:inner_type]
332
+ value.map { |v| _deserialize(inner_type, v) }
333
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
334
+ k_type = Regexp.last_match[:k_type]
335
+ v_type = Regexp.last_match[:v_type]
336
+ {}.tap do |hash|
337
+ value.each do |k, v|
338
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
339
+ end
340
+ end
341
+ else # model
342
+ temp_model = SquareConnect.const_get(type).new
343
+ temp_model.build_from_hash(value)
344
+ end
345
+ end
346
+
347
+ # Returns the string representation of the object
348
+ # @return [String] String presentation of the object
349
+ def to_s
350
+ to_hash.to_s
351
+ end
352
+
353
+ # to_body is an alias to to_hash (backward compatibility)
354
+ # @return [Hash] Returns the object in the form of hash
355
+ def to_body
356
+ to_hash
357
+ end
358
+
359
+ # Returns the object in the form of hash
360
+ # @return [Hash] Returns the object in the form of hash
361
+ def to_hash
362
+ hash = {}
363
+ self.class.attribute_map.each_pair do |attr, param|
364
+ value = self.send(attr)
365
+ next if value.nil?
366
+ hash[param] = _to_hash(value)
367
+ end
368
+ hash
369
+ end
370
+
371
+ # Outputs non-array value in the form of hash
372
+ # For object, use to_hash. Otherwise, just return the value
373
+ # @param [Object] value Any valid value
374
+ # @return [Hash] Returns the value in the form of hash
375
+ def _to_hash(value)
376
+ if value.is_a?(Array)
377
+ value.compact.map{ |v| _to_hash(v) }
378
+ elsif value.is_a?(Hash)
379
+ {}.tap do |hash|
380
+ value.each { |k, v| hash[k] = _to_hash(v) }
381
+ end
382
+ elsif value.respond_to? :to_hash
383
+ value.to_hash
384
+ else
385
+ value
386
+ end
387
+ end
388
+
389
+ end
390
+
391
+ end