billabear 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +509 -364
  3. data/billabear.gemspec +4 -4
  4. data/docs/Address.md +1 -1
  5. data/docs/BillingAdmin.md +1 -1
  6. data/docs/CheckoutApi.md +6 -6
  7. data/docs/CheckoutBody.md +1 -1
  8. data/docs/CheckoutItems.md +1 -1
  9. data/docs/CheckoutSubscriptions.md +1 -1
  10. data/docs/Cost.md +8 -0
  11. data/docs/Customer.md +3 -1
  12. data/docs/CustomerIdUasgelimitBody.md +8 -0
  13. data/docs/CustomersApi.md +319 -101
  14. data/docs/Error.md +1 -1
  15. data/docs/Event.md +11 -0
  16. data/docs/Feature.md +1 -1
  17. data/docs/FrontendToken.md +1 -1
  18. data/docs/InlineResponse200.md +1 -1
  19. data/docs/InlineResponse2001.md +3 -4
  20. data/docs/InlineResponse20010.md +2 -2
  21. data/docs/InlineResponse20011.md +4 -2
  22. data/docs/InlineResponse20012.md +4 -3
  23. data/docs/InlineResponse20013.md +7 -0
  24. data/docs/InlineResponse20014.md +8 -0
  25. data/docs/InlineResponse2002.md +4 -4
  26. data/docs/InlineResponse2003.md +2 -2
  27. data/docs/InlineResponse2004.md +2 -2
  28. data/docs/InlineResponse2005.md +2 -2
  29. data/docs/InlineResponse2006.md +2 -2
  30. data/docs/InlineResponse2007.md +2 -2
  31. data/docs/InlineResponse2008.md +2 -2
  32. data/docs/InlineResponse2009.md +2 -2
  33. data/docs/{InlineResponse2007Data.md → InlineResponse2009Data.md} +2 -2
  34. data/docs/{InlineResponse2007Receipts.md → InlineResponse2009Receipts.md} +1 -1
  35. data/docs/InlineResponse201.md +1 -1
  36. data/docs/InlineResponse201Lines.md +1 -1
  37. data/docs/InlineResponse400.md +1 -1
  38. data/docs/Invoice.md +1 -1
  39. data/docs/InvoiceLines.md +1 -1
  40. data/docs/InvoicesApi.md +17 -17
  41. data/docs/IssueRefundPayment.md +1 -1
  42. data/docs/Limit.md +1 -1
  43. data/docs/Metric.md +12 -0
  44. data/docs/MetricCost.md +10 -0
  45. data/docs/MetricFilter.md +11 -0
  46. data/docs/PaymentDetails.md +1 -1
  47. data/docs/PaymentDetailsApi.md +48 -52
  48. data/docs/PaymentsApi.md +41 -42
  49. data/docs/Price.md +2 -1
  50. data/docs/PricesApi.md +15 -16
  51. data/docs/Product.md +1 -1
  52. data/docs/ProductTaxType.md +1 -1
  53. data/docs/ProductsApi.md +23 -24
  54. data/docs/ReceiptApi.md +5 -5
  55. data/docs/Refund.md +1 -1
  56. data/docs/RefundsApi.md +17 -17
  57. data/docs/SeatsAddBody.md +1 -1
  58. data/docs/SeatsRemoveBody.md +1 -1
  59. data/docs/Subscription.md +2 -1
  60. data/docs/SubscriptionIdCancelBody.md +1 -1
  61. data/docs/SubscriptionIdExtendBody.md +1 -1
  62. data/docs/SubscriptionIdPlanBody.md +2 -2
  63. data/docs/SubscriptionIdPriceBody.md +1 -1
  64. data/docs/SubscriptionPlan.md +1 -1
  65. data/docs/SubscriptionStartBody.md +2 -1
  66. data/docs/SubscriptionTrialBody.md +1 -1
  67. data/docs/SubscriptionsApi.md +78 -79
  68. data/docs/UsageApi.md +279 -0
  69. data/docs/UsageLimit.md +9 -0
  70. data/docs/VoucherCode.md +1 -1
  71. data/git_push.sh +2 -2
  72. data/lib/{swagger_client → billabear}/api/checkout_api.rb +3 -3
  73. data/lib/{swagger_client → billabear}/api/customers_api.rb +284 -45
  74. data/lib/{swagger_client → billabear}/api/invoices_api.rb +9 -9
  75. data/lib/{swagger_client → billabear}/api/payment_details_api.rb +26 -26
  76. data/lib/{swagger_client → billabear}/api/payments_api.rb +20 -20
  77. data/lib/{swagger_client → billabear}/api/prices_api.rb +11 -11
  78. data/lib/{swagger_client → billabear}/api/products_api.rb +11 -11
  79. data/lib/{swagger_client → billabear}/api/receipt_api.rb +3 -3
  80. data/lib/{swagger_client → billabear}/api/refunds_api.rb +9 -9
  81. data/lib/{swagger_client → billabear}/api/subscriptions_api.rb +29 -29
  82. data/lib/billabear/api/usage_api.rb +314 -0
  83. data/lib/{swagger_client → billabear}/api_client.rb +4 -4
  84. data/lib/{swagger_client → billabear}/api_error.rb +3 -3
  85. data/lib/{swagger_client → billabear}/configuration.rb +3 -3
  86. data/lib/{swagger_client → billabear}/models/address.rb +6 -6
  87. data/lib/{swagger_client → billabear}/models/billing_admin.rb +6 -6
  88. data/lib/{swagger_client → billabear}/models/checkout_body.rb +6 -6
  89. data/lib/{swagger_client → billabear}/models/checkout_items.rb +6 -6
  90. data/lib/{swagger_client → billabear}/models/checkout_subscriptions.rb +6 -6
  91. data/lib/billabear/models/cost.rb +215 -0
  92. data/lib/{swagger_client → billabear}/models/customer.rb +45 -11
  93. data/lib/billabear/models/customer_id_uasgelimit_body.rb +259 -0
  94. data/lib/{swagger_client → billabear}/models/error.rb +6 -6
  95. data/lib/billabear/models/event.rb +262 -0
  96. data/lib/{swagger_client → billabear}/models/feature.rb +6 -6
  97. data/lib/{swagger_client → billabear}/models/frontend_token.rb +6 -6
  98. data/lib/{swagger_client → billabear}/models/inline_response_200.rb +6 -6
  99. data/lib/billabear/models/inline_response_200_1.rb +217 -0
  100. data/lib/{swagger_client → billabear}/models/inline_response_200_10.rb +6 -6
  101. data/lib/{swagger_client/models/inline_response_200_2.rb → billabear/models/inline_response_200_11.rb} +7 -7
  102. data/lib/billabear/models/inline_response_200_12.rb +226 -0
  103. data/lib/{swagger_client/models/inline_response_200_11.rb → billabear/models/inline_response_200_13.rb} +7 -7
  104. data/lib/{swagger_client/models/inline_response_200_12.rb → billabear/models/inline_response_200_14.rb} +7 -7
  105. data/lib/{swagger_client/models/inline_response_200_1.rb → billabear/models/inline_response_200_2.rb} +7 -7
  106. data/lib/{swagger_client → billabear}/models/inline_response_200_3.rb +6 -6
  107. data/lib/{swagger_client → billabear}/models/inline_response_200_4.rb +6 -6
  108. data/lib/{swagger_client → billabear}/models/inline_response_200_5.rb +6 -6
  109. data/lib/{swagger_client → billabear}/models/inline_response_200_6.rb +6 -6
  110. data/lib/{swagger_client → billabear}/models/inline_response_200_7.rb +6 -6
  111. data/lib/{swagger_client → billabear}/models/inline_response_200_8.rb +6 -6
  112. data/lib/{swagger_client → billabear}/models/inline_response_200_9.rb +6 -6
  113. data/lib/{swagger_client/models/inline_response_200_7_data.rb → billabear/models/inline_response_200_9_data.rb} +7 -7
  114. data/lib/{swagger_client/models/inline_response_200_7_receipts.rb → billabear/models/inline_response_200_9_receipts.rb} +7 -7
  115. data/lib/{swagger_client → billabear}/models/inline_response_201.rb +6 -6
  116. data/lib/{swagger_client → billabear}/models/inline_response_201_lines.rb +6 -6
  117. data/lib/{swagger_client → billabear}/models/inline_response_400.rb +6 -6
  118. data/lib/{swagger_client → billabear}/models/invoice.rb +6 -6
  119. data/lib/{swagger_client → billabear}/models/invoice_lines.rb +6 -6
  120. data/lib/{swagger_client → billabear}/models/issue_refund_payment.rb +6 -6
  121. data/lib/{swagger_client → billabear}/models/limit.rb +6 -6
  122. data/lib/billabear/models/metric.rb +288 -0
  123. data/lib/billabear/models/metric_cost.rb +234 -0
  124. data/lib/billabear/models/metric_filter.rb +276 -0
  125. data/lib/{swagger_client → billabear}/models/payment_details.rb +6 -6
  126. data/lib/{swagger_client → billabear}/models/price.rb +20 -11
  127. data/lib/{swagger_client → billabear}/models/product.rb +6 -6
  128. data/lib/{swagger_client → billabear}/models/product_tax_type.rb +6 -6
  129. data/lib/{swagger_client → billabear}/models/refund.rb +6 -6
  130. data/lib/{swagger_client → billabear}/models/seats_add_body.rb +6 -6
  131. data/lib/{swagger_client → billabear}/models/seats_remove_body.rb +6 -6
  132. data/lib/{swagger_client → billabear}/models/subscription.rb +16 -7
  133. data/lib/{swagger_client → billabear}/models/subscription_id_cancel_body.rb +6 -6
  134. data/lib/{swagger_client → billabear}/models/subscription_id_extend_body.rb +6 -6
  135. data/lib/{swagger_client → billabear}/models/subscription_id_plan_body.rb +11 -6
  136. data/lib/{swagger_client → billabear}/models/subscription_id_price_body.rb +6 -6
  137. data/lib/{swagger_client → billabear}/models/subscription_plan.rb +6 -6
  138. data/lib/{swagger_client → billabear}/models/subscription_start_body.rb +20 -10
  139. data/lib/{swagger_client → billabear}/models/subscription_trial_body.rb +6 -6
  140. data/lib/billabear/models/usage_limit.rb +258 -0
  141. data/lib/{swagger_client → billabear}/models/voucher_code.rb +6 -6
  142. data/lib/{swagger_client → billabear}/version.rb +4 -4
  143. data/lib/billabear.rb +105 -0
  144. data/spec/api/checkout_api_spec.rb +5 -5
  145. data/spec/api/customers_api_spec.rb +68 -17
  146. data/spec/api/invoices_api_spec.rb +7 -7
  147. data/spec/api/payment_details_api_spec.rb +10 -10
  148. data/spec/api/payments_api_spec.rb +10 -10
  149. data/spec/api/prices_api_spec.rb +7 -7
  150. data/spec/api/products_api_spec.rb +7 -7
  151. data/spec/api/receipt_api_spec.rb +5 -5
  152. data/spec/api/refunds_api_spec.rb +7 -7
  153. data/spec/api/subscriptions_api_spec.rb +13 -13
  154. data/spec/api/usage_api_spec.rb +96 -0
  155. data/spec/api_client_spec.rb +31 -31
  156. data/spec/configuration_spec.rb +5 -5
  157. data/spec/models/address_spec.rb +5 -5
  158. data/spec/models/billing_admin_spec.rb +5 -5
  159. data/spec/models/checkout_body_spec.rb +5 -5
  160. data/spec/models/checkout_items_spec.rb +5 -5
  161. data/spec/models/checkout_subscriptions_spec.rb +5 -5
  162. data/spec/models/cost_spec.rb +46 -0
  163. data/spec/models/customer_id_uasgelimit_body_spec.rb +50 -0
  164. data/spec/models/customer_spec.rb +21 -5
  165. data/spec/models/error_spec.rb +5 -5
  166. data/spec/models/event_spec.rb +64 -0
  167. data/spec/models/feature_spec.rb +5 -5
  168. data/spec/models/frontend_token_spec.rb +5 -5
  169. data/spec/models/inline_response_200_10_spec.rb +5 -5
  170. data/spec/models/inline_response_200_11_spec.rb +18 -6
  171. data/spec/models/inline_response_200_12_spec.rb +13 -11
  172. data/spec/models/inline_response_200_13_spec.rb +40 -0
  173. data/spec/models/inline_response_200_14_spec.rb +50 -0
  174. data/spec/models/inline_response_200_1_spec.rb +7 -13
  175. data/spec/models/inline_response_200_2_spec.rb +8 -8
  176. data/spec/models/inline_response_200_3_spec.rb +5 -5
  177. data/spec/models/inline_response_200_4_spec.rb +5 -5
  178. data/spec/models/inline_response_200_5_spec.rb +5 -5
  179. data/spec/models/inline_response_200_6_spec.rb +5 -5
  180. data/spec/models/inline_response_200_7_spec.rb +5 -5
  181. data/spec/models/inline_response_200_8_spec.rb +5 -5
  182. data/spec/models/{inline_response_200_7_data_spec.rb → inline_response_200_9_data_spec.rb} +8 -8
  183. data/spec/models/{inline_response_200_7_receipts_spec.rb → inline_response_200_9_receipts_spec.rb} +8 -8
  184. data/spec/models/inline_response_200_9_spec.rb +5 -5
  185. data/spec/models/inline_response_200_spec.rb +5 -5
  186. data/spec/models/inline_response_201_lines_spec.rb +5 -5
  187. data/spec/models/inline_response_201_spec.rb +5 -5
  188. data/spec/models/inline_response_400_spec.rb +5 -5
  189. data/spec/models/invoice_lines_spec.rb +5 -5
  190. data/spec/models/invoice_spec.rb +5 -5
  191. data/spec/models/issue_refund_payment_spec.rb +5 -5
  192. data/spec/models/limit_spec.rb +5 -5
  193. data/spec/models/metric_cost_spec.rb +58 -0
  194. data/spec/models/metric_filter_spec.rb +68 -0
  195. data/spec/models/metric_spec.rb +74 -0
  196. data/spec/models/payment_details_spec.rb +5 -5
  197. data/spec/models/price_spec.rb +11 -5
  198. data/spec/models/product_spec.rb +5 -5
  199. data/spec/models/product_tax_type_spec.rb +5 -5
  200. data/spec/models/refund_spec.rb +5 -5
  201. data/spec/models/seats_add_body_spec.rb +5 -5
  202. data/spec/models/seats_remove_body_spec.rb +5 -5
  203. data/spec/models/subscription_id_cancel_body_spec.rb +5 -5
  204. data/spec/models/subscription_id_extend_body_spec.rb +5 -5
  205. data/spec/models/subscription_id_plan_body_spec.rb +5 -5
  206. data/spec/models/subscription_id_price_body_spec.rb +5 -5
  207. data/spec/models/subscription_plan_spec.rb +5 -5
  208. data/spec/models/subscription_spec.rb +11 -5
  209. data/spec/models/subscription_start_body_spec.rb +11 -5
  210. data/spec/models/subscription_trial_body_spec.rb +5 -5
  211. data/spec/models/usage_limit_spec.rb +56 -0
  212. data/spec/models/voucher_code_spec.rb +5 -5
  213. data/spec/spec_helper.rb +3 -3
  214. metadata +110 -70
  215. data/lib/swagger_client.rb +0 -95
