fastly 8.0.1 → 8.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +198 -130
  3. data/Gemfile.lock +1 -1
  4. data/README.md +13 -7
  5. data/docs/{ErrorResponse.md → AutomationTokenErrorResponse.md} +1 -1
  6. data/docs/AutomationTokensApi.md +2 -2
  7. data/docs/Backend.md +1 -1
  8. data/docs/BackendApi.md +4 -4
  9. data/docs/BackendResponse.md +1 -1
  10. data/docs/BillingInvoicesApi.md +96 -0
  11. data/docs/Director.md +1 -1
  12. data/docs/DirectorApi.md +2 -2
  13. data/docs/DirectorResponse.md +1 -1
  14. data/docs/DomainInspectorHistoricalApi.md +4 -4
  15. data/docs/DomainInspectorRealtimeEntry.md +1 -1
  16. data/docs/Error.md +13 -0
  17. data/docs/ErrorResponseData.md +11 -0
  18. data/docs/Invoice.md +18 -0
  19. data/docs/InvoiceResponse.md +18 -0
  20. data/docs/Invoicelineitems.md +18 -0
  21. data/docs/KvStoreApi.md +1 -1
  22. data/docs/ListInvoicesResponse.md +11 -0
  23. data/docs/Listinvoices.md +11 -0
  24. data/docs/LoggingScalyrAdditional.md +1 -1
  25. data/docs/LoggingScalyrApi.md +4 -4
  26. data/docs/LoggingScalyrResponse.md +1 -1
  27. data/docs/Metadata.md +13 -0
  28. data/docs/OriginInspectorHistoricalApi.md +4 -4
  29. data/docs/OriginInspectorRealtimeEntry.md +1 -1
  30. data/docs/PoolAdditional.md +1 -1
  31. data/docs/PoolApi.md +4 -4
  32. data/docs/PoolResponse.md +1 -1
  33. data/docs/PoolResponsePost.md +1 -1
  34. data/docs/Pop.md +2 -2
  35. data/docs/PublishApi.md +1 -1
  36. data/docs/RealtimeEntry.md +1 -1
  37. data/docs/Results.md +2 -0
  38. data/docs/SecretStoreApi.md +4 -2
  39. data/docs/SecretStoreItemApi.md +2 -2
  40. data/docs/ServiceDetail.md +1 -1
  41. data/docs/ServiceListResponse.md +2 -2
  42. data/docs/ServiceListResponseAllOf.md +2 -2
  43. data/docs/ServiceResponse.md +1 -1
  44. data/docs/ServiceResponseAllOf.md +1 -1
  45. data/docs/TlsConfigurationResponseAttributes.md +1 -1
  46. data/docs/TlsConfigurationResponseAttributesAllOf.md +1 -1
  47. data/docs/TlsCsr.md +10 -0
  48. data/docs/TlsCsrData.md +12 -0
  49. data/docs/TlsCsrDataAttributes.md +20 -0
  50. data/docs/TlsCsrErrorResponse.md +10 -0
  51. data/docs/TlsCsrResponse.md +10 -0
  52. data/docs/TlsCsrResponseAttributes.md +10 -0
  53. data/docs/TlsCsrResponseData.md +13 -0
  54. data/docs/TlsCsrsApi.md +52 -0
  55. data/docs/TlsSubscriptionResponseAttributes.md +1 -0
  56. data/docs/TlsSubscriptionResponseAttributesAllOf.md +1 -0
  57. data/docs/TokensApi.md +1 -1
  58. data/docs/TypeTlsCsr.md +9 -0
  59. data/docs/VclApi.md +1 -1
  60. data/docs/WafActiveRulesApi.md +1 -1
  61. data/lib/fastly/api/automation_tokens_api.rb +3 -3
  62. data/lib/fastly/api/backend_api.rb +4 -4
  63. data/lib/fastly/api/billing_invoices_api.rb +151 -0
  64. data/lib/fastly/api/director_api.rb +2 -2
  65. data/lib/fastly/api/domain_inspector_historical_api.rb +4 -4
  66. data/lib/fastly/api/kv_store_api.rb +2 -2
  67. data/lib/fastly/api/logging_scalyr_api.rb +4 -4
  68. data/lib/fastly/api/origin_inspector_historical_api.rb +4 -4
  69. data/lib/fastly/api/pool_api.rb +4 -4
  70. data/lib/fastly/api/publish_api.rb +2 -2
  71. data/lib/fastly/api/secret_store_api.rb +5 -2
  72. data/lib/fastly/api/secret_store_item_api.rb +2 -2
  73. data/lib/fastly/api/tls_csrs_api.rb +83 -0
  74. data/lib/fastly/api/tokens_api.rb +2 -2
  75. data/lib/fastly/api/vcl_api.rb +2 -2
  76. data/lib/fastly/api/waf_active_rules_api.rb +2 -2
  77. data/lib/fastly/configuration.rb +18 -0
  78. data/lib/fastly/models/{error_response.rb → automation_token_error_response.rb} +3 -3
  79. data/lib/fastly/models/backend.rb +1 -1
  80. data/lib/fastly/models/backend_response.rb +1 -1
  81. data/lib/fastly/models/director.rb +1 -1
  82. data/lib/fastly/models/director_response.rb +1 -1
  83. data/lib/fastly/models/domain_inspector_realtime_entry.rb +1 -1
  84. data/lib/fastly/models/error.rb +243 -0
  85. data/lib/fastly/models/error_response_data.rb +225 -0
  86. data/lib/fastly/models/event_attributes.rb +2 -2
  87. data/lib/fastly/models/invoice.rb +298 -0
  88. data/lib/fastly/models/invoice_response.rb +305 -0
  89. data/lib/fastly/models/invoicelineitems.rb +297 -0
  90. data/lib/fastly/models/list_invoices_response.rb +234 -0
  91. data/lib/fastly/models/listinvoices.rb +227 -0
  92. data/lib/fastly/models/logging_scalyr_additional.rb +1 -1
  93. data/lib/fastly/models/logging_scalyr_response.rb +1 -1
  94. data/lib/fastly/models/metadata.rb +250 -0
  95. data/lib/fastly/models/origin_inspector_realtime_entry.rb +1 -1
  96. data/lib/fastly/models/pool_additional.rb +1 -1
  97. data/lib/fastly/models/pool_response.rb +1 -1
  98. data/lib/fastly/models/pool_response_post.rb +1 -1
  99. data/lib/fastly/models/pop.rb +2 -2
  100. data/lib/fastly/models/realtime_entry.rb +1 -1
  101. data/lib/fastly/models/relationship_tls_certificate.rb +1 -1
  102. data/lib/fastly/models/relationship_tls_configuration.rb +1 -1
  103. data/lib/fastly/models/results.rb +21 -1
  104. data/lib/fastly/models/service_detail.rb +1 -1
  105. data/lib/fastly/models/service_list_response.rb +2 -2
  106. data/lib/fastly/models/service_list_response_all_of.rb +2 -2
  107. data/lib/fastly/models/service_response.rb +1 -1
  108. data/lib/fastly/models/service_response_all_of.rb +1 -1
  109. data/lib/fastly/models/tls_configuration_response_attributes.rb +1 -1
  110. data/lib/fastly/models/tls_configuration_response_attributes_all_of.rb +1 -1
  111. data/lib/fastly/models/tls_csr.rb +216 -0
  112. data/lib/fastly/models/tls_csr_data.rb +236 -0
  113. data/lib/fastly/models/tls_csr_data_attributes.rb +358 -0
  114. data/lib/fastly/models/tls_csr_error_response.rb +218 -0
  115. data/lib/fastly/models/tls_csr_response.rb +216 -0
  116. data/lib/fastly/models/tls_csr_response_attributes.rb +217 -0
  117. data/lib/fastly/models/tls_csr_response_data.rb +245 -0
  118. data/lib/fastly/models/tls_subscription_data_attributes.rb +2 -2
  119. data/lib/fastly/models/tls_subscription_response_attributes.rb +14 -4
  120. data/lib/fastly/models/tls_subscription_response_attributes_all_of.rb +14 -4
  121. data/lib/fastly/models/type_tls_csr.rb +34 -0
  122. data/lib/fastly/version.rb +1 -1
  123. data/lib/fastly.rb +19 -1
  124. data/sig.json +1 -1
  125. metadata +40 -4
