bf_ruby2 1.2016.229 → 1.2016.230

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +53 -29
  3. data/bf_ruby2-1.2016.229.gem +0 -0
  4. data/docs/AccountsApi.md +82 -31
  5. data/docs/AddChargeToAccountResponse.md +9 -0
  6. data/docs/AddChargeToAccountResponsePagedMetadata.md +14 -0
  7. data/docs/AddChargesToAccountAPIRequest.md +17 -0
  8. data/docs/AddressesApi.md +4 -4
  9. data/docs/AmendmentsApi.md +13 -13
  10. data/docs/AnalyticsApi.md +15 -15
  11. data/docs/AuditlogsApi.md +5 -5
  12. data/docs/BatchUpdatePricingComponentValuesRequest.md +9 -0
  13. data/docs/ChargesApi.md +56 -8
  14. data/docs/ClientsApi.md +6 -6
  15. data/docs/ConfigurationsApi.md +6 -6
  16. data/docs/CouponbookApi.md +11 -11
  17. data/docs/CouponbookdefinitionApi.md +8 -8
  18. data/docs/CoupondefinitionApi.md +7 -7
  19. data/docs/CouponinstanceApi.md +12 -12
  20. data/docs/CouponmodifierApi.md +9 -9
  21. data/docs/CouponruleApi.md +6 -6
  22. data/docs/CouponsApi.md +10 -10
  23. data/docs/CreateSubscriptionChargeAmendment.md +0 -1
  24. data/docs/CreateSubscriptionRequest.md +2 -0
  25. data/docs/CreditnotesApi.md +7 -7
  26. data/docs/CybersourcetokensApi.md +7 -7
  27. data/docs/DunninglinesApi.md +8 -8
  28. data/docs/EmailprovidersApi.md +5 -5
  29. data/docs/EmailsApi.md +1 -1
  30. data/docs/EmailsubscriptionsApi.md +7 -7
  31. data/docs/FixedtermdefinitionsApi.md +4 -4
  32. data/docs/FixedtermsApi.md +2 -2
  33. data/docs/Invoice.md +3 -0
  34. data/docs/InvoicesApi.md +63 -63
  35. data/docs/MetadataApi.md +6 -6
  36. data/docs/NestedChargeRequest.md +19 -0
  37. data/docs/NotificationsApi.md +6 -6
  38. data/docs/OrganizationsApi.md +9 -9
  39. data/docs/PasswordsApi.md +2 -2
  40. data/docs/PaymentmethodsApi.md +10 -10
  41. data/docs/PaymentmethodsubscriptionlinksApi.md +3 -3
  42. data/docs/PaymentsApi.md +9 -9
  43. data/docs/PeriodsApi.md +2 -2
  44. data/docs/PermissionsApi.md +8 -8
  45. data/docs/PricingcalculatorApi.md +6 -6
  46. data/docs/PricingcomponentsApi.md +8 -8
  47. data/docs/PricingcomponenttiersApi.md +7 -7
  48. data/docs/PricingcomponentvaluechangesApi.md +7 -7
  49. data/docs/PricingcomponentvaluesApi.md +7 -7
  50. data/docs/ProductrateplansApi.md +27 -27
  51. data/docs/ProductsApi.md +17 -17
  52. data/docs/ProfilesApi.md +6 -6
  53. data/docs/QuotesApi.md +2 -2
  54. data/docs/RecalculateChargeBatchRequest.md +12 -0
  55. data/docs/RecalculateChargeBatchResponse.md +11 -0
  56. data/docs/RecalculateChargeBatchResponsePagedMetadata.md +14 -0
  57. data/docs/ReceiptsApi.md +6 -6
  58. data/docs/RefundsApi.md +9 -9
  59. data/docs/RolesApi.md +8 -8
  60. data/docs/SearchApi.md +1 -1
  61. data/docs/SingleRecalculateChargeRequest.md +15 -0
  62. data/docs/Subscription.md +1 -0
  63. data/docs/SubscriptionsApi.md +153 -102
  64. data/docs/SynchAppConfigsApi.md +6 -6
  65. data/docs/SynchConfigsApi.md +8 -8
  66. data/docs/SynchJobsApi.md +10 -10
  67. data/docs/TaxationlinksApi.md +8 -8
  68. data/docs/TaxationstrategiesApi.md +11 -11
  69. data/docs/TimeApi.md +1 -1
  70. data/docs/TokenizationApi.md +6 -6
  71. data/docs/UnitofmeasureApi.md +6 -6
  72. data/docs/UpdatePricingComponentValueChangeResult.md +19 -0
  73. data/docs/UpdatePricingComponentValueRequest.md +10 -0
  74. data/docs/UpdatePricingComponentValueResponse.md +9 -0
  75. data/docs/UpdatePricingComponentValueResponsePagedMetadata.md +14 -0
  76. data/docs/UsageApi.md +7 -7
  77. data/docs/UsageperiodsApi.md +3 -3
  78. data/docs/UsageroundingstrategiesApi.md +6 -6
  79. data/docs/UsagesessionsApi.md +6 -6
  80. data/docs/UsernamesApi.md +2 -2
  81. data/docs/UsersApi.md +16 -16
  82. data/docs/VaultedgatewaysApi.md +22 -22
  83. data/docs/WebhooksApi.md +10 -10
  84. data/lib/bf_ruby2.rb +13 -0
  85. data/lib/bf_ruby2/api/accounts_api.rb +92 -31
  86. data/lib/bf_ruby2/api/addresses_api.rb +4 -4
  87. data/lib/bf_ruby2/api/amendments_api.rb +13 -13
  88. data/lib/bf_ruby2/api/analytics_api.rb +15 -15
  89. data/lib/bf_ruby2/api/auditlogs_api.rb +5 -5
  90. data/lib/bf_ruby2/api/charges_api.rb +65 -8
  91. data/lib/bf_ruby2/api/clients_api.rb +6 -6
  92. data/lib/bf_ruby2/api/configurations_api.rb +6 -6
  93. data/lib/bf_ruby2/api/couponbook_api.rb +11 -11
  94. data/lib/bf_ruby2/api/couponbookdefinition_api.rb +8 -8
  95. data/lib/bf_ruby2/api/coupondefinition_api.rb +7 -7
  96. data/lib/bf_ruby2/api/couponinstance_api.rb +12 -12
  97. data/lib/bf_ruby2/api/couponmodifier_api.rb +9 -9
  98. data/lib/bf_ruby2/api/couponrule_api.rb +6 -6
  99. data/lib/bf_ruby2/api/coupons_api.rb +10 -10
  100. data/lib/bf_ruby2/api/creditnotes_api.rb +7 -7
  101. data/lib/bf_ruby2/api/cybersourcetokens_api.rb +7 -7
  102. data/lib/bf_ruby2/api/dunninglines_api.rb +8 -8
  103. data/lib/bf_ruby2/api/emailproviders_api.rb +5 -5
  104. data/lib/bf_ruby2/api/emails_api.rb +1 -1
  105. data/lib/bf_ruby2/api/emailsubscriptions_api.rb +7 -7
  106. data/lib/bf_ruby2/api/fixedtermdefinitions_api.rb +4 -4
  107. data/lib/bf_ruby2/api/fixedterms_api.rb +2 -2
  108. data/lib/bf_ruby2/api/invoices_api.rb +63 -63
  109. data/lib/bf_ruby2/api/metadata_api.rb +6 -6
  110. data/lib/bf_ruby2/api/notifications_api.rb +6 -6
  111. data/lib/bf_ruby2/api/organizations_api.rb +9 -9
  112. data/lib/bf_ruby2/api/passwords_api.rb +2 -2
  113. data/lib/bf_ruby2/api/paymentmethods_api.rb +10 -10
  114. data/lib/bf_ruby2/api/paymentmethodsubscriptionlinks_api.rb +3 -3
  115. data/lib/bf_ruby2/api/payments_api.rb +9 -9
  116. data/lib/bf_ruby2/api/periods_api.rb +2 -2
  117. data/lib/bf_ruby2/api/permissions_api.rb +8 -8
  118. data/lib/bf_ruby2/api/pricingcalculator_api.rb +6 -6
  119. data/lib/bf_ruby2/api/pricingcomponents_api.rb +8 -8
  120. data/lib/bf_ruby2/api/pricingcomponenttiers_api.rb +7 -7
  121. data/lib/bf_ruby2/api/pricingcomponentvaluechanges_api.rb +7 -7
  122. data/lib/bf_ruby2/api/pricingcomponentvalues_api.rb +7 -7
  123. data/lib/bf_ruby2/api/productrateplans_api.rb +27 -27
  124. data/lib/bf_ruby2/api/products_api.rb +17 -17
  125. data/lib/bf_ruby2/api/profiles_api.rb +6 -6
  126. data/lib/bf_ruby2/api/quotes_api.rb +2 -2
  127. data/lib/bf_ruby2/api/receipts_api.rb +6 -6
  128. data/lib/bf_ruby2/api/refunds_api.rb +9 -9
  129. data/lib/bf_ruby2/api/roles_api.rb +8 -8
  130. data/lib/bf_ruby2/api/search_api.rb +1 -1
  131. data/lib/bf_ruby2/api/subscriptions_api.rb +163 -102
  132. data/lib/bf_ruby2/api/synch_app_configs_api.rb +6 -6
  133. data/lib/bf_ruby2/api/synch_configs_api.rb +8 -8
  134. data/lib/bf_ruby2/api/synch_jobs_api.rb +10 -10
  135. data/lib/bf_ruby2/api/taxationlinks_api.rb +8 -8
  136. data/lib/bf_ruby2/api/taxationstrategies_api.rb +11 -11
  137. data/lib/bf_ruby2/api/time_api.rb +1 -1
  138. data/lib/bf_ruby2/api/tokenization_api.rb +6 -6
  139. data/lib/bf_ruby2/api/unitofmeasure_api.rb +6 -6
  140. data/lib/bf_ruby2/api/usage_api.rb +7 -7
  141. data/lib/bf_ruby2/api/usageperiods_api.rb +3 -3
  142. data/lib/bf_ruby2/api/usageroundingstrategies_api.rb +6 -6
  143. data/lib/bf_ruby2/api/usagesessions_api.rb +6 -6
  144. data/lib/bf_ruby2/api/usernames_api.rb +2 -2
  145. data/lib/bf_ruby2/api/users_api.rb +16 -16
  146. data/lib/bf_ruby2/api/vaultedgateways_api.rb +22 -22
  147. data/lib/bf_ruby2/api/webhooks_api.rb +10 -10
  148. data/lib/bf_ruby2/models/add_charge_to_account_response.rb +212 -0
  149. data/lib/bf_ruby2/models/add_charge_to_account_response_paged_metadata.rb +269 -0
  150. data/lib/bf_ruby2/models/add_charges_to_account_api_request.rb +337 -0
  151. data/lib/bf_ruby2/models/batch_update_pricing_component_values_request.rb +244 -0
  152. data/lib/bf_ruby2/models/create_subscription_charge_amendment.rb +1 -24
  153. data/lib/bf_ruby2/models/create_subscription_request.rb +24 -4
  154. data/lib/bf_ruby2/models/invoice.rb +32 -1
  155. data/lib/bf_ruby2/models/nested_charge_request.rb +343 -0
  156. data/lib/bf_ruby2/models/recalculate_charge_batch_request.rb +279 -0
  157. data/lib/bf_ruby2/models/recalculate_charge_batch_response.rb +234 -0
  158. data/lib/bf_ruby2/models/recalculate_charge_batch_response_paged_metadata.rb +269 -0
  159. data/lib/bf_ruby2/models/single_recalculate_charge_request.rb +317 -0
  160. data/lib/bf_ruby2/models/subscription.rb +11 -1
  161. data/lib/bf_ruby2/models/update_pricing_component_value_change_result.rb +367 -0
  162. data/lib/bf_ruby2/models/update_pricing_component_value_request.rb +253 -0
  163. data/lib/bf_ruby2/models/update_pricing_component_value_response.rb +210 -0
  164. data/lib/bf_ruby2/models/update_pricing_component_value_response_paged_metadata.rb +269 -0
  165. data/lib/bf_ruby2/version.rb +1 -1
  166. data/spec/models/add_charge_to_account_response_paged_metadata_spec.rb +89 -0
  167. data/spec/models/add_charge_to_account_response_spec.rb +59 -0
  168. data/spec/models/add_charges_to_account_api_request_spec.rb +115 -0
  169. data/spec/models/batch_update_pricing_component_values_request_spec.rb +63 -0
  170. data/spec/models/nested_charge_request_spec.rb +123 -0
  171. data/spec/models/recalculate_charge_batch_request_spec.rb +81 -0
  172. data/spec/models/recalculate_charge_batch_response_paged_metadata_spec.rb +89 -0
  173. data/spec/models/recalculate_charge_batch_response_spec.rb +71 -0
  174. data/spec/models/single_recalculate_charge_request_spec.rb +103 -0
  175. data/spec/models/update_pricing_component_value_change_result_spec.rb +131 -0
  176. data/spec/models/update_pricing_component_value_request_spec.rb +69 -0
  177. data/spec/models/update_pricing_component_value_response_paged_metadata_spec.rb +89 -0
  178. data/spec/models/update_pricing_component_value_response_spec.rb +59 -0
  179. metadata +54 -2
  180. data/setup.scratch.rb +0 -33
