Class: ApiReference::BulkWithFiltersConfig1

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/bulk_with_filters_config1.rb

Overview

Configuration for bulk_with_filters pricing

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(tiers:, filters:) ⇒ BulkWithFiltersConfig1

Returns a new instance of BulkWithFiltersConfig1.



38
39
40
41
# File 'lib/api_reference/models/bulk_with_filters_config1.rb', line 38

def initialize(tiers:, filters:)
  @tiers = tiers
  @filters = filters
end

Instance Attribute Details

#filtersArray[FilterRule]

Property filters to apply (all must match)

Returns:



18
19
20
# File 'lib/api_reference/models/bulk_with_filters_config1.rb', line 18

def filters
  @filters
end

#tiersArray[BulkWithFiltersTier]

Bulk tiers for rating based on total usage volume

Returns:



14
15
16
# File 'lib/api_reference/models/bulk_with_filters_config1.rb', line 14

def tiers
  @tiers
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/api_reference/models/bulk_with_filters_config1.rb', line 44

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  # Parameter is an array, so we need to iterate through it
  tiers = nil
  unless hash['tiers'].nil?
    tiers = []
    hash['tiers'].each do |structure|
      tiers << (BulkWithFiltersTier.from_hash(structure) if structure)
    end
  end

  tiers = nil unless hash.key?('tiers')
  # Parameter is an array, so we need to iterate through it
  filters = nil
  unless hash['filters'].nil?
    filters = []
    hash['filters'].each do |structure|
      filters << (FilterRule.from_hash(structure) if structure)
    end
  end

  filters = nil unless hash.key?('filters')

  # Create object from extracted values.
  BulkWithFiltersConfig1.new(tiers: tiers,
                             filters: filters)
end

.namesObject

A mapping from model property names to API property names.



21
22
23
24
25
26
# File 'lib/api_reference/models/bulk_with_filters_config1.rb', line 21

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

.nullablesObject

An array for nullable fields



34
35
36
# File 'lib/api_reference/models/bulk_with_filters_config1.rb', line 34

def self.nullables
  []
end

.optionalsObject

An array for optional fields



29
30
31
# File 'lib/api_reference/models/bulk_with_filters_config1.rb', line 29

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/api_reference/models/bulk_with_filters_config1.rb', line 76

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.tiers,
                            ->(val) { BulkWithFiltersTier.validate(val) },
                            is_model_hash: true,
                            is_inner_model_hash: true) and
        APIHelper.valid_type?(value.filters,
                              ->(val) { FilterRule.validate(val) },
                              is_model_hash: true,
                              is_inner_model_hash: true)
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['tiers'],
                          ->(val) { BulkWithFiltersTier.validate(val) },
                          is_model_hash: true,
                          is_inner_model_hash: true) and
      APIHelper.valid_type?(value['filters'],
                            ->(val) { FilterRule.validate(val) },
                            is_model_hash: true,
                            is_inner_model_hash: true)
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



111
112
113
114
# File 'lib/api_reference/models/bulk_with_filters_config1.rb', line 111

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} tiers: #{@tiers.inspect}, filters: #{@filters.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



105
106
107
108
# File 'lib/api_reference/models/bulk_with_filters_config1.rb', line 105

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} tiers: #{@tiers}, filters: #{@filters}>"
end