Class: AdvancedBilling::ListSegmentsFilter

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

Overview

ListSegmentsFilter Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(segment_property_1_value: SKIP, segment_property_2_value: SKIP, segment_property_3_value: SKIP, segment_property_4_value: SKIP, additional_properties: {}) ⇒ ListSegmentsFilter

Returns a new instance of ListSegmentsFilter.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/advanced_billing/models/list_segments_filter.rb', line 62

def initialize(segment_property_1_value: SKIP,
               segment_property_2_value: SKIP,
               segment_property_3_value: SKIP,
               segment_property_4_value: SKIP, additional_properties: {})
  @segment_property_1_value = segment_property_1_value unless segment_property_1_value == SKIP
  @segment_property_2_value = segment_property_2_value unless segment_property_2_value == SKIP
  @segment_property_3_value = segment_property_3_value unless segment_property_3_value == SKIP
  @segment_property_4_value = segment_property_4_value unless segment_property_4_value == SKIP

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

Instance Attribute Details

#segment_property_1_valueString

The value passed here would be used to filter segments. Pass a value related to ‘segment_property_1` on attached Metric. If empty string is passed, this filter would be rejected. Use in query `filter=EU`.

Returns:

  • (String)


17
18
19
# File 'lib/advanced_billing/models/list_segments_filter.rb', line 17

def segment_property_1_value
  @segment_property_1_value
end

#segment_property_2_valueString

The value passed here would be used to filter segments. Pass a value related to ‘segment_property_2` on attached Metric. If empty string is passed, this filter would be rejected.

Returns:

  • (String)


23
24
25
# File 'lib/advanced_billing/models/list_segments_filter.rb', line 23

def segment_property_2_value
  @segment_property_2_value
end

#segment_property_3_valueString

The value passed here would be used to filter segments. Pass a value related to ‘segment_property_3` on attached Metric. If empty string is passed, this filter would be rejected.

Returns:

  • (String)


29
30
31
# File 'lib/advanced_billing/models/list_segments_filter.rb', line 29

def segment_property_3_value
  @segment_property_3_value
end

#segment_property_4_valueString

The value passed here would be used to filter segments. Pass a value related to ‘segment_property_4` on attached Metric. If empty string is passed, this filter would be rejected.

Returns:

  • (String)


35
36
37
# File 'lib/advanced_billing/models/list_segments_filter.rb', line 35

def segment_property_4_value
  @segment_property_4_value
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  segment_property_1_value =
    hash.key?('segment_property_1_value') ? hash['segment_property_1_value'] : SKIP
  segment_property_2_value =
    hash.key?('segment_property_2_value') ? hash['segment_property_2_value'] : SKIP
  segment_property_3_value =
    hash.key?('segment_property_3_value') ? hash['segment_property_3_value'] : SKIP
  segment_property_4_value =
    hash.key?('segment_property_4_value') ? hash['segment_property_4_value'] : SKIP

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

  # Create object from extracted values.
  ListSegmentsFilter.new(segment_property_1_value: segment_property_1_value,
                         segment_property_2_value: segment_property_2_value,
                         segment_property_3_value: segment_property_3_value,
                         segment_property_4_value: segment_property_4_value,
                         additional_properties: hash)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
# File 'lib/advanced_billing/models/list_segments_filter.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['segment_property_1_value'] = 'segment_property_1_value'
  @_hash['segment_property_2_value'] = 'segment_property_2_value'
  @_hash['segment_property_3_value'] = 'segment_property_3_value'
  @_hash['segment_property_4_value'] = 'segment_property_4_value'
  @_hash
end

.nullablesObject

An array for nullable fields



58
59
60
# File 'lib/advanced_billing/models/list_segments_filter.rb', line 58

def self.nullables
  []
end

.optionalsObject

An array for optional fields



48
49
50
51
52
53
54
55
# File 'lib/advanced_billing/models/list_segments_filter.rb', line 48

def self.optionals
  %w[
    segment_property_1_value
    segment_property_2_value
    segment_property_3_value
    segment_property_4_value
  ]
end