Class: AdvancedBilling::ListSubscriptionComponentsForSiteFilter

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/list_subscription_components_for_site_filter.rb

Overview

ListSubscriptionComponentsForSiteFilter Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(currencies: SKIP, use_site_exchange_rate: SKIP, subscription: SKIP, additional_properties: {}) ⇒ ListSubscriptionComponentsForSiteFilter

Returns a new instance of ListSubscriptionComponentsForSiteFilter.



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/advanced_billing/models/list_subscription_components_for_site_filter.rb', line 50

def initialize(currencies: SKIP, use_site_exchange_rate: SKIP,
               subscription: SKIP, additional_properties: {})
  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end

  @currencies = currencies unless currencies == SKIP
  @use_site_exchange_rate = use_site_exchange_rate unless use_site_exchange_rate == SKIP
  @subscription = subscription unless subscription == SKIP
end

Instance Attribute Details

#currenciesArray[String]

Allows fetching components allocation with matching currency based on provided values. Use in query ‘filter=USD,EUR`.

Returns:

  • (Array[String])


15
16
17
# File 'lib/advanced_billing/models/list_subscription_components_for_site_filter.rb', line 15

def currencies
  @currencies
end

#subscriptionSubscriptionFilter

Nested filter used for List Subscription Components For Site Filter

Returns:



25
26
27
# File 'lib/advanced_billing/models/list_subscription_components_for_site_filter.rb', line 25

def subscription
  @subscription
end

#use_site_exchange_rateTrueClass | FalseClass

Allows fetching components allocation with matching use_site_exchange_rate based on provided value. Use in query ‘filter=true`.

Returns:

  • (TrueClass | FalseClass)


21
22
23
# File 'lib/advanced_billing/models/list_subscription_components_for_site_filter.rb', line 21

def use_site_exchange_rate
  @use_site_exchange_rate
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/advanced_billing/models/list_subscription_components_for_site_filter.rb', line 63

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  currencies = hash.key?('currencies') ? hash['currencies'] : SKIP
  use_site_exchange_rate =
    hash.key?('use_site_exchange_rate') ? hash['use_site_exchange_rate'] : SKIP
  subscription = SubscriptionFilter.from_hash(hash['subscription']) if hash['subscription']

  # Clean out expected properties from Hash.
  additional_properties = hash.reject { |k, _| names.value?(k) }

  # Create object from extracted values.
  ListSubscriptionComponentsForSiteFilter.new(currencies: currencies,
                                              use_site_exchange_rate: use_site_exchange_rate,
                                              subscription: subscription,
                                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



28
29
30
31
32
33
34
# File 'lib/advanced_billing/models/list_subscription_components_for_site_filter.rb', line 28

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['currencies'] = 'currencies'
  @_hash['use_site_exchange_rate'] = 'use_site_exchange_rate'
  @_hash['subscription'] = 'subscription'
  @_hash
end

.nullablesObject

An array for nullable fields



46
47
48
# File 'lib/advanced_billing/models/list_subscription_components_for_site_filter.rb', line 46

def self.nullables
  []
end

.optionalsObject

An array for optional fields



37
38
39
40
41
42
43
# File 'lib/advanced_billing/models/list_subscription_components_for_site_filter.rb', line 37

def self.optionals
  %w[
    currencies
    use_site_exchange_rate
    subscription
  ]
end