Class: AdvancedBilling::ListSubscriptionComponentsFilter

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

Overview

ListSubscriptionComponentsFilter Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

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

Returns a new instance of ListSubscriptionComponentsFilter.



44
45
46
47
48
49
50
51
52
53
# File 'lib/advanced_billing/models/list_subscription_components_filter.rb', line 44

def initialize(currencies: SKIP, use_site_exchange_rate: SKIP,
               additional_properties: {})
  @currencies = currencies unless currencies == SKIP
  @use_site_exchange_rate = use_site_exchange_rate unless use_site_exchange_rate == SKIP

  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end
end

Instance Attribute Details

#currenciesArray[String]

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

Returns:

  • (Array[String])


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

def currencies
  @currencies
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_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.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/advanced_billing/models/list_subscription_components_filter.rb', line 56

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

  # Clean out expected properties from Hash.
  names.each_value { |k| hash.delete(k) }

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

.namesObject

A mapping from model property names to API property names.



24
25
26
27
28
29
# File 'lib/advanced_billing/models/list_subscription_components_filter.rb', line 24

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

.nullablesObject

An array for nullable fields



40
41
42
# File 'lib/advanced_billing/models/list_subscription_components_filter.rb', line 40

def self.nullables
  []
end

.optionalsObject

An array for optional fields



32
33
34
35
36
37
# File 'lib/advanced_billing/models/list_subscription_components_filter.rb', line 32

def self.optionals
  %w[
    currencies
    use_site_exchange_rate
  ]
end