Class: Bfwd::CreateAggregatingSubscriptionRequest
- Inherits:
-
Object
- Object
- Bfwd::CreateAggregatingSubscriptionRequest
- Defined in:
- lib/bf_ruby2/models/create_aggregating_subscription_request.rb
Overview
Entity for requesting that an ‘aggregating subscription’ (i.e. a ‘parent subscription’ which collects the charges raised by many ‘child subscriptions’) be created.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#account_id ⇒ Object
of the BillForward Account who will own this aggregating subscription. You should ensure beforehand that the customer has had a BillForward Account created for them.“,”verbs“:.
-
#aggregate_all_subscriptions_on_account ⇒ Object
this ‘aggregating subscription’ should collect charges (starting now) from all other subscriptions (current and future) belonging to this BillForward Account.“,”verbs“:.
-
#aggregating_components ⇒ Object
list)","description":"[Required if and only if ‘productRatePlan` is omitted] List of components whose prices should be recalculated upon invoice aggregation. For example: two subscriptions’ individual consumptions may neither of them be large enough to achieve bulk buy discounts. When aggregated, though, the same two subscriptions’ consumption may add up to a quantity which does merit a bulk buy discount within your tiering system.“,”verbs“:.
-
#created ⇒ Object
{ "description" : "The UTC DateTime when the object was created.", "verbs":[] }.
-
#currency ⇒ Object
if and only if ‘productRatePlan` is omitted] The currency of the product-rate-plan — as specified by a three-character ISO 4217 currency code (i.e. USD).“,”verbs“:.
-
#description ⇒ Object
of the created subscription. This is primarily for your benefit — for example, you could write here the mechanism through which you obtained this customer. (e.g. ‘Business signed up using BUSYGUYS coupon, at management trade show’).“,”verbs“:.
-
#duration ⇒ Object
if and only if ‘productRatePlan` is omitted] Number of length-measures which constitute the rate plan’s period.“,”verbs“:.
-
#duration_period ⇒ Object
if and only if ‘productRatePlan` is omitted] Measure describing the magnitude of the rate plan’s period.“,”verbs“:.
-
#name ⇒ Object
will be named after the rate plan to which the subscription subscribes)","description":"Name of the created subscription. This is primarily for your benefit — for example, to enable you to identify subscriptions at a glance in the BillForward web interface (e.g. ‘BusinessCorp subscriptions, care of Mr Business ([email protected])‘).“,”verbs“:.
-
#organization_id ⇒ Object
using your authentication credentials)","description":"ID of the BillForward Organization within which the requested Subscription should be created. If omitted, this will be auto-populated using your authentication credentials.“,”verbs“:.
-
#product_rate_plan ⇒ Object
of the rate plan to which the subscription will be subscribing. If omitted: it will be assumed you wish to create a new rate plan as part of this request — this subscription will subscribe to that newly-created rate plan.“,”verbs“:.
-
#product_type ⇒ Object
if and only if ‘productRatePlan` is omitted] The frequency of the rate plan — either recurring or non-recurring.“,”verbs“:.
-
#start ⇒ Object
upon receiving request)","description":"ISO 8601 UTC DateTime (e.g. 2015-06-16T11:58:41Z) describing the date at which the subscription should enter its first service period.“,”verbs“:.
-
#state ⇒ Object
state in which the created subscription will begin.
<span class=\"label label-default\">Provisioned</span> — The subscription will wait (without raising any invoices or beginning its service) until explicit action is taken to change its state.
<span class=\"label label-default\">AwaitingPayment</span> — The subscription is activated. After ‘start` time is surpassed, it will begin service and raise its first invoice.“,”verbs“:.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ CreateAggregatingSubscriptionRequest
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ CreateAggregatingSubscriptionRequest
Initializes the object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 124 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} if attributes.has_key?(:'created') self.created = attributes[:'created'] end if attributes.has_key?(:'accountID') self.account_id = attributes[:'accountID'] end if attributes.has_key?(:'organizationID') self.organization_id = attributes[:'organizationID'] end if attributes.has_key?(:'name') self.name = attributes[:'name'] end if attributes.has_key?(:'description') self.description = attributes[:'description'] end if attributes.has_key?(:'start') self.start = attributes[:'start'] end if attributes.has_key?(:'state') self.state = attributes[:'state'] end if attributes.has_key?(:'productRatePlan') self.product_rate_plan = attributes[:'productRatePlan'] end if attributes.has_key?(:'duration') self.duration = attributes[:'duration'] end if attributes.has_key?(:'durationPeriod') self.duration_period = attributes[:'durationPeriod'] end if attributes.has_key?(:'productType') self.product_type = attributes[:'productType'] end if attributes.has_key?(:'aggregatingComponents') if (value = attributes[:'aggregatingComponents']).is_a?(Array) self.aggregating_components = value end end if attributes.has_key?(:'aggregateAllSubscriptionsOnAccount') self.aggregate_all_subscriptions_on_account = attributes[:'aggregateAllSubscriptionsOnAccount'] else self.aggregate_all_subscriptions_on_account = false end if attributes.has_key?(:'currency') self.currency = attributes[:'currency'] end end |
Instance Attribute Details
#account_id ⇒ Object
of the BillForward Account who will own this aggregating subscription. You should ensure beforehand that the customer has had a BillForward Account created for them.“,”verbs“:
22 23 24 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 22 def account_id @account_id end |
#aggregate_all_subscriptions_on_account ⇒ Object
this ‘aggregating subscription’ should collect charges (starting now) from all other subscriptions (current and future) belonging to this BillForward Account.“,”verbs“:
55 56 57 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 55 def aggregate_all_subscriptions_on_account @aggregate_all_subscriptions_on_account end |
#aggregating_components ⇒ Object
list)","description":"[Required if and only if ‘productRatePlan` is omitted] List of components whose prices should be recalculated upon invoice aggregation. For example: two subscriptions’ individual consumptions may neither of them be large enough to achieve bulk buy discounts. When aggregated, though, the same two subscriptions’ consumption may add up to a quantity which does merit a bulk buy discount within your tiering system.“,”verbs“:
52 53 54 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 52 def aggregating_components @aggregating_components end |
#created ⇒ Object
{ "description" : "The UTC DateTime when the object was created.", "verbs":[] }
19 20 21 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 19 def created @created end |
#currency ⇒ Object
if and only if ‘productRatePlan` is omitted] The currency of the product-rate-plan — as specified by a three-character ISO 4217 currency code (i.e. USD).“,”verbs“:
58 59 60 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 58 def currency @currency end |
#description ⇒ Object
of the created subscription. This is primarily for your benefit — for example, you could write here the mechanism through which you obtained this customer. (e.g. ‘Business signed up using BUSYGUYS coupon, at management trade show’).“,”verbs“:
31 32 33 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 31 def description @description end |
#duration ⇒ Object
if and only if ‘productRatePlan` is omitted] Number of length-measures which constitute the rate plan’s period.“,”verbs“:
43 44 45 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 43 def duration @duration end |
#duration_period ⇒ Object
if and only if ‘productRatePlan` is omitted] Measure describing the magnitude of the rate plan’s period.“,”verbs“:
46 47 48 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 46 def duration_period @duration_period end |
#name ⇒ Object
will be named after the rate plan to which the subscription subscribes)","description":"Name of the created subscription. This is primarily for your benefit — for example, to enable you to identify subscriptions at a glance in the BillForward web interface (e.g. ‘BusinessCorp subscriptions, care of Mr Business ([email protected])‘).“,”verbs“:
28 29 30 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 28 def name @name end |
#organization_id ⇒ Object
using your authentication credentials)","description":"ID of the BillForward Organization within which the requested Subscription should be created. If omitted, this will be auto-populated using your authentication credentials.“,”verbs“:
25 26 27 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 25 def organization_id @organization_id end |
#product_rate_plan ⇒ Object
of the rate plan to which the subscription will be subscribing. If omitted: it will be assumed you wish to create a new rate plan as part of this request — this subscription will subscribe to that newly-created rate plan.“,”verbs“:
40 41 42 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 40 def product_rate_plan @product_rate_plan end |
#product_type ⇒ Object
if and only if ‘productRatePlan` is omitted] The frequency of the rate plan — either recurring or non-recurring.“,”verbs“:
49 50 51 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 49 def product_type @product_type end |
#start ⇒ Object
upon receiving request)","description":"ISO 8601 UTC DateTime (e.g. 2015-06-16T11:58:41Z) describing the date at which the subscription should enter its first service period.“,”verbs“:
34 35 36 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 34 def start @start end |
#state ⇒ Object
state in which the created subscription will begin.
<span class=\"label label-default\">Provisioned</span> — The subscription will wait (without raising any invoices or beginning its service) until explicit action is taken to change its state.
<span class=\"label label-default\">AwaitingPayment</span> — The subscription is activated. After ‘start` time is surpassed, it will begin service and raise its first invoice.“,”verbs“:
37 38 39 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 37 def state @state end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 83 def self.attribute_map { :'created' => :'created', :'account_id' => :'accountID', :'organization_id' => :'organizationID', :'name' => :'name', :'description' => :'description', :'start' => :'start', :'state' => :'state', :'product_rate_plan' => :'productRatePlan', :'duration' => :'duration', :'duration_period' => :'durationPeriod', :'product_type' => :'productType', :'aggregating_components' => :'aggregatingComponents', :'aggregate_all_subscriptions_on_account' => :'aggregateAllSubscriptionsOnAccount', :'currency' => :'currency' } end |
.swagger_types ⇒ Object
Attribute type mapping.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 103 def self.swagger_types { :'created' => :'DateTime', :'account_id' => :'String', :'organization_id' => :'String', :'name' => :'String', :'description' => :'String', :'start' => :'DateTime', :'state' => :'String', :'product_rate_plan' => :'String', :'duration' => :'Integer', :'duration_period' => :'String', :'product_type' => :'String', :'aggregating_components' => :'Array<CreateAggregatingComponentRequest>', :'aggregate_all_subscriptions_on_account' => :'BOOLEAN', :'currency' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 253 def ==(o) return true if self.equal?(o) self.class == o.class && created == o.created && account_id == o.account_id && organization_id == o.organization_id && name == o.name && description == o.description && start == o.start && state == o.state && product_rate_plan == o.product_rate_plan && duration == o.duration && duration_period == o.duration_period && product_type == o.product_type && aggregating_components == o.aggregating_components && aggregate_all_subscriptions_on_account == o.aggregate_all_subscriptions_on_account && currency == o.currency end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 308 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = Bfwd.const_get(type).new temp_model.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
374 375 376 377 378 379 380 381 382 383 384 385 386 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 374 def _to_hash(value) if value.is_a?(Array) value.compact.map{ |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 287 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
274 275 276 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 274 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
280 281 282 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 280 def hash [created, account_id, organization_id, name, description, start, state, product_rate_plan, duration, duration_period, product_type, aggregating_components, aggregate_all_subscriptions_on_account, currency].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 194 def list_invalid_properties invalid_properties = Array.new if @account_id.nil? invalid_properties.push("invalid value for 'account_id', account_id cannot be nil.") end if @currency.nil? invalid_properties.push("invalid value for 'currency', currency cannot be nil.") end return invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
354 355 356 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 354 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
360 361 362 363 364 365 366 367 368 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 360 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
348 349 350 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 348 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/bf_ruby2/models/create_aggregating_subscription_request.rb', line 209 def valid? return false if @account_id.nil? state_validator = EnumAttributeValidator.new('String', ["Trial", "Provisioned", "Paid", "AwaitingPayment", "Cancelled", "Failed", "Expired"]) return false unless state_validator.valid?(@state) duration_period_validator = EnumAttributeValidator.new('String', ["minutes", "days", "months", "years"]) return false unless duration_period_validator.valid?(@duration_period) product_type_validator = EnumAttributeValidator.new('String', ["nonrecurring", "recurring"]) return false unless product_type_validator.valid?(@product_type) return false if @currency.nil? return true end |