tremendous_ruby 5.7.0 → 5.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tremendous/api/tremendous_api.rb +14 -14
  3. data/lib/tremendous/api_client.rb +1 -1
  4. data/lib/tremendous/api_error.rb +1 -1
  5. data/lib/tremendous/configuration.rb +1 -1
  6. data/lib/tremendous/models/allow_email.rb +1 -1
  7. data/lib/tremendous/models/allow_email1.rb +1 -1
  8. data/lib/tremendous/models/allow_ip.rb +1 -1
  9. data/lib/tremendous/models/allow_ip1.rb +1 -1
  10. data/lib/tremendous/models/balance_transaction.rb +14 -5
  11. data/lib/tremendous/models/balance_transaction_order.rb +256 -0
  12. data/lib/tremendous/models/balance_transaction_order_payment.rb +358 -0
  13. data/lib/tremendous/models/base_order_for_create.rb +1 -1
  14. data/lib/tremendous/models/campaign.rb +1 -1
  15. data/lib/tremendous/models/campaign_base.rb +1 -1
  16. data/lib/tremendous/models/channel.rb +1 -1
  17. data/lib/tremendous/models/create_api_key200_response.rb +1 -1
  18. data/lib/tremendous/models/create_campaign201_response.rb +1 -1
  19. data/lib/tremendous/models/create_campaign_request.rb +1 -1
  20. data/lib/tremendous/models/create_invoice200_response.rb +1 -1
  21. data/lib/tremendous/models/create_invoice_request.rb +1 -1
  22. data/lib/tremendous/models/create_member.rb +1 -1
  23. data/lib/tremendous/models/create_member200_response.rb +1 -1
  24. data/lib/tremendous/models/create_member_request.rb +1 -1
  25. data/lib/tremendous/models/create_order200_response.rb +1 -1
  26. data/lib/tremendous/models/create_order200_response_order.rb +1 -1
  27. data/lib/tremendous/models/create_order200_response_order_rewards_inner.rb +1 -1
  28. data/lib/tremendous/models/create_order200_response_order_rewards_inner_delivery.rb +1 -1
  29. data/lib/tremendous/models/create_order_request.rb +1 -1
  30. data/lib/tremendous/models/create_organization.rb +1 -1
  31. data/lib/tremendous/models/create_organization200_response.rb +1 -1
  32. data/lib/tremendous/models/create_organization200_response_organization.rb +1 -1
  33. data/lib/tremendous/models/create_organization_for_response.rb +1 -1
  34. data/lib/tremendous/models/create_organization_properties.rb +1 -1
  35. data/lib/tremendous/models/create_organization_request.rb +1 -1
  36. data/lib/tremendous/models/create_organization_request_copy_settings.rb +1 -1
  37. data/lib/tremendous/models/create_report201_response.rb +1 -1
  38. data/lib/tremendous/models/create_report201_response_report.rb +2 -2
  39. data/lib/tremendous/models/create_report_request.rb +1 -1
  40. data/lib/tremendous/models/create_report_request_filters.rb +1 -1
  41. data/lib/tremendous/models/create_report_request_filters_digital_rewards.rb +1 -1
  42. data/lib/tremendous/models/create_report_request_filters_digital_rewards_amount.rb +1 -1
  43. data/lib/tremendous/models/create_report_request_filters_digital_rewards_created_at.rb +1 -1
  44. data/lib/tremendous/models/create_webhook200_response.rb +1 -1
  45. data/lib/tremendous/models/create_webhook_request.rb +1 -1
  46. data/lib/tremendous/models/currency_codes.rb +1 -1
  47. data/lib/tremendous/models/custom_field.rb +1 -1
  48. data/lib/tremendous/models/delete_fraud_rule200_response.rb +1 -1
  49. data/lib/tremendous/models/delivery_details.rb +1 -1
  50. data/lib/tremendous/models/delivery_details_with_link.rb +1 -1
  51. data/lib/tremendous/models/delivery_metadata.rb +236 -0
  52. data/lib/tremendous/models/delivery_method.rb +1 -1
  53. data/lib/tremendous/models/delivery_status.rb +1 -1
  54. data/lib/tremendous/models/error_model.rb +1 -1
  55. data/lib/tremendous/models/field.rb +1 -1
  56. data/lib/tremendous/models/fraud_config_allow_email.rb +1 -1
  57. data/lib/tremendous/models/fraud_config_country.rb +1 -1
  58. data/lib/tremendous/models/fraud_config_country_update_list.rb +1 -1
  59. data/lib/tremendous/models/fraud_config_ip.rb +1 -1
  60. data/lib/tremendous/models/fraud_config_redeemed_rewards_amount.rb +1 -1
  61. data/lib/tremendous/models/fraud_config_redeemed_rewards_count.rb +1 -1
  62. data/lib/tremendous/models/fraud_config_review_email.rb +1 -1
  63. data/lib/tremendous/models/fraud_generic_response.rb +1 -1
  64. data/lib/tremendous/models/fraud_review.rb +25 -3
  65. data/lib/tremendous/models/fraud_review_geo.rb +1 -1
  66. data/lib/tremendous/models/fraud_review_list_item.rb +2 -2
  67. data/lib/tremendous/models/fraud_review_reason.rb +3 -2
  68. data/lib/tremendous/models/fraud_review_redemption_method.rb +1 -1
  69. data/lib/tremendous/models/fraud_review_related_rewards.rb +1 -1
  70. data/lib/tremendous/models/fraud_review_risk.rb +41 -0
  71. data/lib/tremendous/models/fraud_review_status.rb +1 -1
  72. data/lib/tremendous/models/fraud_rule200_response.rb +1 -1
  73. data/lib/tremendous/models/fraud_rule400_response.rb +1 -1
  74. data/lib/tremendous/models/fraud_rule422_response.rb +1 -1
  75. data/lib/tremendous/models/fraud_rule_request.rb +1 -1
  76. data/lib/tremendous/models/fraud_rule_request_config.rb +1 -1
  77. data/lib/tremendous/models/fraud_rule_type.rb +1 -1
  78. data/lib/tremendous/models/fraud_rules_list_item.rb +1 -1
  79. data/lib/tremendous/models/funding_source.rb +1 -1
  80. data/lib/tremendous/models/generate_reward_link200_response.rb +1 -1
  81. data/lib/tremendous/models/generate_reward_link200_response_reward.rb +1 -1
  82. data/lib/tremendous/models/generate_reward_link403_response.rb +1 -1
  83. data/lib/tremendous/models/generate_reward_token200_response.rb +1 -1
  84. data/lib/tremendous/models/generate_reward_token200_response_reward.rb +1 -1
  85. data/lib/tremendous/models/get_fraud_review200_response.rb +1 -1
  86. data/lib/tremendous/models/get_fraud_review200_response_fraud_review.rb +25 -3
  87. data/lib/tremendous/models/get_fraud_review200_response_fraud_review_geo.rb +1 -1
  88. data/lib/tremendous/models/get_fraud_review200_response_fraud_review_related_rewards.rb +1 -1
  89. data/lib/tremendous/models/get_funding_source200_response.rb +1 -1
  90. data/lib/tremendous/models/get_member200_response.rb +1 -1
  91. data/lib/tremendous/models/get_member200_response_member.rb +1 -1
  92. data/lib/tremendous/models/get_member200_response_member_events_inner.rb +1 -1
  93. data/lib/tremendous/models/get_order200_response.rb +221 -0
  94. data/lib/tremendous/models/get_organization200_response.rb +1 -1
  95. data/lib/tremendous/models/get_product_response.rb +1 -1
  96. data/lib/tremendous/models/get_reward200_response.rb +1 -1
  97. data/lib/tremendous/models/invoice.rb +1 -1
  98. data/lib/tremendous/models/list_balance_transactions200_response.rb +1 -1
  99. data/lib/tremendous/models/list_balance_transactions200_response_transactions_inner.rb +14 -5
  100. data/lib/tremendous/models/list_balance_transactions200_response_transactions_inner_order.rb +256 -0
  101. data/lib/tremendous/models/list_balance_transactions200_response_transactions_inner_order_payment.rb +358 -0
  102. data/lib/tremendous/models/list_campaigns200_response.rb +1 -1
  103. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner.rb +1 -1
  104. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner_email_style.rb +2 -2
  105. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner_webpage_style.rb +3 -3
  106. data/lib/tremendous/models/list_fields200_response.rb +1 -1
  107. data/lib/tremendous/models/list_fields200_response_fields_inner.rb +1 -1
  108. data/lib/tremendous/models/list_forex_response.rb +1 -1
  109. data/lib/tremendous/models/list_fraud_reviews200_response.rb +1 -1
  110. data/lib/tremendous/models/list_fraud_reviews200_response_fraud_reviews_inner.rb +2 -2
  111. data/lib/tremendous/models/list_fraud_rules200_response.rb +1 -1
  112. data/lib/tremendous/models/list_fraud_rules200_response_fraud_rules_inner.rb +1 -1
  113. data/lib/tremendous/models/list_funding_sources200_response.rb +1 -1
  114. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner.rb +1 -1
  115. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb +1 -1
  116. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta_failure_details.rb +1 -1
  117. data/lib/tremendous/models/list_invoices200_response.rb +1 -1
  118. data/lib/tremendous/models/list_invoices200_response_invoices_inner.rb +1 -1
  119. data/lib/tremendous/models/list_members200_response.rb +1 -1
  120. data/lib/tremendous/models/list_members200_response_members_inner.rb +1 -1
  121. data/lib/tremendous/models/list_orders200_response.rb +1 -1
  122. data/lib/tremendous/models/list_orders200_response_orders_inner.rb +1 -1
  123. data/lib/tremendous/models/list_orders200_response_orders_inner_payment.rb +65 -8
  124. data/lib/tremendous/models/list_orders200_response_orders_inner_payment_refund.rb +1 -1
  125. data/lib/tremendous/models/list_organizations200_response.rb +1 -1
  126. data/lib/tremendous/models/list_organizations200_response_organizations_inner.rb +1 -1
  127. data/lib/tremendous/models/list_products_response.rb +1 -1
  128. data/lib/tremendous/models/list_products_response_products_inner.rb +3 -3
  129. data/lib/tremendous/models/list_products_response_products_inner_countries_inner.rb +1 -1
  130. data/lib/tremendous/models/list_products_response_products_inner_images_inner.rb +1 -1
  131. data/lib/tremendous/models/list_products_response_products_inner_skus_inner.rb +1 -1
  132. data/lib/tremendous/models/list_rewards200_response.rb +1 -1
  133. data/lib/tremendous/models/list_rewards200_response_rewards_inner.rb +1 -1
  134. data/lib/tremendous/models/list_rewards200_response_rewards_inner_custom_fields_inner.rb +1 -1
  135. data/lib/tremendous/models/list_rewards200_response_rewards_inner_delivery.rb +1 -1
  136. data/lib/tremendous/models/list_rewards200_response_rewards_inner_recipient.rb +1 -1
  137. data/lib/tremendous/models/list_rewards200_response_rewards_inner_value.rb +1 -1
  138. data/lib/tremendous/models/list_rewards401_response.rb +1 -1
  139. data/lib/tremendous/models/list_rewards401_response_errors.rb +1 -1
  140. data/lib/tremendous/models/list_rewards429_response.rb +1 -1
  141. data/lib/tremendous/models/list_roles200_response.rb +1 -1
  142. data/lib/tremendous/models/list_roles200_response_roles_inner.rb +1 -1
  143. data/lib/tremendous/models/list_webhook_events200_response.rb +1 -1
  144. data/lib/tremendous/models/list_webhooks200_response.rb +1 -1
  145. data/lib/tremendous/models/list_webhooks200_response_webhooks_inner.rb +1 -1
  146. data/lib/tremendous/models/member.rb +1 -1
  147. data/lib/tremendous/models/member_base.rb +1 -1
  148. data/lib/tremendous/models/member_with_events.rb +1 -1
  149. data/lib/tremendous/models/member_without_events.rb +1 -1
  150. data/lib/tremendous/models/order.rb +1 -1
  151. data/lib/tremendous/models/order_base.rb +1 -1
  152. data/lib/tremendous/models/order_base_payment.rb +65 -8
  153. data/lib/tremendous/models/order_status.rb +1 -1
  154. data/lib/tremendous/models/order_with_link.rb +1 -1
  155. data/lib/tremendous/models/order_with_link_rewards_inner.rb +1 -1
  156. data/lib/tremendous/models/order_without_link.rb +1 -1
  157. data/lib/tremendous/models/order_without_link_rewards_inner.rb +1 -1
  158. data/lib/tremendous/models/organization.rb +1 -1
  159. data/lib/tremendous/models/payment_details.rb +65 -8
  160. data/lib/tremendous/models/payment_details_refund.rb +1 -1
  161. data/lib/tremendous/models/payout.rb +1 -1
  162. data/lib/tremendous/models/product.rb +3 -3
  163. data/lib/tremendous/models/recipient.rb +1 -1
  164. data/lib/tremendous/models/refund_details.rb +1 -1
  165. data/lib/tremendous/models/report.rb +2 -2
  166. data/lib/tremendous/models/resend_reward422_response.rb +1 -1
  167. data/lib/tremendous/models/resend_reward_request.rb +1 -1
  168. data/lib/tremendous/models/review_country.rb +1 -1
  169. data/lib/tremendous/models/review_country1.rb +1 -1
  170. data/lib/tremendous/models/review_email.rb +1 -1
  171. data/lib/tremendous/models/review_email1.rb +1 -1
  172. data/lib/tremendous/models/review_ip.rb +1 -1
  173. data/lib/tremendous/models/review_ip1.rb +1 -1
  174. data/lib/tremendous/models/review_redeemed_rewards_amount.rb +1 -1
  175. data/lib/tremendous/models/review_redeemed_rewards_count.rb +1 -1
  176. data/lib/tremendous/models/reward.rb +1 -1
  177. data/lib/tremendous/models/reward_base.rb +1 -1
  178. data/lib/tremendous/models/reward_base_custom_fields_inner.rb +1 -1
  179. data/lib/tremendous/models/reward_for_order_create.rb +1 -1
  180. data/lib/tremendous/models/reward_link.rb +1 -1
  181. data/lib/tremendous/models/reward_token.rb +1 -1
  182. data/lib/tremendous/models/reward_value.rb +1 -1
  183. data/lib/tremendous/models/reward_with_link.rb +1 -1
  184. data/lib/tremendous/models/reward_with_link_delivery.rb +1 -1
  185. data/lib/tremendous/models/reward_without_link.rb +1 -1
  186. data/lib/tremendous/models/reward_without_link_delivery.rb +1 -1
  187. data/lib/tremendous/models/role.rb +1 -1
  188. data/lib/tremendous/models/simulate_webhook_request.rb +1 -1
  189. data/lib/tremendous/models/single_reward_order.rb +1 -1
  190. data/lib/tremendous/models/single_reward_order_payment.rb +1 -1
  191. data/lib/tremendous/models/single_reward_order_reward.rb +1 -1
  192. data/lib/tremendous/models/single_reward_order_reward_custom_fields_inner.rb +1 -1
  193. data/lib/tremendous/models/single_reward_order_reward_delivery.rb +14 -5
  194. data/lib/tremendous/models/single_reward_order_reward_delivery_meta.rb +236 -0
  195. data/lib/tremendous/models/single_reward_order_with_link.rb +1 -1
  196. data/lib/tremendous/models/single_reward_order_with_link_order.rb +1 -1
  197. data/lib/tremendous/models/single_reward_order_without_link.rb +1 -1
  198. data/lib/tremendous/models/single_reward_order_without_link_order.rb +1 -1
  199. data/lib/tremendous/models/update_campaign.rb +1 -1
  200. data/lib/tremendous/models/update_campaign_request.rb +1 -1
  201. data/lib/tremendous/models/update_fraud_rule_list200_response.rb +1 -1
  202. data/lib/tremendous/models/update_fraud_rule_list_request.rb +1 -1
  203. data/lib/tremendous/models/update_fraud_rule_list_request_config.rb +1 -1
  204. data/lib/tremendous/models/webhook.rb +1 -1
  205. data/lib/tremendous/models/webhook_post.rb +1 -1
  206. data/lib/tremendous/version.rb +1 -1
  207. data/lib/tremendous.rb +9 -2
  208. metadata +11 -3