@@ -141,6 +141,9 @@ module BillForward
141
141
 
142
142
  attr_accessor :payment_terms
143
143
 
144
+ # { \"default\": \" \", \"description\":\"Purchase order associated with the subscription. If specified this is copied to any invoices issued for this subscription.\",\"verbs\":[\"POST\"]}
145
+ attr_accessor :purchase_order
146
+
144
147
  # {\"default\":\"None\",\"description\":\"The action that should be taken, should an invoice for some subscription to this rate plan remain unpaid despite the dunning period's being exceeded.<br><span class=\\\"label label-default\\\">CancelSubscription</span> &mdash; Demotes the subscription to the `Failed` state as soon as the dunning period is exceeded.<br><span class=\\\"label label-default\\\">None</span> &mdash; The subscription is allowed to continue in the `AwaitingPayment` state indefinitely even if the dunning period is exceeded.For slow payment cycles &mdash; or when manual invoice remediation is common &mdash; <span class=\\\"label label-default\\\">None</span> is recommended.<br>In a heavily-automated SaaS environment, automatic cancellation via <span class=\\\"label label-default\\\">CancelSubscription</span> is recommended.\",\"verbs\":[\"POST\",\"PUT\",\"GET\"]}
145
148
  attr_accessor :failed_payment_behaviour