@@ -0,0 +1,298 @@
1
+ =begin
2
+ #Fastly API
3
+
4
+ #Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://developer.fastly.com/reference/api/)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: oss@fastly.com
8
+
9
+ =end
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module Fastly
15
+ class Invoice
16
+ # Customer ID associated with the invoice.
17
+ attr_accessor :customer_id
18
+
19
+ # Alphanumeric string identifying the invoice.
20
+ attr_accessor :invoice_id
21
+
22
+ # Date and time invoice was posted on, in ISO 8601 format.
23
+ attr_accessor :invoice_posted_on
24
+
25
+ # Date and time (in ISO 8601 format) for initiation point of a billing cycle, signifying the start of charges for a service or subscription.
26
+ attr_accessor :billing_start_date
27
+
28
+ # Date and time (in ISO 8601 format) for termination point of a billing cycle, signifying the end of charges for a service or subscription.
29
+ attr_accessor :billing_end_date
30
+
31
+ # Alphanumeric string identifying the statement number.
32
+ attr_accessor :statement_number
33
+
34
+ # Three-letter code representing a specific currency used for financial transactions.
35
+ attr_accessor :currency_code
36
+
37
+ # Total billable amount for invoiced services charged within a single month.
38
+ attr_accessor :monthly_transaction_amount
39
+
40
+ attr_accessor :transaction_line_items
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'customer_id' => :'customer_id',
46
+ :'invoice_id' => :'invoice_id',
47
+ :'invoice_posted_on' => :'invoice_posted_on',
48
+ :'billing_start_date' => :'billing_start_date',
49
+ :'billing_end_date' => :'billing_end_date',
50
+ :'statement_number' => :'statement_number',
51
+ :'currency_code' => :'currency_code',
52
+ :'monthly_transaction_amount' => :'monthly_transaction_amount',
53
+ :'transaction_line_items' => :'transaction_line_items'
54
+ }
55
+ end
56
+
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ attribute_map.values
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.fastly_types
64
+ {
65
+ :'customer_id' => :'String',
66
+ :'invoice_id' => :'String',
67
+ :'invoice_posted_on' => :'Time',
68
+ :'billing_start_date' => :'Time',
69
+ :'billing_end_date' => :'Time',
70
+ :'statement_number' => :'String',
71
+ :'currency_code' => :'String',
72
+ :'monthly_transaction_amount' => :'Float',
73
+ :'transaction_line_items' => :'Array<Invoicelineitems>'
74
+ }
75
+ end
76
+
77
+ # List of attributes with nullable: true
78
+ def self.fastly_nullable
79
+ Set.new([
80
+ ])
81
+ end
82
+
83
+ # Initializes the object
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ def initialize(attributes = {})
86
+ if (!attributes.is_a?(Hash))
87
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::Invoice` initialize method"
88
+ end
89
+
90
+ # check to see if the attribute exists and convert string to symbol for hash key
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!self.class.attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::Invoice`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'customer_id')
99
+ self.customer_id = attributes[:'customer_id']
100
+ end
101
+
102
+ if attributes.key?(:'invoice_id')
103
+ self.invoice_id = attributes[:'invoice_id']
104
+ end
105
+
106
+ if attributes.key?(:'invoice_posted_on')
107
+ self.invoice_posted_on = attributes[:'invoice_posted_on']
108
+ end
109
+
110
+ if attributes.key?(:'billing_start_date')
111
+ self.billing_start_date = attributes[:'billing_start_date']
112
+ end
113
+
114
+ if attributes.key?(:'billing_end_date')
115
+ self.billing_end_date = attributes[:'billing_end_date']
116
+ end
117
+
118
+ if attributes.key?(:'statement_number')
119
+ self.statement_number = attributes[:'statement_number']
120
+ end
121
+
122
+ if attributes.key?(:'currency_code')
123
+ self.currency_code = attributes[:'currency_code']
124
+ end
125
+
126
+ if attributes.key?(:'monthly_transaction_amount')
127
+ self.monthly_transaction_amount = attributes[:'monthly_transaction_amount']
128
+ end
129
+
130
+ if attributes.key?(:'transaction_line_items')
131
+ if (value = attributes[:'transaction_line_items']).is_a?(Array)
132
+ self.transaction_line_items = value
133
+ end
134
+ end
135
+ end
136
+
137
+ # Show invalid properties with the reasons. Usually used together with valid?
138
+ # @return Array for valid properties with the reasons
139
+ def list_invalid_properties
140
+ invalid_properties = Array.new
141
+ invalid_properties
142
+ end
143
+
144
+ # Check to see if the all the properties in the model are valid
145
+ # @return true if the model is valid
146
+ def valid?
147
+ true
148
+ end
149
+
150
+ # Checks equality by comparing each attribute.
151
+ # @param [Object] Object to be compared
152
+ def ==(o)
153
+ return true if self.equal?(o)
154
+ self.class == o.class &&
155
+ customer_id == o.customer_id &&
156
+ invoice_id == o.invoice_id &&
157
+ invoice_posted_on == o.invoice_posted_on &&
158
+ billing_start_date == o.billing_start_date &&
159
+ billing_end_date == o.billing_end_date &&
160
+ statement_number == o.statement_number &&
161
+ currency_code == o.currency_code &&
162
+ monthly_transaction_amount == o.monthly_transaction_amount &&
163
+ transaction_line_items == o.transaction_line_items
164
+ end
165
+
166
+ # @see the `==` method
167
+ # @param [Object] Object to be compared
168
+ def eql?(o)
169
+ self == o
170
+ end
171
+
172
+ # Calculates hash code according to all attributes.
173
+ # @return [Integer] Hash code
174
+ def hash
175
+ [customer_id, invoice_id, invoice_posted_on, billing_start_date, billing_end_date, statement_number, currency_code, monthly_transaction_amount, transaction_line_items].hash
176
+ end
177
+
178
+ # Builds the object from hash
179
+ # @param [Hash] attributes Model attributes in the form of hash
180
+ # @return [Object] Returns the model itself
181
+ def self.build_from_hash(attributes)
182
+ new.build_from_hash(attributes)
183
+ end
184
+
185
+ # Builds the object from hash
186
+ # @param [Hash] attributes Model attributes in the form of hash
187
+ # @return [Object] Returns the model itself
188
+ def build_from_hash(attributes)
189
+ return nil unless attributes.is_a?(Hash)
190
+ self.class.fastly_types.each_pair do |key, type|
191
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
192
+ self.send("#{key}=", nil)
193
+ elsif type =~ /\AArray<(.*)>/i
194
+ # check to ensure the input is an array given that the attribute
195
+ # is documented as an array but the input is not
196
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
197
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
198
+ end
199
+ elsif !attributes[self.class.attribute_map[key]].nil?
200
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
201
+ end
202
+ end
203
+
204
+ self
205
+ end
206
+
207
+ # Deserializes the data based on type
208
+ # @param string type Data type
209
+ # @param string value Value to be deserialized
210
+ # @return [Object] Deserialized data
211
+ def _deserialize(type, value)
212
+ case type.to_sym
213
+ when :Time
214
+ Time.parse(value)
215
+ when :Date
216
+ Date.parse(value)
217
+ when :String
218
+ value.to_s
219
+ when :Integer
220
+ value.to_i
221
+ when :Float
222
+ value.to_f
223
+ when :Boolean
224
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
225
+ true
226
+ else
227
+ false
228
+ end
229
+ when :Object
230
+ # generic object (usually a Hash), return directly
231
+ value
232
+ when /\AArray<(?<inner_type>.+)>\z/
233
+ inner_type = Regexp.last_match[:inner_type]
234
+ value.map { |v| _deserialize(inner_type, v) }
235
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
236
+ k_type = Regexp.last_match[:k_type]
237
+ v_type = Regexp.last_match[:v_type]
238
+ {}.tap do |hash|
239
+ value.each do |k, v|
240
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
241
+ end
242
+ end
243
+ else # model
244
+ # models (e.g. Pet) or oneOf
245
+ klass = Fastly.const_get(type)
246
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
247
+ end
248
+ end
249
+
250
+ # Returns the string representation of the object
251
+ # @return [String] String presentation of the object
252
+ def to_s
253
+ to_hash.to_s
254
+ end
255
+
256
+ # to_body is an alias to to_hash (backward compatibility)
257
+ # @return [Hash] Returns the object in the form of hash
258
+ def to_body
259
+ to_hash
260
+ end
261
+
262
+ # Returns the object in the form of hash
263
+ # @return [Hash] Returns the object in the form of hash
264
+ def to_hash
265
+ hash = {}
266
+ self.class.attribute_map.each_pair do |attr, param|
267
+ value = self.send(attr)
268
+ if value.nil?
269
+ is_nullable = self.class.fastly_nullable.include?(attr)
270
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
271
+ end
272
+
273
+ hash[param] = _to_hash(value)
274
+ end
275
+ hash
276
+ end
277
+
278
+ # Outputs non-array value in the form of hash
279
+ # For object, use to_hash. Otherwise, just return the value
280
+ # @param [Object] value Any valid value
281
+ # @return [Hash] Returns the value in the form of hash
282
+ def _to_hash(value)
283
+ if value.is_a?(Array)
284
+ value.compact.map { |v| _to_hash(v) }
285
+ elsif value.is_a?(Hash)
286
+ {}.tap do |hash|
287
+ value.each { |k, v| hash[k] = _to_hash(v) }
288
+ end
289
+ elsif value.respond_to? :to_hash
290
+ value.to_hash
291
+ else
292
+ value
293
+ end
294
+ end
295
+
296
+ end
297
+
298
+ end
@@ -0,0 +1,305 @@
1
+ =begin
2
+ #Fastly API
3
+
4
+ #Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://developer.fastly.com/reference/api/)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: oss@fastly.com
8
+
9
+ =end
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module Fastly
15
+ class InvoiceResponse
16
+ # Customer ID associated with the invoice.
17
+ attr_accessor :customer_id
18
+
19
+ # Alphanumeric string identifying the invoice.
20
+ attr_accessor :invoice_id
21
+
22
+ # Date and time invoice was posted on, in ISO 8601 format.
23
+ attr_accessor :invoice_posted_on
24
+
25
+ # Date and time (in ISO 8601 format) for initiation point of a billing cycle, signifying the start of charges for a service or subscription.
26
+ attr_accessor :billing_start_date
27
+
28
+ # Date and time (in ISO 8601 format) for termination point of a billing cycle, signifying the end of charges for a service or subscription.
29
+ attr_accessor :billing_end_date
30
+
31
+ # Alphanumeric string identifying the statement number.
32
+ attr_accessor :statement_number
33
+
34
+ # Three-letter code representing a specific currency used for financial transactions.
35
+ attr_accessor :currency_code
36
+
37
+ # Total billable amount for invoiced services charged within a single month.
38
+ attr_accessor :monthly_transaction_amount
39
+
40
+ attr_accessor :transaction_line_items
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'customer_id' => :'customer_id',
46
+ :'invoice_id' => :'invoice_id',
47
+ :'invoice_posted_on' => :'invoice_posted_on',
48
+ :'billing_start_date' => :'billing_start_date',
49
+ :'billing_end_date' => :'billing_end_date',
50
+ :'statement_number' => :'statement_number',
51
+ :'currency_code' => :'currency_code',
52
+ :'monthly_transaction_amount' => :'monthly_transaction_amount',
53
+ :'transaction_line_items' => :'transaction_line_items'
54
+ }
55
+ end
56
+
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ attribute_map.values
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.fastly_types
64
+ {
65
+ :'customer_id' => :'String',
66
+ :'invoice_id' => :'String',
67
+ :'invoice_posted_on' => :'Time',
68
+ :'billing_start_date' => :'Time',
69
+ :'billing_end_date' => :'Time',
70
+ :'statement_number' => :'String',
71
+ :'currency_code' => :'String',
72
+ :'monthly_transaction_amount' => :'Float',
73
+ :'transaction_line_items' => :'Array<Invoicelineitems>'
74
+ }
75
+ end
76
+
77
+ # List of attributes with nullable: true
78
+ def self.fastly_nullable
79
+ Set.new([
80
+ ])
81
+ end
82
+
83
+ # List of class defined in allOf (OpenAPI v3)
84
+ def self.fastly_all_of
85
+ [
86
+ :'Invoice'
87
+ ]
88
+ end
89
+
90
+ # Initializes the object
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ def initialize(attributes = {})
93
+ if (!attributes.is_a?(Hash))
94
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::InvoiceResponse` initialize method"
95
+ end
96
+
97
+ # check to see if the attribute exists and convert string to symbol for hash key
98
+ attributes = attributes.each_with_object({}) { |(k, v), h|
99
+ if (!self.class.attribute_map.key?(k.to_sym))
100
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::InvoiceResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
101
+ end
102
+ h[k.to_sym] = v
103
+ }
104
+
105
+ if attributes.key?(:'customer_id')
106
+ self.customer_id = attributes[:'customer_id']
107
+ end
108
+
109
+ if attributes.key?(:'invoice_id')
110
+ self.invoice_id = attributes[:'invoice_id']
111
+ end
112
+
113
+ if attributes.key?(:'invoice_posted_on')
114
+ self.invoice_posted_on = attributes[:'invoice_posted_on']
115
+ end
116
+
117
+ if attributes.key?(:'billing_start_date')
118
+ self.billing_start_date = attributes[:'billing_start_date']
119
+ end
120
+
121
+ if attributes.key?(:'billing_end_date')
122
+ self.billing_end_date = attributes[:'billing_end_date']
123
+ end
124
+
125
+ if attributes.key?(:'statement_number')
126
+ self.statement_number = attributes[:'statement_number']
127
+ end
128
+
129
+ if attributes.key?(:'currency_code')
130
+ self.currency_code = attributes[:'currency_code']
131
+ end
132
+
133
+ if attributes.key?(:'monthly_transaction_amount')
134
+ self.monthly_transaction_amount = attributes[:'monthly_transaction_amount']
135
+ end
136
+
137
+ if attributes.key?(:'transaction_line_items')
138
+ if (value = attributes[:'transaction_line_items']).is_a?(Array)
139
+ self.transaction_line_items = value
140
+ end
141
+ end
142
+ end
143
+
144
+ # Show invalid properties with the reasons. Usually used together with valid?
145
+ # @return Array for valid properties with the reasons
146
+ def list_invalid_properties
147
+ invalid_properties = Array.new
148
+ invalid_properties
149
+ end
150
+
151
+ # Check to see if the all the properties in the model are valid
152
+ # @return true if the model is valid
153
+ def valid?
154
+ true
155
+ end
156
+
157
+ # Checks equality by comparing each attribute.
158
+ # @param [Object] Object to be compared
159
+ def ==(o)
160
+ return true if self.equal?(o)
161
+ self.class == o.class &&
162
+ customer_id == o.customer_id &&
163
+ invoice_id == o.invoice_id &&
164
+ invoice_posted_on == o.invoice_posted_on &&
165
+ billing_start_date == o.billing_start_date &&
166
+ billing_end_date == o.billing_end_date &&
167
+ statement_number == o.statement_number &&
168
+ currency_code == o.currency_code &&
169
+ monthly_transaction_amount == o.monthly_transaction_amount &&
170
+ transaction_line_items == o.transaction_line_items
171
+ end
172
+
173
+ # @see the `==` method
174
+ # @param [Object] Object to be compared
175
+ def eql?(o)
176
+ self == o
177
+ end
178
+
179
+ # Calculates hash code according to all attributes.
180
+ # @return [Integer] Hash code
181
+ def hash
182
+ [customer_id, invoice_id, invoice_posted_on, billing_start_date, billing_end_date, statement_number, currency_code, monthly_transaction_amount, transaction_line_items].hash
183
+ end
184
+
185
+ # Builds the object from hash
186
+ # @param [Hash] attributes Model attributes in the form of hash
187
+ # @return [Object] Returns the model itself
188
+ def self.build_from_hash(attributes)
189
+ new.build_from_hash(attributes)
190
+ end
191
+
192
+ # Builds the object from hash
193
+ # @param [Hash] attributes Model attributes in the form of hash
194
+ # @return [Object] Returns the model itself
195
+ def build_from_hash(attributes)
196
+ return nil unless attributes.is_a?(Hash)
197
+ self.class.fastly_types.each_pair do |key, type|
198
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
199
+ self.send("#{key}=", nil)
200
+ elsif type =~ /\AArray<(.*)>/i
201
+ # check to ensure the input is an array given that the attribute
202
+ # is documented as an array but the input is not
203
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
204
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
205
+ end
206
+ elsif !attributes[self.class.attribute_map[key]].nil?
207
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
208
+ end
209
+ end
210
+
211
+ self
212
+ end
213
+
214
+ # Deserializes the data based on type
215
+ # @param string type Data type
216
+ # @param string value Value to be deserialized
217
+ # @return [Object] Deserialized data
218
+ def _deserialize(type, value)
219
+ case type.to_sym
220
+ when :Time
221
+ Time.parse(value)
222
+ when :Date
223
+ Date.parse(value)
224
+ when :String
225
+ value.to_s
226
+ when :Integer
227
+ value.to_i
228
+ when :Float
229
+ value.to_f
230
+ when :Boolean
231
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
232
+ true
233
+ else
234
+ false
235
+ end
236
+ when :Object
237
+ # generic object (usually a Hash), return directly
238
+ value
239
+ when /\AArray<(?<inner_type>.+)>\z/
240
+ inner_type = Regexp.last_match[:inner_type]
241
+ value.map { |v| _deserialize(inner_type, v) }
242
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
243
+ k_type = Regexp.last_match[:k_type]
244
+ v_type = Regexp.last_match[:v_type]
245
+ {}.tap do |hash|
246
+ value.each do |k, v|
247
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
248
+ end
249
+ end
250
+ else # model
251
+ # models (e.g. Pet) or oneOf
252
+ klass = Fastly.const_get(type)
253
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
254
+ end
255
+ end
256
+
257
+ # Returns the string representation of the object
258
+ # @return [String] String presentation of the object
259
+ def to_s
260
+ to_hash.to_s
261
+ end
262
+
263
+ # to_body is an alias to to_hash (backward compatibility)
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_body
266
+ to_hash
267
+ end
268
+
269
+ # Returns the object in the form of hash
270
+ # @return [Hash] Returns the object in the form of hash
271
+ def to_hash
272
+ hash = {}
273
+ self.class.attribute_map.each_pair do |attr, param|
274
+ value = self.send(attr)
275
+ if value.nil?
276
+ is_nullable = self.class.fastly_nullable.include?(attr)
277
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
278
+ end
279
+
280
+ hash[param] = _to_hash(value)
281
+ end
282
+ hash
283
+ end
284
+
285
+ # Outputs non-array value in the form of hash
286
+ # For object, use to_hash. Otherwise, just return the value
287
+ # @param [Object] value Any valid value
288
+ # @return [Hash] Returns the value in the form of hash
289
+ def _to_hash(value)
290
+ if value.is_a?(Array)
291
+ value.compact.map { |v| _to_hash(v) }
292
+ elsif value.is_a?(Hash)
293
+ {}.tap do |hash|
294
+ value.each { |k, v| hash[k] = _to_hash(v) }
295
+ end
296
+ elsif value.respond_to? :to_hash
297
+ value.to_hash
298
+ else
299
+ value
300
+ end
301
+ end
302
+
303
+ end
304
+
305
+ end