@@ -0,0 +1,256 @@
1
+ =begin
2
+ #API Endpoints
3
+
4
+ #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and its members within Tremendous, please see the Tremendous Organizational API.
5
+
6
+ The version of the OpenAPI document: 2
7
+ Contact: developers@tremendous.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Tremendous
17
+ # Order details
18
+ class BalanceTransactionOrder
19
+ attr_accessor :id
20
+
21
+ # Reference for this order, supplied by the customer. When set, `external_id` makes order idempotent. All requests that use the same `external_id` after the initial order creation, will result in a response that returns the data of the initially created order. The response will have a `201` response code. These responses **fail** to create any further orders. It also allows for retrieving by `external_id` instead of `id` only.
22
+ attr_accessor :external_id
23
+
24
+ attr_accessor :payment
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'id' => :'id',
30
+ :'external_id' => :'external_id',
31
+ :'payment' => :'payment'
32
+ }
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'id' => :'String',
44
+ :'external_id' => :'String',
45
+ :'payment' => :'BalanceTransactionOrderPayment'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ :'external_id',
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::BalanceTransactionOrder` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::BalanceTransactionOrder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'id')
72
+ self.id = attributes[:'id']
73
+ end
74
+
75
+ if attributes.key?(:'external_id')
76
+ self.external_id = attributes[:'external_id']
77
+ end
78
+
79
+ if attributes.key?(:'payment')
80
+ self.payment = attributes[:'payment']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
88
+ invalid_properties = Array.new
89
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
90
+ if !@id.nil? && @id !~ pattern
91
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
92
+ end
93
+
94
+ invalid_properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ warn '[DEPRECATED] the `valid?` method is obsolete'
101
+ return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
102
+ true
103
+ end
104
+
105
+ # Custom attribute writer method with validation
106
+ # @param [Object] id Value to be assigned
107
+ def id=(id)
108
+ if id.nil?
109
+ fail ArgumentError, 'id cannot be nil'
110
+ end
111
+
112
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
113
+ if id !~ pattern
114
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
115
+ end
116
+
117
+ @id = id
118
+ end
119
+
120
+ # Checks equality by comparing each attribute.
121
+ # @param [Object] Object to be compared
122
+ def ==(o)
123
+ return true if self.equal?(o)
124
+ self.class == o.class &&
125
+ id == o.id &&
126
+ external_id == o.external_id &&
127
+ payment == o.payment
128
+ end
129
+
130
+ # @see the `==` method
131
+ # @param [Object] Object to be compared
132
+ def eql?(o)
133
+ self == o
134
+ end
135
+
136
+ # Calculates hash code according to all attributes.
137
+ # @return [Integer] Hash code
138
+ def hash
139
+ [id, external_id, payment].hash
140
+ end
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def self.build_from_hash(attributes)
146
+ return nil unless attributes.is_a?(Hash)
147
+ attributes = attributes.transform_keys(&:to_sym)
148
+ transformed_hash = {}
149
+ openapi_types.each_pair do |key, type|
150
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
151
+ transformed_hash["#{key}"] = nil
152
+ elsif type =~ /\AArray<(.*)>/i
153
+ # check to ensure the input is an array given that the attribute
154
+ # is documented as an array but the input is not
155
+ if attributes[attribute_map[key]].is_a?(Array)
156
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
157
+ end
158
+ elsif !attributes[attribute_map[key]].nil?
159
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
160
+ end
161
+ end
162
+ new(transformed_hash)
163
+ end
164
+
165
+ # Deserializes the data based on type
166
+ # @param string type Data type
167
+ # @param string value Value to be deserialized
168
+ # @return [Object] Deserialized data
169
+ def self._deserialize(type, value)
170
+ case type.to_sym
171
+ when :Time
172
+ Time.parse(value)
173
+ when :Date
174
+ Date.parse(value)
175
+ when :String
176
+ value.to_s
177
+ when :Integer
178
+ value.to_i
179
+ when :Float
180
+ value.to_f
181
+ when :Boolean
182
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
+ true
184
+ else
185
+ false
186
+ end
187
+ when :Object
188
+ # generic object (usually a Hash), return directly
189
+ value
190
+ when /\AArray<(?<inner_type>.+)>\z/
191
+ inner_type = Regexp.last_match[:inner_type]
192
+ value.map { |v| _deserialize(inner_type, v) }
193
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
+ k_type = Regexp.last_match[:k_type]
195
+ v_type = Regexp.last_match[:v_type]
196
+ {}.tap do |hash|
197
+ value.each do |k, v|
198
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
+ end
200
+ end
201
+ else # model
202
+ # models (e.g. Pet) or oneOf
203
+ klass = Tremendous.const_get(type)
204
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
205
+ end
206
+ end
207
+
208
+ # Returns the string representation of the object
209
+ # @return [String] String presentation of the object
210
+ def to_s
211
+ to_hash.to_s
212
+ end
213
+
214
+ # to_body is an alias to to_hash (backward compatibility)
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_body
217
+ to_hash
218
+ end
219
+
220
+ # Returns the object in the form of hash
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_hash
223
+ hash = {}
224
+ self.class.attribute_map.each_pair do |attr, param|
225
+ value = self.send(attr)
226
+ if value.nil?
227
+ is_nullable = self.class.openapi_nullable.include?(attr)
228
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
+ end
230
+
231
+ hash[param] = _to_hash(value)
232
+ end
233
+ hash
234
+ end
235
+
236
+ # Outputs non-array value in the form of hash
237
+ # For object, use to_hash. Otherwise, just return the value
238
+ # @param [Object] value Any valid value
239
+ # @return [Hash] Returns the value in the form of hash
240
+ def _to_hash(value)
241
+ if value.is_a?(Array)
242
+ value.compact.map { |v| _to_hash(v) }
243
+ elsif value.is_a?(Hash)
244
+ {}.tap do |hash|
245
+ value.each { |k, v| hash[k] = _to_hash(v) }
246
+ end
247
+ elsif value.respond_to? :to_hash
248
+ value.to_hash
249
+ else
250
+ value
251
+ end
252
+ end
253
+
254
+ end
255
+
256
+ end
@@ -0,0 +1,358 @@
1
+ =begin
2
+ #API Endpoints
3
+
4
+ #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and its members within Tremendous, please see the Tremendous Organizational API.
5
+
6
+ The version of the OpenAPI document: 2
7
+ Contact: developers@tremendous.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Tremendous
17
+ class BalanceTransactionOrderPayment
18
+ # Total price of the order before fees (in USD)
19
+ attr_accessor :subtotal
20
+
21
+ # Total price of the order including fees (in USD)
22
+ attr_accessor :total
23
+
24
+ # Fees for the order (in USD)
25
+ attr_accessor :fees
26
+
27
+ # Discount for the order (in USD)
28
+ attr_accessor :discount
29
+
30
+ attr_accessor :refund
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'subtotal' => :'subtotal',
36
+ :'total' => :'total',
37
+ :'fees' => :'fees',
38
+ :'discount' => :'discount',
39
+ :'refund' => :'refund'
40
+ }
41
+ end
42
+
43
+ # Returns all the JSON keys this model knows about
44
+ def self.acceptable_attributes
45
+ attribute_map.values
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.openapi_types
50
+ {
51
+ :'subtotal' => :'Float',
52
+ :'total' => :'Float',
53
+ :'fees' => :'Float',
54
+ :'discount' => :'Float',
55
+ :'refund' => :'PaymentDetailsRefund'
56
+ }
57
+ end
58
+
59
+ # List of attributes with nullable: true
60
+ def self.openapi_nullable
61
+ Set.new([
62
+ ])
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ if (!attributes.is_a?(Hash))
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::BalanceTransactionOrderPayment` initialize method"
70
+ end
71
+
72
+ # check to see if the attribute exists and convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}) { |(k, v), h|
74
+ if (!self.class.attribute_map.key?(k.to_sym))
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::BalanceTransactionOrderPayment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
76
+ end
77
+ h[k.to_sym] = v
78
+ }
79
+
80
+ if attributes.key?(:'subtotal')
81
+ self.subtotal = attributes[:'subtotal']
82
+ else
83
+ self.subtotal = nil
84
+ end
85
+
86
+ if attributes.key?(:'total')
87
+ self.total = attributes[:'total']
88
+ else
89
+ self.total = nil
90
+ end
91
+
92
+ if attributes.key?(:'fees')
93
+ self.fees = attributes[:'fees']
94
+ else
95
+ self.fees = nil
96
+ end
97
+
98
+ if attributes.key?(:'discount')
99
+ self.discount = attributes[:'discount']
100
+ else
101
+ self.discount = nil
102
+ end
103
+
104
+ if attributes.key?(:'refund')
105
+ self.refund = attributes[:'refund']
106
+ end
107
+ end
108
+
109
+ # Show invalid properties with the reasons. Usually used together with valid?
110
+ # @return Array for valid properties with the reasons
111
+ def list_invalid_properties
112
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
113
+ invalid_properties = Array.new
114
+ if @subtotal.nil?
115
+ invalid_properties.push('invalid value for "subtotal", subtotal cannot be nil.')
116
+ end
117
+
118
+ if @subtotal < 0
119
+ invalid_properties.push('invalid value for "subtotal", must be greater than or equal to 0.')
120
+ end
121
+
122
+ if @total.nil?
123
+ invalid_properties.push('invalid value for "total", total cannot be nil.')
124
+ end
125
+
126
+ if @total < 0
127
+ invalid_properties.push('invalid value for "total", must be greater than or equal to 0.')
128
+ end
129
+
130
+ if @fees.nil?
131
+ invalid_properties.push('invalid value for "fees", fees cannot be nil.')
132
+ end
133
+
134
+ if @fees < 0
135
+ invalid_properties.push('invalid value for "fees", must be greater than or equal to 0.')
136
+ end
137
+
138
+ if @discount.nil?
139
+ invalid_properties.push('invalid value for "discount", discount cannot be nil.')
140
+ end
141
+
142
+ if @discount < 0
143
+ invalid_properties.push('invalid value for "discount", must be greater than or equal to 0.')
144
+ end
145
+
146
+ invalid_properties
147
+ end
148
+
149
+ # Check to see if the all the properties in the model are valid
150
+ # @return true if the model is valid
151
+ def valid?
152
+ warn '[DEPRECATED] the `valid?` method is obsolete'
153
+ return false if @subtotal.nil?
154
+ return false if @subtotal < 0
155
+ return false if @total.nil?
156
+ return false if @total < 0
157
+ return false if @fees.nil?
158
+ return false if @fees < 0
159
+ return false if @discount.nil?
160
+ return false if @discount < 0
161
+ true
162
+ end
163
+
164
+ # Custom attribute writer method with validation
165
+ # @param [Object] subtotal Value to be assigned
166
+ def subtotal=(subtotal)
167
+ if subtotal.nil?
168
+ fail ArgumentError, 'subtotal cannot be nil'
169
+ end
170
+
171
+ if subtotal < 0
172
+ fail ArgumentError, 'invalid value for "subtotal", must be greater than or equal to 0.'
173
+ end
174
+
175
+ @subtotal = subtotal
176
+ end
177
+
178
+ # Custom attribute writer method with validation
179
+ # @param [Object] total Value to be assigned
180
+ def total=(total)
181
+ if total.nil?
182
+ fail ArgumentError, 'total cannot be nil'
183
+ end
184
+
185
+ if total < 0
186
+ fail ArgumentError, 'invalid value for "total", must be greater than or equal to 0.'
187
+ end
188
+
189
+ @total = total
190
+ end
191
+
192
+ # Custom attribute writer method with validation
193
+ # @param [Object] fees Value to be assigned
194
+ def fees=(fees)
195
+ if fees.nil?
196
+ fail ArgumentError, 'fees cannot be nil'
197
+ end
198
+
199
+ if fees < 0
200
+ fail ArgumentError, 'invalid value for "fees", must be greater than or equal to 0.'
201
+ end
202
+
203
+ @fees = fees
204
+ end
205
+
206
+ # Custom attribute writer method with validation
207
+ # @param [Object] discount Value to be assigned
208
+ def discount=(discount)
209
+ if discount.nil?
210
+ fail ArgumentError, 'discount cannot be nil'
211
+ end
212
+
213
+ if discount < 0
214
+ fail ArgumentError, 'invalid value for "discount", must be greater than or equal to 0.'
215
+ end
216
+
217
+ @discount = discount
218
+ end
219
+
220
+ # Checks equality by comparing each attribute.
221
+ # @param [Object] Object to be compared
222
+ def ==(o)
223
+ return true if self.equal?(o)
224
+ self.class == o.class &&
225
+ subtotal == o.subtotal &&
226
+ total == o.total &&
227
+ fees == o.fees &&
228
+ discount == o.discount &&
229
+ refund == o.refund
230
+ end
231
+
232
+ # @see the `==` method
233
+ # @param [Object] Object to be compared
234
+ def eql?(o)
235
+ self == o
236
+ end
237
+
238
+ # Calculates hash code according to all attributes.
239
+ # @return [Integer] Hash code
240
+ def hash
241
+ [subtotal, total, fees, discount, refund].hash
242
+ end
243
+
244
+ # Builds the object from hash
245
+ # @param [Hash] attributes Model attributes in the form of hash
246
+ # @return [Object] Returns the model itself
247
+ def self.build_from_hash(attributes)
248
+ return nil unless attributes.is_a?(Hash)
249
+ attributes = attributes.transform_keys(&:to_sym)
250
+ transformed_hash = {}
251
+ openapi_types.each_pair do |key, type|
252
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
253
+ transformed_hash["#{key}"] = nil
254
+ elsif type =~ /\AArray<(.*)>/i
255
+ # check to ensure the input is an array given that the attribute
256
+ # is documented as an array but the input is not
257
+ if attributes[attribute_map[key]].is_a?(Array)
258
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
259
+ end
260
+ elsif !attributes[attribute_map[key]].nil?
261
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
262
+ end
263
+ end
264
+ new(transformed_hash)
265
+ end
266
+
267
+ # Deserializes the data based on type
268
+ # @param string type Data type
269
+ # @param string value Value to be deserialized
270
+ # @return [Object] Deserialized data
271
+ def self._deserialize(type, value)
272
+ case type.to_sym
273
+ when :Time
274
+ Time.parse(value)
275
+ when :Date
276
+ Date.parse(value)
277
+ when :String
278
+ value.to_s
279
+ when :Integer
280
+ value.to_i
281
+ when :Float
282
+ value.to_f
283
+ when :Boolean
284
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
285
+ true
286
+ else
287
+ false
288
+ end
289
+ when :Object
290
+ # generic object (usually a Hash), return directly
291
+ value
292
+ when /\AArray<(?<inner_type>.+)>\z/
293
+ inner_type = Regexp.last_match[:inner_type]
294
+ value.map { |v| _deserialize(inner_type, v) }
295
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
296
+ k_type = Regexp.last_match[:k_type]
297
+ v_type = Regexp.last_match[:v_type]
298
+ {}.tap do |hash|
299
+ value.each do |k, v|
300
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
301
+ end
302
+ end
303
+ else # model
304
+ # models (e.g. Pet) or oneOf
305
+ klass = Tremendous.const_get(type)
306
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
307
+ end
308
+ end
309
+
310
+ # Returns the string representation of the object
311
+ # @return [String] String presentation of the object
312
+ def to_s
313
+ to_hash.to_s
314
+ end
315
+
316
+ # to_body is an alias to to_hash (backward compatibility)
317
+ # @return [Hash] Returns the object in the form of hash
318
+ def to_body
319
+ to_hash
320
+ end
321
+
322
+ # Returns the object in the form of hash
323
+ # @return [Hash] Returns the object in the form of hash
324
+ def to_hash
325
+ hash = {}
326
+ self.class.attribute_map.each_pair do |attr, param|
327
+ value = self.send(attr)
328
+ if value.nil?
329
+ is_nullable = self.class.openapi_nullable.include?(attr)
330
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
331
+ end
332
+
333
+ hash[param] = _to_hash(value)
334
+ end
335
+ hash
336
+ end
337
+
338
+ # Outputs non-array value in the form of hash
339
+ # For object, use to_hash. Otherwise, just return the value
340
+ # @param [Object] value Any valid value
341
+ # @return [Hash] Returns the value in the form of hash
342
+ def _to_hash(value)
343
+ if value.is_a?(Array)
344
+ value.compact.map { |v| _to_hash(v) }
345
+ elsif value.is_a?(Hash)
346
+ {}.tap do |hash|
347
+ value.each { |k, v| hash[k] = _to_hash(v) }
348
+ end
349
+ elsif value.respond_to? :to_hash
350
+ value.to_hash
351
+ else
352
+ value
353
+ end
354
+ end
355
+
356
+ end
357
+
358
+ end
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #API Endpoints
3
3
 