146
149
 
@@ -208,6 +211,7 @@ module BillForward
208
211
  :'current_time' => :'currentTime',
209
212
  :'time_offset' => :'timeOffset',
210
213
  :'payment_terms' => :'paymentTerms',
214
+ :'purchase_order' => :'purchaseOrder',
211
215
  :'failed_payment_behaviour' => :'failedPaymentBehaviour'
212
216
  }
213
217
  end
@@ -254,6 +258,7 @@ module BillForward
254
258
  :'current_time' => :'DateTime',
255
259
  :'time_offset' => :'Integer',
256
260
  :'payment_terms' => :'Integer',
261
+ :'purchase_order' => :'String',
257
262
  :'failed_payment_behaviour' => :'String'
258
263
  }
259
264
  end
@@ -434,6 +439,10 @@ module BillForward
434
439
  self.payment_terms = attributes[:'paymentTerms']
435
440
  end
436
441
 
442
+ if attributes.has_key?(:'purchaseOrder')
443
+ self.purchase_order = attributes[:'purchaseOrder']
444
+ end
445
+
437
446
  if attributes.has_key?(:'failedPaymentBehaviour')
438
447
  self.failed_payment_behaviour = attributes[:'failedPaymentBehaviour']
439
448
  end
@@ -557,6 +566,7 @@ module BillForward
557
566
  current_time == o.current_time &&