@@ -0,0 +1,259 @@
1
+ =begin
2
+ #BillaBear
3
+
4
+ #The REST API provided by BillaBear
5
+
6
+ OpenAPI spec version: 1.1.0
7
+ Contact: support@billabear.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.66
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module Billabear
15
+ class CustomerIdUasgelimitBody
16
+ attr_accessor :amount
17
+
18
+ attr_accessor :action
19
+
20
+ class EnumAttributeValidator
21
+ attr_reader :datatype
22
+ attr_reader :allowable_values
23
+
24
+ def initialize(datatype, allowable_values)
25
+ @allowable_values = allowable_values.map do |value|
26
+ case datatype.to_s
27
+ when /Integer/i
28
+ value.to_i
29
+ when /Float/i
30
+ value.to_f
31
+ else
32
+ value
33
+ end
34
+ end
35
+ end
36
+
37
+ def valid?(value)
38
+ !value || allowable_values.include?(value)
39
+ end
40
+ end
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'amount' => :'amount',
46
+ :'action' => :'action'
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'amount' => :'Object',
54
+ :'action' => :'Object'
55
+ }
56
+ end
57
+
58
+ # List of attributes with nullable: true
59
+ def self.openapi_nullable
60
+ Set.new([
61
+ ])
62
+ end
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ if (!attributes.is_a?(Hash))
68
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Billabear::CustomerIdUasgelimitBody` initialize method"
69
+ end
70
+
71
+ # check to see if the attribute exists and convert string to symbol for hash key
72
+ attributes = attributes.each_with_object({}) { |(k, v), h|
73
+ if (!self.class.attribute_map.key?(k.to_sym))
74
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Billabear::CustomerIdUasgelimitBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
75
+ end
76
+ h[k.to_sym] = v
77
+ }
78
+
79
+ if attributes.key?(:'amount')
80
+ self.amount = attributes[:'amount']
81
+ end
82
+
83
+ if attributes.key?(:'action')
84
+ self.action = attributes[:'action']
85
+ end
86
+ end
87
+
88
+ # Show invalid properties with the reasons. Usually used together with valid?
89
+ # @return Array for valid properties with the reasons
90
+ def list_invalid_properties
91
+ invalid_properties = Array.new
92
+ if @amount.nil?
93
+ invalid_properties.push('invalid value for "amount", amount cannot be nil.')
94
+ end
95
+
96
+ if @action.nil?
97
+ invalid_properties.push('invalid value for "action", action cannot be nil.')
98
+ end
99
+
100
+ invalid_properties
101
+ end
102
+
103
+ # Check to see if the all the properties in the model are valid
104
+ # @return true if the model is valid
105
+ def valid?
106
+ return false if @amount.nil?
107
+ return false if @action.nil?
108
+ action_validator = EnumAttributeValidator.new('Object', ['WARNING', 'DISABLE'])
109
+ return false unless action_validator.valid?(@action)
110
+ true
111
+ end
112
+
113
+ # Custom attribute writer method checking allowed values (enum).
114
+ # @param [Object] action Object to be assigned
115
+ def action=(action)
116
+ validator = EnumAttributeValidator.new('Object', ['WARNING', 'DISABLE'])
117
+ unless validator.valid?(action)
118
+ fail ArgumentError, "invalid value for \"action\", must be one of #{validator.allowable_values}."
119
+ end
120
+ @action = action
121
+ end
122
+
123
+ # Checks equality by comparing each attribute.
124
+ # @param [Object] Object to be compared
125
+ def ==(o)
126
+ return true if self.equal?(o)
127
+ self.class == o.class &&
128
+ amount == o.amount &&
129
+ action == o.action
130
+ end
131
+
132
+ # @see the `==` method
133
+ # @param [Object] Object to be compared
134
+ def eql?(o)
135
+ self == o
136
+ end
137
+
138
+ # Calculates hash code according to all attributes.
139
+ # @return [Integer] Hash code
140
+ def hash
141
+ [amount, action].hash
142
+ end
143
+
144
+ # Builds the object from hash
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ # @return [Object] Returns the model itself
147
+ def self.build_from_hash(attributes)
148
+ new.build_from_hash(attributes)
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ self.class.openapi_types.each_pair do |key, type|
157
+ if type =~ /\AArray<(.*)>/i
158
+ # check to ensure the input is an array given that the attribute
159
+ # is documented as an array but the input is not
160
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
161
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
162
+ end
163
+ elsif !attributes[self.class.attribute_map[key]].nil?
164
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
165
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
166
+ self.send("#{key}=", nil)
167
+ end
168
+ end
169
+
170
+ self
171
+ end
172
+
173
+ # Deserializes the data based on type
174
+ # @param string type Data type
175
+ # @param string value Value to be deserialized
176
+ # @return [Object] Deserialized data
177
+ def _deserialize(type, value)
178
+ case type.to_sym
179
+ when :DateTime
180
+ DateTime.parse(value)
181
+ when :Date
182
+ Date.parse(value)
183
+ when :String
184
+ value.to_s
185
+ when :Integer
186
+ value.to_i
187
+ when :Float
188
+ value.to_f
189
+ when :Boolean
190
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
191
+ true
192
+ else
193
+ false
194
+ end
195
+ when :Object
196
+ # generic object (usually a Hash), return directly
197
+ value
198
+ when /\AArray<(?<inner_type>.+)>\z/
199
+ inner_type = Regexp.last_match[:inner_type]
200
+ value.map { |v| _deserialize(inner_type, v) }
201
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
202
+ k_type = Regexp.last_match[:k_type]
203
+ v_type = Regexp.last_match[:v_type]
204
+ {}.tap do |hash|
205
+ value.each do |k, v|
206
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
207
+ end
208
+ end
209
+ else # model
210
+ Billabear.const_get(type).build_from_hash(value)
211
+ end
212
+ end
213
+
214
+ # Returns the string representation of the object
215
+ # @return [String] String presentation of the object
216
+ def to_s
217
+ to_hash.to_s
218
+ end
219
+
220
+ # to_body is an alias to to_hash (backward compatibility)
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_body
223
+ to_hash
224
+ end
225
+
226
+ # Returns the object in the form of hash
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_hash
229
+ hash = {}
230
+ self.class.attribute_map.each_pair do |attr, param|
231
+ value = self.send(attr)
232
+ if value.nil?
233
+ is_nullable = self.class.openapi_nullable.include?(attr)
234
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
235
+ end
236
+
237
+ hash[param] = _to_hash(value)
238
+ end
239
+ hash
240
+ end
241
+
242
+ # Outputs non-array value in the form of hash
243
+ # For object, use to_hash. Otherwise, just return the value
244
+ # @param [Object] value Any valid value
245
+ # @return [Hash] Returns the value in the form of hash
246
+ def _to_hash(value)
247
+ if value.is_a?(Array)
248
+ value.compact.map { |v| _to_hash(v) }
249
+ elsif value.is_a?(Hash)
250
+ {}.tap do |hash|
251
+ value.each { |k, v| hash[k] = _to_hash(v) }
252
+ end
253
+ elsif value.respond_to? :to_hash
254
+ value.to_hash
255
+ else
256
+ value
257
+ end
258
+ end end
259
+ end
@@ -3,15 +3,15 @@
3
3
 
4
4
  #The REST API provided by BillaBear
5
5
 
6
- OpenAPI spec version: 1.0.0
6
+ OpenAPI spec version: 1.1.0
7
7
  Contact: support@billabear.com
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 3.0.56
9
+ Swagger Codegen version: 3.0.66
10
10
  =end
11
11
 
12
12
  require 'date'
13
13
 
14
- module SwaggerClient
14
+ module Billabear
15
15
  class Error
16
16
  attr_accessor :code
17
17
 
@@ -43,13 +43,13 @@ module SwaggerClient
43
43
  # @param [Hash] attributes Model attributes in the form of hash
44
44
  def initialize(attributes = {})
45
45
  if (!attributes.is_a?(Hash))
46
- fail ArgumentError, "The input argument (attributes) must be a hash in `SwaggerClient::Error` initialize method"
46
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Billabear::Error` initialize method"
47
47
  end