4
- #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API.
4
+ #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and its members within Tremendous, please see the Tremendous Organizational API.
5
5
 
6
6
  The version of the OpenAPI document: 2
7
7
  Contact: developers@tremendous.com
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #API Endpoints
3
3
 
4
- #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API.
4
+ #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and its members within Tremendous, please see the Tremendous Organizational API.
5
5
 
6
6
  The version of the OpenAPI document: 2
7
7
  Contact: developers@tremendous.com
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #API Endpoints
3
3
 
4
- #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API.
4
+ #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and its members within Tremendous, please see the Tremendous Organizational API.
5
5
 
6
6
  The version of the OpenAPI document: 2
7
7
  Contact: developers@tremendous.com
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #API Endpoints
3
3
 
4
- #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API.
4
+ #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and its members within Tremendous, please see the Tremendous Organizational API.
5
5
 
6
6
  The version of the OpenAPI document: 2
7
7
  Contact: developers@tremendous.com
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #API Endpoints
3
3
 
4
- #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API.
4
+ #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and its members within Tremendous, please see the Tremendous Organizational API.
5
5
 
6
6
  The version of the OpenAPI document: 2
7
7
  Contact: developers@tremendous.com
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #API Endpoints
3
3
 
4
- #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API.
4
+ #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and its members within Tremendous, please see the Tremendous Organizational API.
5
5
 
6
6
  The version of the OpenAPI document: 2
7
7
  Contact: developers@tremendous.com
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #API Endpoints
3
3
 
4
- #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API.
4
+ #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and its members within Tremendous, please see the Tremendous Organizational API.
5
5
 
6
6
  The version of the OpenAPI document: 2
7
7
  Contact: developers@tremendous.com
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #API Endpoints
3
3
 
4
- #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API.
4
+ #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and its members within Tremendous, please see the Tremendous Organizational API.
5
5
 
6
6
  The version of the OpenAPI document: 2
7
7
  Contact: developers@tremendous.com