558
567
  time_offset == o.time_offset &&
559
568
  payment_terms == o.payment_terms &&
569
+ purchase_order == o.purchase_order &&
560
570
  failed_payment_behaviour == o.failed_payment_behaviour
561
571
  end
562
572
 
@@ -569,7 +579,7 @@ module BillForward
569
579
  # Calculates hash code according to all attributes.
570
580
  # @return [Fixnum] Hash code
571
581
  def hash
572
- [created, changed_by, updated, metadata, id, version_id, crm_id, account_id, organization_id, product_id, product_rate_plan_id, parent_id, name, description, type, state, current_period_start, current_period_end, contract_start, subscription_end, current_period_end_explicit, initial_period_start, successful_periods, total_periods, trial_end, dunning, locked, managed_by, version_start, version_end, version_number, credit_enabled, aggregate_all_subscriptions_on_account, pricing_component_values, payment_method_subscription_links, fixed_terms, current_time, time_offset, payment_terms, failed_payment_behaviour].hash
582
+ [created, changed_by, updated, metadata, id, version_id, crm_id, account_id, organization_id, product_id, product_rate_plan_id, parent_id, name, description, type, state, current_period_start, current_period_end, contract_start, subscription_end, current_period_end_explicit, initial_period_start, successful_periods, total_periods, trial_end, dunning, locked, managed_by, version_start, version_end, version_number, credit_enabled, aggregate_all_subscriptions_on_account, pricing_component_values, payment_method_subscription_links, fixed_terms, current_time, time_offset, payment_terms, purchase_order, failed_payment_behaviour].hash
573
583
  end
574
584
 
575
585
  # Builds the object from hash