48
48
 
49
49
  # check to see if the attribute exists and convert string to symbol for hash key
50
50
  attributes = attributes.each_with_object({}) { |(k, v), h|
51
51
  if (!self.class.attribute_map.key?(k.to_sym))
52
- fail ArgumentError, "`#{k}` is not a valid attribute in `SwaggerClient::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
52
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Billabear::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
53
53
  end
54
54
  h[k.to_sym] = v
55
55
  }
@@ -173,7 +173,7 @@ module SwaggerClient
173
173
  end
174
174
  end
175
175
  else # model
176
- SwaggerClient.const_get(type).build_from_hash(value)
176
+ Billabear.const_get(type).build_from_hash(value)
177
177
  end
178
178
  end
179
179
 
@@ -0,0 +1,262 @@
1
+ =begin
2
+ #BillaBear
3
+
4
+ #The REST API provided by BillaBear
5
+
6
+ OpenAPI spec version: 1.1.0
7
+ Contact: support@billabear.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.66
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module Billabear
15
+ class Event
16
+ attr_accessor :event_id
17
+
18
+ attr_accessor :subscription
19
+
20
+ attr_accessor :properties
21
+
22
+ attr_accessor :value
23
+
24
+ attr_accessor :code
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'event_id' => :'event_id',
30
+ :'subscription' => :'subscription',
31
+ :'properties' => :'properties',
32
+ :'value' => :'value',
33
+ :'code' => :'code'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'event_id' => :'Object',
41
+ :'subscription' => :'Object',
42
+ :'properties' => :'Object',
43
+ :'value' => :'Object',
44
+ :'code' => :'Object'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Billabear::Event` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h|
63
+ if (!self.class.attribute_map.key?(k.to_sym))
64
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Billabear::Event`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ end
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:'event_id')
70
+ self.event_id = attributes[:'event_id']
71
+ end
72
+
73
+ if attributes.key?(:'subscription')
74
+ self.subscription = attributes[:'subscription']
75
+ end
76
+
77
+ if attributes.key?(:'properties')
78
+ self.properties = attributes[:'properties']
79
+ end
80
+
81
+ if attributes.key?(:'value')
82
+ self.value = attributes[:'value']
83
+ end
84
+
85
+ if attributes.key?(:'code')
86
+ self.code = attributes[:'code']
87
+ end
88
+ end
89
+
90
+ # Show invalid properties with the reasons. Usually used together with valid?
91
+ # @return Array for valid properties with the reasons
92
+ def list_invalid_properties
93
+ invalid_properties = Array.new
94
+ if @event_id.nil?
95
+ invalid_properties.push('invalid value for "event_id", event_id cannot be nil.')
96
+ end
97
+
98
+ if @subscription.nil?
99
+ invalid_properties.push('invalid value for "subscription", subscription cannot be nil.')
100
+ end
101
+
102
+ if @value.nil?
103
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
104
+ end
105
+
106
+ if @code.nil?
107
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
108
+ end
109
+
110
+ invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ return false if @event_id.nil?
117
+ return false if @subscription.nil?
118
+ return false if @value.nil?
119
+ return false if @code.nil?
120
+ true
121
+ end
122
+
123
+ # Checks equality by comparing each attribute.
124
+ # @param [Object] Object to be compared
125
+ def ==(o)
126
+ return true if self.equal?(o)
127
+ self.class == o.class &&
128
+ event_id == o.event_id &&
129
+ subscription == o.subscription &&
130
+ properties == o.properties &&
131
+ value == o.value &&
132
+ code == o.code
133
+ end
134
+
135
+ # @see the `==` method
136
+ # @param [Object] Object to be compared
137
+ def eql?(o)
138
+ self == o
139
+ end
140
+
141
+ # Calculates hash code according to all attributes.
142
+ # @return [Integer] Hash code
143
+ def hash
144
+ [event_id, subscription, properties, value, code].hash
145
+ end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def self.build_from_hash(attributes)
151
+ new.build_from_hash(attributes)
152
+ end
153
+
154
+ # Builds the object from hash
155
+ # @param [Hash] attributes Model attributes in the form of hash
156
+ # @return [Object] Returns the model itself
157
+ def build_from_hash(attributes)
158
+ return nil unless attributes.is_a?(Hash)
159
+ self.class.openapi_types.each_pair do |key, type|
160
+ if type =~ /\AArray<(.*)>/i
161
+ # check to ensure the input is an array given that the attribute
162
+ # is documented as an array but the input is not
163
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
164
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
165
+ end
166
+ elsif !attributes[self.class.attribute_map[key]].nil?
167
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
168
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
169
+ self.send("#{key}=", nil)
170
+ end
171
+ end
172
+
173
+ self
174
+ end
175
+
176
+ # Deserializes the data based on type
177
+ # @param string type Data type
178
+ # @param string value Value to be deserialized
179
+ # @return [Object] Deserialized data
180
+ def _deserialize(type, value)
181
+ case type.to_sym
182
+ when :DateTime
183
+ DateTime.parse(value)
184
+ when :Date
185
+ Date.parse(value)
186
+ when :String
187
+ value.to_s
188
+ when :Integer
189
+ value.to_i
190
+ when :Float
191
+ value.to_f
192
+ when :Boolean
193
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
194
+ true
195
+ else
196
+ false
197
+ end
198
+ when :Object
199
+ # generic object (usually a Hash), return directly
200
+ value
201
+ when /\AArray<(?<inner_type>.+)>\z/
202
+ inner_type = Regexp.last_match[:inner_type]
203
+ value.map { |v| _deserialize(inner_type, v) }
204
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
205
+ k_type = Regexp.last_match[:k_type]
206
+ v_type = Regexp.last_match[:v_type]
207
+ {}.tap do |hash|
208
+ value.each do |k, v|
209
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
210
+ end
211
+ end
212
+ else # model
213
+ Billabear.const_get(type).build_from_hash(value)
214
+ end
215
+ end
216
+
217
+ # Returns the string representation of the object
218
+ # @return [String] String presentation of the object
219
+ def to_s
220
+ to_hash.to_s
221
+ end
222
+
223
+ # to_body is an alias to to_hash (backward compatibility)
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_body
226
+ to_hash
227
+ end
228
+
229
+ # Returns the object in the form of hash
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_hash
232
+ hash = {}
233
+ self.class.attribute_map.each_pair do |attr, param|
234
+ value = self.send(attr)
235
+ if value.nil?
236
+ is_nullable = self.class.openapi_nullable.include?(attr)
237
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
238
+ end
239
+
240
+ hash[param] = _to_hash(value)
241
+ end
242
+ hash
243
+ end
244
+
245
+ # Outputs non-array value in the form of hash
246
+ # For object, use to_hash. Otherwise, just return the value
247
+ # @param [Object] value Any valid value
248
+ # @return [Hash] Returns the value in the form of hash
249
+ def _to_hash(value)
250
+ if value.is_a?(Array)
251
+ value.compact.map { |v| _to_hash(v) }
252
+ elsif value.is_a?(Hash)
253
+ {}.tap do |hash|
254
+ value.each { |k, v| hash[k] = _to_hash(v) }
255
+ end
256
+ elsif value.respond_to? :to_hash
257
+ value.to_hash
258
+ else
259
+ value
260
+ end
261
+ end end
262
+ end
@@ -3,15 +3,15 @@
3
3
 
