pnap_billing_api 2.1.2 → 3.0.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.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/VERSION +1 -1
- data/docs/BandwidthRecord.md +4 -2
- data/docs/LocationAvailabilityDetail.md +1 -1
- data/docs/OperatingSystemRecord.md +4 -2
- data/docs/PackageDetails.md +20 -0
- data/docs/PackageQuantity.md +20 -0
- data/docs/PricingPlan.md +3 -1
- data/docs/ProductAvailabilityApi.md +4 -4
- data/docs/ProductLocationEnum.md +15 -0
- data/docs/PublicSubnetRecord.md +4 -2
- data/docs/Quantity.md +20 -0
- data/docs/QuantityUnitEnum.md +15 -0
- data/docs/RatedUsageRecord.md +4 -2
- data/docs/Reservation.md +10 -2
- data/docs/ReservationDetails.md +20 -0
- data/docs/ReservationRequest.md +3 -1
- data/docs/ReservationStateEnum.md +15 -0
- data/docs/ReservationTerm.md +20 -0
- data/docs/ReservationsApi.md +2 -2
- data/docs/ServerRecord.md +4 -2
- data/docs/StorageDetails.md +5 -5
- data/docs/StorageRecord.md +4 -2
- data/docs/Utilization.md +20 -0
- data/lib/pnap_billing_api/api/billing_configurations_api.rb +2 -2
- data/lib/pnap_billing_api/api/product_availability_api.rb +14 -6
- data/lib/pnap_billing_api/api/products_api.rb +2 -2
- data/lib/pnap_billing_api/api/rated_usage_api.rb +3 -3
- data/lib/pnap_billing_api/api/reservations_api.rb +7 -7
- data/lib/pnap_billing_api/api_client.rb +17 -14
- data/lib/pnap_billing_api/api_error.rb +1 -1
- data/lib/pnap_billing_api/api_model_base.rb +88 -0
- data/lib/pnap_billing_api/configuration.rb +11 -1
- data/lib/pnap_billing_api/models/applicable_discount_details.rb +41 -78
- data/lib/pnap_billing_api/models/applicable_discounts.rb +11 -78
- data/lib/pnap_billing_api/models/bandwidth_details.rb +31 -78
- data/lib/pnap_billing_api/models/bandwidth_record.rb +151 -93
- data/lib/pnap_billing_api/models/configuration_details.rb +11 -78
- data/lib/pnap_billing_api/models/credit_details.rb +5 -7
- data/lib/pnap_billing_api/models/credit_details_base.rb +31 -78
- data/lib/pnap_billing_api/models/credit_type_enum.rb +1 -1
- data/lib/pnap_billing_api/models/discount_details.rb +41 -78
- data/lib/pnap_billing_api/models/discount_type_enum.rb +1 -1
- data/lib/pnap_billing_api/models/error.rb +21 -78
- data/lib/pnap_billing_api/models/gpu_configuration_metadata.rb +11 -78
- data/lib/pnap_billing_api/models/location_availability_detail.rb +52 -79
- data/lib/pnap_billing_api/models/location_enum.rb +1 -1
- data/lib/pnap_billing_api/models/operating_system_details.rb +31 -78
- data/lib/pnap_billing_api/models/operating_system_record.rb +151 -93
- data/lib/pnap_billing_api/models/package_details.rb +179 -0
- data/lib/pnap_billing_api/models/package_quantity.rb +193 -0
- data/lib/pnap_billing_api/models/package_unit_enum.rb +1 -1
- data/lib/pnap_billing_api/models/price_unit_enum.rb +3 -2
- data/lib/pnap_billing_api/models/pricing_plan.rb +56 -84
- data/lib/pnap_billing_api/models/product.rb +31 -78
- data/lib/pnap_billing_api/models/product_availability.rb +41 -78
- data/lib/pnap_billing_api/models/product_category_enum.rb +1 -1
- data/lib/pnap_billing_api/models/product_location_enum.rb +44 -0
- data/lib/pnap_billing_api/models/products_get200_response_inner.rb +1 -2
- data/lib/pnap_billing_api/models/promo_credit_details.rb +51 -78
- data/lib/pnap_billing_api/models/public_subnet_details.rb +31 -78
- data/lib/pnap_billing_api/models/public_subnet_record.rb +151 -93
- data/lib/pnap_billing_api/models/quantity.rb +223 -0
- data/lib/pnap_billing_api/models/quantity_unit_enum.rb +40 -0
- data/lib/pnap_billing_api/models/rated_usage_get200_response_inner.rb +1 -2
- data/lib/pnap_billing_api/models/rated_usage_product_category_enum.rb +1 -1
- data/lib/pnap_billing_api/models/rated_usage_record.rb +141 -93
- data/lib/pnap_billing_api/models/reservation.rb +186 -83
- data/lib/pnap_billing_api/models/reservation_auto_renew_disable_request.rb +11 -78
- data/lib/pnap_billing_api/models/reservation_details.rb +158 -0
- data/lib/pnap_billing_api/models/reservation_invoicing_model_enum.rb +1 -1
- data/lib/pnap_billing_api/models/reservation_model_enum.rb +3 -2
- data/lib/pnap_billing_api/models/reservation_product_category_enum.rb +3 -2
- data/lib/pnap_billing_api/models/reservation_request.rb +51 -82
- data/lib/pnap_billing_api/models/reservation_state_enum.rb +44 -0
- data/lib/pnap_billing_api/models/reservation_term.rb +214 -0
- data/lib/pnap_billing_api/models/server_details.rb +31 -78
- data/lib/pnap_billing_api/models/server_product.rb +41 -78
- data/lib/pnap_billing_api/models/server_product_metadata.rb +81 -78
- data/lib/pnap_billing_api/models/server_record.rb +151 -93
- data/lib/pnap_billing_api/models/storage_details.rb +21 -113
- data/lib/pnap_billing_api/models/storage_record.rb +151 -93
- data/lib/pnap_billing_api/models/system_credit_cause_enum.rb +1 -1
- data/lib/pnap_billing_api/models/system_credit_details.rb +41 -78
- data/lib/pnap_billing_api/models/threshold_configuration_details.rb +21 -78
- data/lib/pnap_billing_api/models/utilization.rb +208 -0
- data/lib/pnap_billing_api/version.rb +1 -2
- data/lib/pnap_billing_api.rb +11 -1
- data/pnap_billing_api.gemspec +6 -6
- data/spec/api/billing_configurations_api_spec.rb +1 -1
- data/spec/api/product_availability_api_spec.rb +3 -3
- data/spec/api/products_api_spec.rb +1 -1
- data/spec/api/rated_usage_api_spec.rb +1 -1
- data/spec/api/reservations_api_spec.rb +1 -1
- data/spec/models/applicable_discount_details_spec.rb +2 -2
- data/spec/models/applicable_discounts_spec.rb +2 -2
- data/spec/models/bandwidth_details_spec.rb +2 -2
- data/spec/models/bandwidth_record_spec.rb +8 -2
- data/spec/models/configuration_details_spec.rb +2 -2
- data/spec/models/credit_details_base_spec.rb +2 -2
- data/spec/models/credit_details_spec.rb +1 -1
- data/spec/models/credit_type_enum_spec.rb +2 -2
- data/spec/models/discount_details_spec.rb +2 -2
- data/spec/models/discount_type_enum_spec.rb +2 -2
- data/spec/models/error_spec.rb +2 -2
- data/spec/models/gpu_configuration_metadata_spec.rb +2 -2
- data/spec/models/location_availability_detail_spec.rb +2 -2
- data/spec/models/location_enum_spec.rb +2 -2
- data/spec/models/operating_system_details_spec.rb +2 -2
- data/spec/models/operating_system_record_spec.rb +8 -2
- data/spec/models/package_details_spec.rb +42 -0
- data/spec/models/package_quantity_spec.rb +42 -0
- data/spec/models/package_unit_enum_spec.rb +2 -2
- data/spec/models/price_unit_enum_spec.rb +2 -2
- data/spec/models/pricing_plan_spec.rb +9 -3
- data/spec/models/product_availability_spec.rb +2 -2
- data/spec/models/product_category_enum_spec.rb +2 -2
- data/spec/models/product_location_enum_spec.rb +30 -0
- data/spec/models/product_spec.rb +2 -2
- data/spec/models/products_get200_response_inner_spec.rb +1 -1
- data/spec/models/promo_credit_details_spec.rb +2 -2
- data/spec/models/public_subnet_details_spec.rb +2 -2
- data/spec/models/public_subnet_record_spec.rb +8 -2
- data/spec/models/quantity_spec.rb +42 -0
- data/spec/models/quantity_unit_enum_spec.rb +30 -0
- data/spec/models/rated_usage_get200_response_inner_spec.rb +1 -1
- data/spec/models/rated_usage_product_category_enum_spec.rb +2 -2
- data/spec/models/rated_usage_record_spec.rb +8 -2
- data/spec/models/reservation_auto_renew_disable_request_spec.rb +2 -2
- data/spec/models/reservation_details_spec.rb +42 -0
- data/spec/models/reservation_invoicing_model_enum_spec.rb +2 -2
- data/spec/models/reservation_model_enum_spec.rb +2 -2
- data/spec/models/reservation_product_category_enum_spec.rb +2 -2
- data/spec/models/reservation_request_spec.rb +8 -2
- data/spec/models/reservation_spec.rb +26 -2
- data/spec/models/reservation_state_enum_spec.rb +30 -0
- data/spec/models/reservation_term_spec.rb +42 -0
- data/spec/models/server_details_spec.rb +2 -2
- data/spec/models/server_product_metadata_spec.rb +2 -2
- data/spec/models/server_product_spec.rb +2 -2
- data/spec/models/server_record_spec.rb +8 -2
- data/spec/models/storage_details_spec.rb +2 -2
- data/spec/models/storage_record_spec.rb +8 -2
- data/spec/models/system_credit_cause_enum_spec.rb +2 -2
- data/spec/models/system_credit_details_spec.rb +2 -2
- data/spec/models/threshold_configuration_details_spec.rb +2 -2
- data/spec/models/utilization_spec.rb +42 -0
- data/spec/spec_helper.rb +1 -1
- metadata +82 -41
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Billing API
|
|
3
|
+
|
|
4
|
+
#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.<br> <br> <span class='pnap-api-knowledge-base-link'> Knowledge base articles to help you can be found <a href='https://phoenixnap.com/kb/phoenixnap-bare-metal-cloud-billing-models' target='_blank'>here</a> </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/billing/v1/)</b>
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 0.1
|
|
7
|
+
Contact: support@phoenixnap.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.20.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module BillingApi
|
|
17
|
+
# Represents details object which contains package quantity and its unit.
|
|
18
|
+
class PackageDetails < ApiModelBase
|
|
19
|
+
attr_accessor :package_quantity
|
|
20
|
+
|
|
21
|
+
attr_accessor :package_unit
|
|
22
|
+
|
|
23
|
+
class EnumAttributeValidator
|
|
24
|
+
attr_reader :datatype
|
|
25
|
+
attr_reader :allowable_values
|
|
26
|
+
|
|
27
|
+
def initialize(datatype, allowable_values)
|
|
28
|
+
@allowable_values = allowable_values.map do |value|
|
|
29
|
+
case datatype.to_s
|
|
30
|
+
when /Integer/i
|
|
31
|
+
value.to_i
|
|
32
|
+
when /Float/i
|
|
33
|
+
value.to_f
|
|
34
|
+
else
|
|
35
|
+
value
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def valid?(value)
|
|
41
|
+
!value || allowable_values.include?(value)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
46
|
+
def self.attribute_map
|
|
47
|
+
{
|
|
48
|
+
:'package_quantity' => :'packageQuantity',
|
|
49
|
+
:'package_unit' => :'packageUnit'
|
|
50
|
+
}
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Returns attribute mapping this model knows about
|
|
54
|
+
def self.acceptable_attribute_map
|
|
55
|
+
attribute_map
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Returns all the JSON keys this model knows about
|
|
59
|
+
def self.acceptable_attributes
|
|
60
|
+
acceptable_attribute_map.values
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Attribute type mapping.
|
|
64
|
+
def self.openapi_types
|
|
65
|
+
{
|
|
66
|
+
:'package_quantity' => :'PackageQuantity',
|
|
67
|
+
:'package_unit' => :'PackageUnitEnum'
|
|
68
|
+
}
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# List of attributes with nullable: true
|
|
72
|
+
def self.openapi_nullable
|
|
73
|
+
Set.new([
|
|
74
|
+
])
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Initializes the object
|
|
78
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
79
|
+
def initialize(attributes = {})
|
|
80
|
+
if (!attributes.is_a?(Hash))
|
|
81
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `BillingApi::PackageDetails` initialize method"
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
85
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
86
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
87
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
88
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::PackageDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
89
|
+
end
|
|
90
|
+
h[k.to_sym] = v
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if attributes.key?(:'package_quantity')
|
|
94
|
+
self.package_quantity = attributes[:'package_quantity']
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
if attributes.key?(:'package_unit')
|
|
98
|
+
self.package_unit = attributes[:'package_unit']
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
103
|
+
# @return Array for valid properties with the reasons
|
|
104
|
+
def list_invalid_properties
|
|
105
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
106
|
+
invalid_properties = Array.new
|
|
107
|
+
invalid_properties
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Check to see if the all the properties in the model are valid
|
|
111
|
+
# @return true if the model is valid
|
|
112
|
+
def valid?
|
|
113
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
114
|
+
true
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Checks equality by comparing each attribute.
|
|
118
|
+
# @param [Object] Object to be compared
|
|
119
|
+
def ==(o)
|
|
120
|
+
return true if self.equal?(o)
|
|
121
|
+
self.class == o.class &&
|
|
122
|
+
package_quantity == o.package_quantity &&
|
|
123
|
+
package_unit == o.package_unit
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# @see the `==` method
|
|
127
|
+
# @param [Object] Object to be compared
|
|
128
|
+
def eql?(o)
|
|
129
|
+
self == o
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Calculates hash code according to all attributes.
|
|
133
|
+
# @return [Integer] Hash code
|
|
134
|
+
def hash
|
|
135
|
+
[package_quantity, package_unit].hash
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Builds the object from hash
|
|
139
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
140
|
+
# @return [Object] Returns the model itself
|
|
141
|
+
def self.build_from_hash(attributes)
|
|
142
|
+
return nil unless attributes.is_a?(Hash)
|
|
143
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
144
|
+
transformed_hash = {}
|
|
145
|
+
openapi_types.each_pair do |key, type|
|
|
146
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
147
|
+
transformed_hash["#{key}"] = nil
|
|
148
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
149
|
+
# check to ensure the input is an array given that the attribute
|
|
150
|
+
# is documented as an array but the input is not
|
|
151
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
152
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
153
|
+
end
|
|
154
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
155
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
new(transformed_hash)
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Returns the object in the form of hash
|
|
162
|
+
# @return [Hash] Returns the object in the form of hash
|
|
163
|
+
def to_hash
|
|
164
|
+
hash = {}
|
|
165
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
166
|
+
value = self.send(attr)
|
|
167
|
+
if value.nil?
|
|
168
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
169
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
hash[param] = _to_hash(value)
|
|
173
|
+
end
|
|
174
|
+
hash
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
end
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Billing API
|
|
3
|
+
|
|
4
|
+
#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.<br> <br> <span class='pnap-api-knowledge-base-link'> Knowledge base articles to help you can be found <a href='https://phoenixnap.com/kb/phoenixnap-bare-metal-cloud-billing-models' target='_blank'>here</a> </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/billing/v1/)</b>
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 0.1
|
|
7
|
+
Contact: support@phoenixnap.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.20.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module BillingApi
|
|
17
|
+
# Represents the package size per month, for a product's pricing plan, including the min quantity and max quantity information.
|
|
18
|
+
class PackageQuantity < ApiModelBase
|
|
19
|
+
# Minimum package quantity.
|
|
20
|
+
attr_accessor :min
|
|
21
|
+
|
|
22
|
+
# Maximum package quantity.
|
|
23
|
+
attr_accessor :max
|
|
24
|
+
|
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
26
|
+
def self.attribute_map
|
|
27
|
+
{
|
|
28
|
+
:'min' => :'min',
|
|
29
|
+
:'max' => :'max'
|
|
30
|
+
}
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Returns attribute mapping this model knows about
|
|
34
|
+
def self.acceptable_attribute_map
|
|
35
|
+
attribute_map
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Returns all the JSON keys this model knows about
|
|
39
|
+
def self.acceptable_attributes
|
|
40
|
+
acceptable_attribute_map.values
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Attribute type mapping.
|
|
44
|
+
def self.openapi_types
|
|
45
|
+
{
|
|
46
|
+
:'min' => :'Float',
|
|
47
|
+
:'max' => :'Float'
|
|
48
|
+
}
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# List of attributes with nullable: true
|
|
52
|
+
def self.openapi_nullable
|
|
53
|
+
Set.new([
|
|
54
|
+
])
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Initializes the object
|
|
58
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
59
|
+
def initialize(attributes = {})
|
|
60
|
+
if (!attributes.is_a?(Hash))
|
|
61
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `BillingApi::PackageQuantity` initialize method"
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
65
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
66
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
67
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
68
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::PackageQuantity`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
69
|
+
end
|
|
70
|
+
h[k.to_sym] = v
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if attributes.key?(:'min')
|
|
74
|
+
self.min = attributes[:'min']
|
|
75
|
+
else
|
|
76
|
+
self.min = nil
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
if attributes.key?(:'max')
|
|
80
|
+
self.max = attributes[:'max']
|
|
81
|
+
else
|
|
82
|
+
self.max = nil
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
87
|
+
# @return Array for valid properties with the reasons
|
|
88
|
+
def list_invalid_properties
|
|
89
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
90
|
+
invalid_properties = Array.new
|
|
91
|
+
if @min.nil?
|
|
92
|
+
invalid_properties.push('invalid value for "min", min cannot be nil.')
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
if @max.nil?
|
|
96
|
+
invalid_properties.push('invalid value for "max", max cannot be nil.')
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
invalid_properties
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Check to see if the all the properties in the model are valid
|
|
103
|
+
# @return true if the model is valid
|
|
104
|
+
def valid?
|
|
105
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
106
|
+
return false if @min.nil?
|
|
107
|
+
return false if @max.nil?
|
|
108
|
+
true
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Custom attribute writer method with validation
|
|
112
|
+
# @param [Object] min Value to be assigned
|
|
113
|
+
def min=(min)
|
|
114
|
+
if min.nil?
|
|
115
|
+
fail ArgumentError, 'min cannot be nil'
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
@min = min
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Custom attribute writer method with validation
|
|
122
|
+
# @param [Object] max Value to be assigned
|
|
123
|
+
def max=(max)
|
|
124
|
+
if max.nil?
|
|
125
|
+
fail ArgumentError, 'max cannot be nil'
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
@max = max
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Checks equality by comparing each attribute.
|
|
132
|
+
# @param [Object] Object to be compared
|
|
133
|
+
def ==(o)
|
|
134
|
+
return true if self.equal?(o)
|
|
135
|
+
self.class == o.class &&
|
|
136
|
+
min == o.min &&
|
|
137
|
+
max == o.max
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# @see the `==` method
|
|
141
|
+
# @param [Object] Object to be compared
|
|
142
|
+
def eql?(o)
|
|
143
|
+
self == o
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Calculates hash code according to all attributes.
|
|
147
|
+
# @return [Integer] Hash code
|
|
148
|
+
def hash
|
|
149
|
+
[min, max].hash
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# Builds the object from hash
|
|
153
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
154
|
+
# @return [Object] Returns the model itself
|
|
155
|
+
def self.build_from_hash(attributes)
|
|
156
|
+
return nil unless attributes.is_a?(Hash)
|
|
157
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
158
|
+
transformed_hash = {}
|
|
159
|
+
openapi_types.each_pair do |key, type|
|
|
160
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
161
|
+
transformed_hash["#{key}"] = nil
|
|
162
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
163
|
+
# check to ensure the input is an array given that the attribute
|
|
164
|
+
# is documented as an array but the input is not
|
|
165
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
166
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
167
|
+
end
|
|
168
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
169
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
new(transformed_hash)
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Returns the object in the form of hash
|
|
176
|
+
# @return [Hash] Returns the object in the form of hash
|
|
177
|
+
def to_hash
|
|
178
|
+
hash = {}
|
|
179
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
180
|
+
value = self.send(attr)
|
|
181
|
+
if value.nil?
|
|
182
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
183
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
hash[param] = _to_hash(value)
|
|
187
|
+
end
|
|
188
|
+
hash
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
end
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 0.1
|
|
7
7
|
Contact: support@phoenixnap.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
|
|
9
|
+
Generator version: 7.20.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -21,9 +21,10 @@ module BillingApi
|
|
|
21
21
|
UNIT = "UNIT".freeze
|
|
22
22
|
FLAT = "FLAT".freeze
|
|
23
23
|
TB_PER_HOUR = "TB_PER_HOUR".freeze
|
|
24
|
+
TB_PER_MONTH = "TB_PER_MONTH".freeze
|
|
24
25
|
|
|
25
26
|
def self.all_vars
|
|
26
|
-
@all_vars ||= [HOUR, MONTH, GB, UNIT, FLAT, TB_PER_HOUR].freeze
|
|
27
|
+
@all_vars ||= [HOUR, MONTH, GB, UNIT, FLAT, TB_PER_HOUR, TB_PER_MONTH].freeze
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
# Builds the enum from string
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 0.1
|
|
7
7
|
Contact: support@phoenixnap.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
|
|
9
|
+
Generator version: 7.20.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -15,7 +15,7 @@ require 'time'
|
|
|
15
15
|
|
|
16
16
|
module BillingApi
|
|
17
17
|
# Pricing plan details.
|
|
18
|
-
class PricingPlan
|
|
18
|
+
class PricingPlan < ApiModelBase
|
|
19
19
|
# The SKU identifying this pricing plan.
|
|
20
20
|
attr_accessor :sku
|
|
21
21
|
|
|
@@ -43,6 +43,8 @@ module BillingApi
|
|
|
43
43
|
|
|
44
44
|
attr_accessor :package_unit
|
|
45
45
|
|
|
46
|
+
attr_accessor :package_details
|
|
47
|
+
|
|
46
48
|
class EnumAttributeValidator
|
|
47
49
|
attr_reader :datatype
|
|
48
50
|
attr_reader :allowable_values
|
|
@@ -77,13 +79,19 @@ module BillingApi
|
|
|
77
79
|
:'applicable_discounts' => :'applicableDiscounts',
|
|
78
80
|
:'correlated_product_code' => :'correlatedProductCode',
|
|
79
81
|
:'package_quantity' => :'packageQuantity',
|
|
80
|
-
:'package_unit' => :'packageUnit'
|
|
82
|
+
:'package_unit' => :'packageUnit',
|
|
83
|
+
:'package_details' => :'packageDetails'
|
|
81
84
|
}
|
|
82
85
|
end
|
|
83
86
|
|
|
87
|
+
# Returns attribute mapping this model knows about
|
|
88
|
+
def self.acceptable_attribute_map
|
|
89
|
+
attribute_map
|
|
90
|
+
end
|
|
91
|
+
|
|
84
92
|
# Returns all the JSON keys this model knows about
|
|
85
93
|
def self.acceptable_attributes
|
|
86
|
-
|
|
94
|
+
acceptable_attribute_map.values
|
|
87
95
|
end
|
|
88
96
|
|
|
89
97
|
# Attribute type mapping.
|
|
@@ -98,7 +106,8 @@ module BillingApi
|
|
|
98
106
|
:'applicable_discounts' => :'ApplicableDiscounts',
|
|
99
107
|
:'correlated_product_code' => :'String',
|
|
100
108
|
:'package_quantity' => :'Float',
|
|
101
|
-
:'package_unit' => :'PackageUnitEnum'
|
|
109
|
+
:'package_unit' => :'PackageUnitEnum',
|
|
110
|
+
:'package_details' => :'PackageDetails'
|
|
102
111
|
}
|
|
103
112
|
end
|
|
104
113
|
|
|
@@ -116,9 +125,10 @@ module BillingApi
|
|
|
116
125
|
end
|
|
117
126
|
|
|
118
127
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
128
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
119
129
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
120
|
-
if (!
|
|
121
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::PricingPlan`. Please check the name to make sure it's valid. List of attributes: " +
|
|
130
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
131
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::PricingPlan`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
122
132
|
end
|
|
123
133
|
h[k.to_sym] = v
|
|
124
134
|
}
|
|
@@ -172,6 +182,10 @@ module BillingApi
|
|
|
172
182
|
if attributes.key?(:'package_unit')
|
|
173
183
|
self.package_unit = attributes[:'package_unit']
|
|
174
184
|
end
|
|
185
|
+
|
|
186
|
+
if attributes.key?(:'package_details')
|
|
187
|
+
self.package_details = attributes[:'package_details']
|
|
188
|
+
end
|
|
175
189
|
end
|
|
176
190
|
|
|
177
191
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -208,7 +222,7 @@ module BillingApi
|
|
|
208
222
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
209
223
|
return false if @sku.nil?
|
|
210
224
|
return false if @location.nil?
|
|
211
|
-
location_validator = EnumAttributeValidator.new('String', ["PHX", "ASH", "NLD", "SGP", "CHI", "SEA", "
|
|
225
|
+
location_validator = EnumAttributeValidator.new('String', ["PHX", "ASH", "NLD", "SGP", "CHI", "SEA", "GLOBAL"])
|
|
212
226
|
return false unless location_validator.valid?(@location)
|
|
213
227
|
return false if @pricing_model.nil?
|
|
214
228
|
pricing_model_validator = EnumAttributeValidator.new('String', ["HOURLY", "METERED", "ONE_MONTH_RESERVATION", "TWELVE_MONTHS_RESERVATION", "TWENTY_FOUR_MONTHS_RESERVATION", "THIRTY_SIX_MONTHS_RESERVATION", "MONTHLY_PACKAGE", "FREE_TIER"])
|
|
@@ -218,10 +232,20 @@ module BillingApi
|
|
|
218
232
|
true
|
|
219
233
|
end
|
|
220
234
|
|
|
235
|
+
# Custom attribute writer method with validation
|
|
236
|
+
# @param [Object] sku Value to be assigned
|
|
237
|
+
def sku=(sku)
|
|
238
|
+
if sku.nil?
|
|
239
|
+
fail ArgumentError, 'sku cannot be nil'
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
@sku = sku
|
|
243
|
+
end
|
|
244
|
+
|
|
221
245
|
# Custom attribute writer method checking allowed values (enum).
|
|
222
246
|
# @param [Object] location Object to be assigned
|
|
223
247
|
def location=(location)
|
|
224
|
-
validator = EnumAttributeValidator.new('String', ["PHX", "ASH", "NLD", "SGP", "CHI", "SEA", "
|
|
248
|
+
validator = EnumAttributeValidator.new('String', ["PHX", "ASH", "NLD", "SGP", "CHI", "SEA", "GLOBAL"])
|
|
225
249
|
unless validator.valid?(location)
|
|
226
250
|
fail ArgumentError, "invalid value for \"location\", must be one of #{validator.allowable_values}."
|
|
227
251
|
end
|
|
@@ -238,6 +262,26 @@ module BillingApi
|
|
|
238
262
|
@pricing_model = pricing_model
|
|
239
263
|
end
|
|
240
264
|
|
|
265
|
+
# Custom attribute writer method with validation
|
|
266
|
+
# @param [Object] price Value to be assigned
|
|
267
|
+
def price=(price)
|
|
268
|
+
if price.nil?
|
|
269
|
+
fail ArgumentError, 'price cannot be nil'
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
@price = price
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
# Custom attribute writer method with validation
|
|
276
|
+
# @param [Object] price_unit Value to be assigned
|
|
277
|
+
def price_unit=(price_unit)
|
|
278
|
+
if price_unit.nil?
|
|
279
|
+
fail ArgumentError, 'price_unit cannot be nil'
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
@price_unit = price_unit
|
|
283
|
+
end
|
|
284
|
+
|
|
241
285
|
# Checks equality by comparing each attribute.
|
|
242
286
|
# @param [Object] Object to be compared
|
|
243
287
|
def ==(o)
|
|
@@ -252,7 +296,8 @@ module BillingApi
|
|
|
252
296
|
applicable_discounts == o.applicable_discounts &&
|
|
253
297
|
correlated_product_code == o.correlated_product_code &&
|
|
254
298
|
package_quantity == o.package_quantity &&
|
|
255
|
-
package_unit == o.package_unit
|
|
299
|
+
package_unit == o.package_unit &&
|
|
300
|
+
package_details == o.package_details
|
|
256
301
|
end
|
|
257
302
|
|
|
258
303
|
# @see the `==` method
|
|
@@ -264,7 +309,7 @@ module BillingApi
|
|
|
264
309
|
# Calculates hash code according to all attributes.
|
|
265
310
|
# @return [Integer] Hash code
|
|
266
311
|
def hash
|
|
267
|
-
[sku, sku_description, location, pricing_model, price, price_unit, applicable_discounts, correlated_product_code, package_quantity, package_unit].hash
|
|
312
|
+
[sku, sku_description, location, pricing_model, price, price_unit, applicable_discounts, correlated_product_code, package_quantity, package_unit, package_details].hash
|
|
268
313
|
end
|
|
269
314
|
|
|
270
315
|
# Builds the object from hash
|
|
@@ -290,61 +335,6 @@ module BillingApi
|
|
|
290
335
|
new(transformed_hash)
|
|
291
336
|
end
|
|
292
337
|
|
|
293
|
-
# Deserializes the data based on type
|
|
294
|
-
# @param string type Data type
|
|
295
|
-
# @param string value Value to be deserialized
|
|
296
|
-
# @return [Object] Deserialized data
|
|
297
|
-
def self._deserialize(type, value)
|
|
298
|
-
case type.to_sym
|
|
299
|
-
when :Time
|
|
300
|
-
Time.parse(value)
|
|
301
|
-
when :Date
|
|
302
|
-
Date.parse(value)
|
|
303
|
-
when :String
|
|
304
|
-
value.to_s
|
|
305
|
-
when :Integer
|
|
306
|
-
value.to_i
|
|
307
|
-
when :Float
|
|
308
|
-
value.to_f
|
|
309
|
-
when :Boolean
|
|
310
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
311
|
-
true
|
|
312
|
-
else
|
|
313
|
-
false
|
|
314
|
-
end
|
|
315
|
-
when :Object
|
|
316
|
-
# generic object (usually a Hash), return directly
|
|
317
|
-
value
|
|
318
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
|
319
|
-
inner_type = Regexp.last_match[:inner_type]
|
|
320
|
-
value.map { |v| _deserialize(inner_type, v) }
|
|
321
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
322
|
-
k_type = Regexp.last_match[:k_type]
|
|
323
|
-
v_type = Regexp.last_match[:v_type]
|
|
324
|
-
{}.tap do |hash|
|
|
325
|
-
value.each do |k, v|
|
|
326
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
327
|
-
end
|
|
328
|
-
end
|
|
329
|
-
else # model
|
|
330
|
-
# models (e.g. Pet) or oneOf
|
|
331
|
-
klass = BillingApi.const_get(type)
|
|
332
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
333
|
-
end
|
|
334
|
-
end
|
|
335
|
-
|
|
336
|
-
# Returns the string representation of the object
|
|
337
|
-
# @return [String] String presentation of the object
|
|
338
|
-
def to_s
|
|
339
|
-
to_hash.to_s
|
|
340
|
-
end
|
|
341
|
-
|
|
342
|
-
# to_body is an alias to to_hash (backward compatibility)
|
|
343
|
-
# @return [Hash] Returns the object in the form of hash
|
|
344
|
-
def to_body
|
|
345
|
-
to_hash
|
|
346
|
-
end
|
|
347
|
-
|
|
348
338
|
# Returns the object in the form of hash
|
|
349
339
|
# @return [Hash] Returns the object in the form of hash
|
|
350
340
|
def to_hash
|
|
@@ -361,24 +351,6 @@ module BillingApi
|
|
|
361
351
|
hash
|
|
362
352
|
end
|
|
363
353
|
|
|
364
|
-
# Outputs non-array value in the form of hash
|
|
365
|
-
# For object, use to_hash. Otherwise, just return the value
|
|
366
|
-
# @param [Object] value Any valid value
|
|
367
|
-
# @return [Hash] Returns the value in the form of hash
|
|
368
|
-
def _to_hash(value)
|
|
369
|
-
if value.is_a?(Array)
|
|
370
|
-
value.compact.map { |v| _to_hash(v) }
|
|
371
|
-
elsif value.is_a?(Hash)
|
|
372
|
-
{}.tap do |hash|
|
|
373
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
374
|
-
end
|
|
375
|
-
elsif value.respond_to? :to_hash
|
|
376
|
-
value.to_hash
|
|
377
|
-
else
|
|
378
|
-
value
|
|
379
|
-
end
|
|
380
|
-
end
|
|
381
|
-
|
|
382
354
|
end
|
|
383
355
|
|
|
384
356
|
end
|