@@ -0,0 +1,367 @@
1
+ =begin
2
+ #BillForward REST API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require 'date'
25
+
26
+ module BillForward
27
+ # UpdatePricingComponentValueChangeResult
28
+ class UpdatePricingComponentValueChangeResult
29
+ # The ID of the updated Pricing Component.
30
+ attr_accessor :pricing_component_id
31
+
32
+ # The name of the updated Pricing Component.
33
+ attr_accessor :pricing_component_name
34
+
35
+ # The public name of the updated Pricing Component.
36
+ attr_accessor :pricing_component_public_name
37
+
38
+ # The value of the Pricing Component after the update.
39
+ attr_accessor :new_value
40
+
41
+ # The Pricing Component Value before the update.
42
+ attr_accessor :old_value
43
+
44
+ # The type of the result.
45
+ attr_accessor :type
46
+
47
+ # The ID of the updated Subscription.
48
+ attr_accessor :subscription_id
49
+
50
+ # The issued amount.
51
+ attr_accessor :amount
52
+
53
+ # This field state if the issued amount is a Debit or Credit. This field will be null if the amount is 0 (zero)
54
+ attr_accessor :charge_type
55
+
56
+ # If a debit or credit charge has been created in the process, this field will contain it.
57
+ attr_accessor :charge
58
+
59
+ # If an amendment has been created in the prcess (ie. if the update has to be delayed to the ending billing period), this field will contain it.
60
+ attr_accessor :amendment
61
+
62
+ # {\"description\":\"The state of the update. <ul><li>Succeeded: The change has been applied. This state only happens for immediate changes and if the generated invoice has been successfully paid.</li><li>Failed: The change has not been applied. This state only happens for immediate changes and if the generated invoice has not been successfully paid.</li><li>Pending: The changes has not been applied yet. An amendment has been created that will be triggered in the future applying the change. The resulting state can't be predicted at this time.</li></ul>\"}
63
+ attr_accessor :state
64
+
65
+ class EnumAttributeValidator
66
+ attr_reader :datatype
67
+ attr_reader :allowable_values
68
+
69
+ def initialize(datatype, allowable_values)
70
+ @allowable_values = allowable_values.map do |value|
71
+ case datatype.to_s
72
+ when /Integer/i
73
+ value.to_i
74
+ when /Float/i
75
+ value.to_f
76
+ else
77
+ value
78
+ end
79
+ end
80
+ end
81
+
82
+ def valid?(value)
83
+ !value || allowable_values.include?(value)
84
+ end
85
+ end
86
+
87
+ # Attribute mapping from ruby-style variable name to JSON key.
88
+ def self.attribute_map
89
+ {
90
+ :'pricing_component_id' => :'pricingComponentID',
91
+ :'pricing_component_name' => :'pricingComponentName',
92
+ :'pricing_component_public_name' => :'pricingComponentPublicName',
93
+ :'new_value' => :'newValue',
94
+ :'old_value' => :'oldValue',
95
+ :'type' => :'type',
96
+ :'subscription_id' => :'subscriptionID',
97
+ :'amount' => :'amount',
98
+ :'charge_type' => :'chargeType',
99
+ :'charge' => :'charge',
100
+ :'amendment' => :'amendment',
101
+ :'state' => :'state'
102
+ }
103
+ end
104
+
105
+ # Attribute type mapping.
106
+ def self.swagger_types
107
+ {
108
+ :'pricing_component_id' => :'String',
109
+ :'pricing_component_name' => :'String',
110
+ :'pricing_component_public_name' => :'String',
111
+ :'new_value' => :'Integer',
112
+ :'old_value' => :'Integer',
113
+ :'type' => :'String',
114
+ :'subscription_id' => :'String',
115
+ :'amount' => :'Float',
116
+ :'charge_type' => :'String',
117
+ :'charge' => :'SubscriptionCharge',
118
+ :'amendment' => :'Amendment',
119
+ :'state' => :'String'
120
+ }
121
+ end
122
+
123
+ # Initializes the object
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ def initialize(attributes = {})
126
+ return unless attributes.is_a?(Hash)
127
+
128
+ # convert string to symbol for hash key
129
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
130
+
131
+ if attributes.has_key?(:'pricingComponentID')
132
+ self.pricing_component_id = attributes[:'pricingComponentID']
133
+ end
134
+
135
+ if attributes.has_key?(:'pricingComponentName')
136
+ self.pricing_component_name = attributes[:'pricingComponentName']
137
+ end
138
+
139
+ if attributes.has_key?(:'pricingComponentPublicName')
140
+ self.pricing_component_public_name = attributes[:'pricingComponentPublicName']
141
+ end
142
+
143
+ if attributes.has_key?(:'newValue')
144
+ self.new_value = attributes[:'newValue']
145
+ end
146
+
147
+ if attributes.has_key?(:'oldValue')
148
+ self.old_value = attributes[:'oldValue']
149
+ end
150
+
151
+ if attributes.has_key?(:'type')
152
+ self.type = attributes[:'type']
153
+ end
154
+
155
+ if attributes.has_key?(:'subscriptionID')
156
+ self.subscription_id = attributes[:'subscriptionID']
157
+ end
158
+
159
+ if attributes.has_key?(:'amount')
160
+ self.amount = attributes[:'amount']
161
+ end
162
+
163
+ if attributes.has_key?(:'chargeType')
164
+ self.charge_type = attributes[:'chargeType']
165
+ end
166
+
167
+ if attributes.has_key?(:'charge')
168
+ self.charge = attributes[:'charge']
169
+ end
170
+
171
+ if attributes.has_key?(:'amendment')
172
+ self.amendment = attributes[:'amendment']
173
+ end
174
+
175
+ if attributes.has_key?(:'state')
176
+ self.state = attributes[:'state']
177
+ end
178
+
179
+ end
180
+
181
+ # Show invalid properties with the reasons. Usually used together with valid?
182
+ # @return Array for valid properies with the reasons
183
+ def list_invalid_properties
184
+ invalid_properties = Array.new
185
+ return invalid_properties
186
+ end
187
+
188
+ # Check to see if the all the properties in the model are valid
189
+ # @return true if the model is valid
190
+ def valid?
191
+ type_validator = EnumAttributeValidator.new('String', ["Upgrade", "Downgrade", "NoChange"])
192
+ return false unless type_validator.valid?(@type)
193
+ charge_type_validator = EnumAttributeValidator.new('String', ["Credit", "Debit"])
194
+ return false unless charge_type_validator.valid?(@charge_type)
195
+ state_validator = EnumAttributeValidator.new('String', ["Failed", "Succeeded", "Pending"])
196
+ return false unless state_validator.valid?(@state)
197
+ return true
198
+ end
199
+
200
+ # Custom attribute writer method checking allowed values (enum).
201
+ # @param [Object] type Object to be assigned
202
+ def type=(type)
203
+ validator = EnumAttributeValidator.new('String', ["Upgrade", "Downgrade", "NoChange"])
204
+ unless validator.valid?(type)
205
+ fail ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
206
+ end
207
+ @type = type
208
+ end
209
+
210
+ # Custom attribute writer method checking allowed values (enum).
211
+ # @param [Object] charge_type Object to be assigned
212
+ def charge_type=(charge_type)
213
+ validator = EnumAttributeValidator.new('String', ["Credit", "Debit"])
214
+ unless validator.valid?(charge_type)
215
+ fail ArgumentError, "invalid value for 'charge_type', must be one of #{validator.allowable_values}."
216
+ end
217
+ @charge_type = charge_type
218
+ end
219
+
220
+ # Custom attribute writer method checking allowed values (enum).
221
+ # @param [Object] state Object to be assigned
222
+ def state=(state)
223
+ validator = EnumAttributeValidator.new('String', ["Failed", "Succeeded", "Pending"])
224
+ unless validator.valid?(state)
225
+ fail ArgumentError, "invalid value for 'state', must be one of #{validator.allowable_values}."
226
+ end
227
+ @state = state
228
+ end
229
+
230
+ # Checks equality by comparing each attribute.
231
+ # @param [Object] Object to be compared
232
+ def ==(o)
233
+ return true if self.equal?(o)
234
+ self.class == o.class &&
235
+ pricing_component_id == o.pricing_component_id &&
236
+ pricing_component_name == o.pricing_component_name &&
237
+ pricing_component_public_name == o.pricing_component_public_name &&
238
+ new_value == o.new_value &&
239
+ old_value == o.old_value &&
240
+ type == o.type &&
241
+ subscription_id == o.subscription_id &&
242
+ amount == o.amount &&
243
+ charge_type == o.charge_type &&
244
+ charge == o.charge &&
245
+ amendment == o.amendment &&
246
+ state == o.state
247
+ end
248
+
249
+ # @see the `==` method
250
+ # @param [Object] Object to be compared
251
+ def eql?(o)
252
+ self == o
253
+ end
254
+
255
+ # Calculates hash code according to all attributes.
256
+ # @return [Fixnum] Hash code
257
+ def hash
258
+ [pricing_component_id, pricing_component_name, pricing_component_public_name, new_value, old_value, type, subscription_id, amount, charge_type, charge, amendment, state].hash
259
+ end
260
+
261
+ # Builds the object from hash
262
+ # @param [Hash] attributes Model attributes in the form of hash
263
+ # @return [Object] Returns the model itself
264
+ def build_from_hash(attributes)
265
+ return nil unless attributes.is_a?(Hash)
266
+ self.class.swagger_types.each_pair do |key, type|
267
+ if type =~ /^Array<(.*)>/i
268
+ # check to ensure the input is an array given that the the attribute
269
+ # is documented as an array but the input is not
270
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
271
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
272
+ end
273
+ elsif !attributes[self.class.attribute_map[key]].nil?
274
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
275
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
276
+ end
277
+
278
+ self
279
+ end
280
+
281
+ # Deserializes the data based on type
282
+ # @param string type Data type
283
+ # @param string value Value to be deserialized
284
+ # @return [Object] Deserialized data
285
+ def _deserialize(type, value)
286
+ case type.to_sym
287
+ when :DateTime
288
+ DateTime.parse(value)
289
+ when :Date
290
+ Date.parse(value)
291
+ when :String
292
+ value.to_s
293
+ when :Integer
294
+ value.to_i
295
+ when :Float
296
+ value.to_f
297
+ when :BOOLEAN
298
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
299
+ true
300
+ else
301
+ false
302
+ end
303
+ when :Object
304
+ # generic object (usually a Hash), return directly
305
+ value
306
+ when /\AArray<(?<inner_type>.+)>\z/
307
+ inner_type = Regexp.last_match[:inner_type]
308
+ value.map { |v| _deserialize(inner_type, v) }
309
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
310
+ k_type = Regexp.last_match[:k_type]
311
+ v_type = Regexp.last_match[:v_type]
312
+ {}.tap do |hash|
313
+ value.each do |k, v|
314
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
315
+ end
316
+ end
317
+ else # model
318
+ temp_model = BillForward.const_get(type).new
319
+ temp_model.build_from_hash(value)
320
+ end
321
+ end
322
+
323
+ # Returns the string representation of the object
324
+ # @return [String] String presentation of the object
325
+ def to_s
326
+ to_hash.to_s
327
+ end
328
+
329
+ # to_body is an alias to to_hash (backward compatibility)
330
+ # @return [Hash] Returns the object in the form of hash
331
+ def to_body
332
+ to_hash
333
+ end
334
+
335
+ # Returns the object in the form of hash
336
+ # @return [Hash] Returns the object in the form of hash
337
+ def to_hash
338
+ hash = {}
339
+ self.class.attribute_map.each_pair do |attr, param|
340
+ value = self.send(attr)
341
+ next if value.nil?
342
+ hash[param] = _to_hash(value)
343
+ end
344
+ hash
345
+ end
346
+
347
+ # Outputs non-array value in the form of hash
348
+ # For object, use to_hash. Otherwise, just return the value
349
+ # @param [Object] value Any valid value
350
+ # @return [Hash] Returns the value in the form of hash
351
+ def _to_hash(value)
352
+ if value.is_a?(Array)
353
+ value.compact.map{ |v| _to_hash(v) }
354
+ elsif value.is_a?(Hash)
355
+ {}.tap do |hash|
356
+ value.each { |k, v| hash[k] = _to_hash(v) }
357
+ end
358
+ elsif value.respond_to? :to_hash
359
+ value.to_hash
360
+ else
361
+ value
362
+ end
363
+ end
364
+
365
+ end
366
+
367
+ end
@@ -0,0 +1,253 @@
1
+ =begin
2
+ #BillForward REST API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require 'date'
25
+
26
+ module BillForward
27
+ # UpdatePricingComponentValueRequest
28
+ class UpdatePricingComponentValueRequest
29
+ # {\"default\":\"Default\",\"description\":\"Whether the value change will apply immediately or at the period end. If no value is specified the pricing components behaviour on the rate-plan will be used. The following values are available: <ul><li>Immediate: The change will be applied immediately by creating a new Charge against the subscription.</li><li>AtPeriodEnd: The change will be delayed to the billing period end through an amendment. Any Pending Update Amendment already existing will be Discarded.</li><li>Default: The pricing components behaviour on the rate-plan will be used.</li></ul>\",\"verbs\":[\"POST\"]}
30
+ attr_accessor :change_mode
31
+
32
+ # The new value.
33
+ attr_accessor :value
34
+
35
+ # The name or ID of the pricing component to update.
36
+ attr_accessor :logical_component_id
37
+
38
+ class EnumAttributeValidator
39
+ attr_reader :datatype
40
+ attr_reader :allowable_values
41
+
42
+ def initialize(datatype, allowable_values)
43
+ @allowable_values = allowable_values.map do |value|
44
+ case datatype.to_s
45
+ when /Integer/i
46
+ value.to_i
47
+ when /Float/i
48
+ value.to_f
49
+ else
50
+ value
51
+ end
52
+ end
53
+ end
54
+
55
+ def valid?(value)
56
+ !value || allowable_values.include?(value)
57
+ end
58
+ end
59
+
60
+ # Attribute mapping from ruby-style variable name to JSON key.
61
+ def self.attribute_map
62
+ {
63
+ :'change_mode' => :'changeMode',
64
+ :'value' => :'value',
65
+ :'logical_component_id' => :'logicalComponentID'
66
+ }
67
+ end
68
+
69
+ # Attribute type mapping.
70
+ def self.swagger_types
71
+ {
72
+ :'change_mode' => :'String',
73
+ :'value' => :'Integer',
74
+ :'logical_component_id' => :'String'
75
+ }
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ return unless attributes.is_a?(Hash)
82
+
83
+ # convert string to symbol for hash key
84
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
85
+
86
+ if attributes.has_key?(:'changeMode')
87
+ self.change_mode = attributes[:'changeMode']
88
+ end
89
+
90
+ if attributes.has_key?(:'value')
91
+ self.value = attributes[:'value']
92
+ end
93
+
94
+ if attributes.has_key?(:'logicalComponentID')
95
+ self.logical_component_id = attributes[:'logicalComponentID']
96
+ end
97
+
98
+ end
99
+
100
+ # Show invalid properties with the reasons. Usually used together with valid?
101
+ # @return Array for valid properies with the reasons
102
+ def list_invalid_properties
103
+ invalid_properties = Array.new
104
+ return invalid_properties
105
+ end
106
+
107
+ # Check to see if the all the properties in the model are valid
108
+ # @return true if the model is valid
109
+ def valid?
110
+ change_mode_validator = EnumAttributeValidator.new('String', ["Default", "Immediate", "AtPeriodEnd"])
111
+ return false unless change_mode_validator.valid?(@change_mode)
112
+ return true
113
+ end
114
+
115
+ # Custom attribute writer method checking allowed values (enum).
116
+ # @param [Object] change_mode Object to be assigned
117
+ def change_mode=(change_mode)
118
+ validator = EnumAttributeValidator.new('String', ["Default", "Immediate", "AtPeriodEnd"])
119
+ unless validator.valid?(change_mode)
120
+ fail ArgumentError, "invalid value for 'change_mode', must be one of #{validator.allowable_values}."
121
+ end
122
+ @change_mode = change_mode
123
+ end
124
+
125
+ # Checks equality by comparing each attribute.
126
+ # @param [Object] Object to be compared
127
+ def ==(o)
128
+ return true if self.equal?(o)
129
+ self.class == o.class &&
130
+ change_mode == o.change_mode &&
131
+ value == o.value &&
132
+ logical_component_id == o.logical_component_id
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 [Fixnum] Hash code
143
+ def hash
144
+ [change_mode, value, logical_component_id].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 build_from_hash(attributes)
151
+ return nil unless attributes.is_a?(Hash)
152
+ self.class.swagger_types.each_pair do |key, type|
153
+ if type =~ /^Array<(.*)>/i
154
+ # check to ensure the input is an array given that the the attribute
155
+ # is documented as an array but the input is not
156
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
157
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
158
+ end
159
+ elsif !attributes[self.class.attribute_map[key]].nil?
160
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
161
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
162
+ end
163
+
164
+ self
165
+ end
166
+
167
+ # Deserializes the data based on type
168
+ # @param string type Data type
169
+ # @param string value Value to be deserialized
170
+ # @return [Object] Deserialized data
171
+ def _deserialize(type, value)
172
+ case type.to_sym
173
+ when :DateTime
174
+ DateTime.parse(value)
175
+ when :Date
176
+ Date.parse(value)
177
+ when :String
178
+ value.to_s
179
+ when :Integer
180
+ value.to_i
181
+ when :Float
182
+ value.to_f
183
+ when :BOOLEAN
184
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
185
+ true
186
+ else
187
+ false
188
+ end
189
+ when :Object
190
+ # generic object (usually a Hash), return directly
191
+ value
192
+ when /\AArray<(?<inner_type>.+)>\z/
193
+ inner_type = Regexp.last_match[:inner_type]
194
+ value.map { |v| _deserialize(inner_type, v) }
195
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
196
+ k_type = Regexp.last_match[:k_type]
197
+ v_type = Regexp.last_match[:v_type]
198
+ {}.tap do |hash|
199
+ value.each do |k, v|
200
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
201
+ end
202
+ end
203
+ else # model
204
+ temp_model = BillForward.const_get(type).new
205
+ temp_model.build_from_hash(value)
206
+ end
207
+ end
208
+
209
+ # Returns the string representation of the object
210
+ # @return [String] String presentation of the object
211
+ def to_s
212
+ to_hash.to_s
213
+ end
214
+
215
+ # to_body is an alias to to_hash (backward compatibility)
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_body
218
+ to_hash
219
+ end
220
+
221
+ # Returns the object in the form of hash
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_hash
224
+ hash = {}
225
+ self.class.attribute_map.each_pair do |attr, param|
226
+ value = self.send(attr)
227
+ next if value.nil?
228
+ hash[param] = _to_hash(value)
229
+ end
230
+ hash
231
+ end
232
+
233
+ # Outputs non-array value in the form of hash
234
+ # For object, use to_hash. Otherwise, just return the value
235
+ # @param [Object] value Any valid value
236
+ # @return [Hash] Returns the value in the form of hash
237
+ def _to_hash(value)
238
+ if value.is_a?(Array)
239
+ value.compact.map{ |v| _to_hash(v) }
240
+ elsif value.is_a?(Hash)
241
+ {}.tap do |hash|
242
+ value.each { |k, v| hash[k] = _to_hash(v) }
243
+ end
244
+ elsif value.respond_to? :to_hash
245
+ value.to_hash
246
+ else
247
+ value
248
+ end
249
+ end
250
+
251
+ end
252
+
253
+ end