4
4
  #The REST API provided by BillaBear
5
5
 
6
- OpenAPI spec version: 1.0.0
6
+ OpenAPI spec version: 1.1.0
7
7
  Contact: support@billabear.com
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 3.0.56
9
+ Swagger Codegen version: 3.0.66
10
10
  =end
11
11
 
12
12
  require 'date'
13
13
 
14
- module SwaggerClient
14
+ module Billabear
15
15
  class Feature
16
16
  attr_accessor :id
17
17
 
@@ -53,13 +53,13 @@ module SwaggerClient
53
53
  # @param [Hash] attributes Model attributes in the form of hash
54
54
  def initialize(attributes = {})
55
55
  if (!attributes.is_a?(Hash))
56
- fail ArgumentError, "The input argument (attributes) must be a hash in `SwaggerClient::Feature` initialize method"
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Billabear::Feature` initialize method"
57
57
  end
58
58
 
59
59
  # check to see if the attribute exists and convert string to symbol for hash key
60
60
  attributes = attributes.each_with_object({}) { |(k, v), h|
61
61
  if (!self.class.attribute_map.key?(k.to_sym))
62
- fail ArgumentError, "`#{k}` is not a valid attribute in `SwaggerClient::Feature`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Billabear::Feature`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
63
  end
64
64
  h[k.to_sym] = v
