Class: AdvancedBilling::ListComponentsFilter

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

Overview

ListComponentsFilter 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(ids: SKIP, use_site_exchange_rate: SKIP, additional_properties: {}) ⇒ ListComponentsFilter

Returns a new instance of ListComponentsFilter.



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

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

  @ids = ids unless ids == SKIP
  @use_site_exchange_rate = use_site_exchange_rate unless use_site_exchange_rate == SKIP
end

Instance Attribute Details

#idsArray[Integer]

Allows fetching components with matching id based on provided value. Use in query ‘filter=1,2,3`.

Returns:

  • (Array[Integer])


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

def ids
  @ids
end

#use_site_exchange_rateTrueClass | FalseClass

Allows fetching components with matching use_site_exchange_rate based on provided value (refers to default price point). Use in query ‘filter=true`.

Returns:

  • (TrueClass | FalseClass)


21
22
23
# File 'lib/advanced_billing/models/list_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_components_filter.rb', line 56

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  ids = hash.key?('ids') ? hash['ids'] : SKIP
  use_site_exchange_rate =
    hash.key?('use_site_exchange_rate') ? hash['use_site_exchange_rate'] : SKIP

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

  # Create object from extracted values.
  ListComponentsFilter.new(ids: ids,
                           use_site_exchange_rate: use_site_exchange_rate,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['ids'] = 'ids'
  @_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_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_components_filter.rb', line 32

def self.optionals
  %w[
    ids
    use_site_exchange_rate
  ]
end