65
65
  }
@@ -188,7 +188,7 @@ module SwaggerClient
188
188
  end
189
189
  end
190
190
  else # model
191
- SwaggerClient.const_get(type).build_from_hash(value)
191
+ Billabear.const_get(type).build_from_hash(value)
192
192
  end
193
193
  end
194
194
 
@@ -3,15 +3,15 @@
3
3
 
4
4
  #The REST API provided by BillaBear
5
5
 
6
- OpenAPI spec version: 1.0.0
6
+ OpenAPI spec version: 1.1.0
7
7
  Contact: support@billabear.com
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 3.0.56
9
+ Swagger Codegen version: 3.0.66
10
10
  =end
11
11
 
12
12
  require 'date'
13
13
 
14
- module SwaggerClient
14
+ module Billabear
15
15
  class FrontendToken
16
16
  attr_accessor :token
17
17
 
@@ -39,13 +39,13 @@ module SwaggerClient
39
39
  # @param [Hash] attributes Model attributes in the form of hash
40
40
  def initialize(attributes = {})
41
41
  if (!attributes.is_a?(Hash))
42
- fail ArgumentError, "The input argument (attributes) must be a hash in `SwaggerClient::FrontendToken` initialize method"
42
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Billabear::FrontendToken` initialize method"
43
43
  end
44
44
 
45
45
  # check to see if the attribute exists and convert string to symbol for hash key
46
46
  attributes = attributes.each_with_object({}) { |(k, v), h|
47
47
  if (!self.class.attribute_map.key?(k.to_sym))
48
- fail ArgumentError, "`#{k}` is not a valid attribute in `SwaggerClient::FrontendToken`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
48
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Billabear::FrontendToken`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
49
49
  end
50
50
  h[k.to_sym] = v
51
51
  }
@@ -159,7 +159,7 @@ module SwaggerClient
159
159
  end
160
160
  end
161
161
  else # model
162
- SwaggerClient.const_get(type).build_from_hash(value)
162
+ Billabear.const_get(type).build_from_hash(value)
163
163
  end
164
164
  end
165
165
 
@@ -3,15 +3,15 @@
3
3
 
4
4
  #The REST API provided by BillaBear
5
5
 
6
- OpenAPI spec version: 1.0.0
6
+ OpenAPI spec version: 1.1.0
7
7
  Contact: support@billabear.com
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 3.0.56
9
+ Swagger Codegen version: 3.0.66
10
10
  =end
11
11
 
12
12
  require 'date'
13
13
 
14
- module SwaggerClient
14
+ module Billabear
15
15
  class InlineResponse200
16
16
  attr_accessor :data
17
17
 
@@ -47,13 +47,13 @@ module SwaggerClient
47
47
  # @param [Hash] attributes Model attributes in the form of hash
48
48
  def initialize(attributes = {})
49
49
  if (!attributes.is_a?(Hash))
50
- fail ArgumentError, "The input argument (attributes) must be a hash in `SwaggerClient::InlineResponse200` initialize method"
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Billabear::InlineResponse200` initialize method"
51
51
  end
52
52
 
53
53
  # check to see if the attribute exists and convert string to symbol for hash key
54
54
  attributes = attributes.each_with_object({}) { |(k, v), h|
55
55
  if (!self.class.attribute_map.key?(k.to_sym))
56
- fail ArgumentError, "`#{k}` is not a valid attribute in `SwaggerClient::InlineResponse200`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Billabear::InlineResponse200`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
57
  end
58
58
  h[k.to_sym] = v
59
59
  }
@@ -174,7 +174,7 @@ module SwaggerClient
174
174
  end
175
175
  end
176
176
  else # model
177
- SwaggerClient.const_get(type).build_from_hash(value)
177
+ Billabear.const_get(type).build_from_hash(value)
178
178
  end
179
179
  end
180
180