Class: Line::Bot::V2::MessagingApi::AreaDemographicFilter

Inherits:
DemographicFilter show all
Defined in:
lib/line/bot/v2/messaging_api/model/area_demographic_filter.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(one_of: nil, **dynamic_attributes) ⇒ AreaDemographicFilter

Returns a new instance of AreaDemographicFilter.

Parameters:

  • one_of (Array['jp_01','jp_02','jp_03','jp_04','jp_05','jp_06','jp_07','jp_08','jp_09','jp_10','jp_11','jp_12','jp_13','jp_14','jp_15','jp_16','jp_17','jp_18','jp_19','jp_20','jp_21','jp_22','jp_23','jp_24','jp_25','jp_26','jp_27','jp_28','jp_29','jp_30','jp_31','jp_32','jp_33','jp_34','jp_35','jp_36','jp_37','jp_38','jp_39','jp_40','jp_41','jp_42','jp_43','jp_44','jp_45','jp_46','jp_47','tw_01','tw_02','tw_03','tw_04','tw_05','tw_06','tw_07','tw_08','tw_09','tw_10','tw_11','tw_12','tw_13','tw_14','tw_15','tw_16','tw_17','tw_18','tw_19','tw_20','tw_21','tw_22','th_01','th_02','th_03','th_04','th_05','th_06','th_07','th_08','id_01','id_02','id_03','id_04','id_05','id_06','id_07','id_08','id_09','id_10','id_11','id_12'], nil) (defaults to: nil)


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/line/bot/v2/messaging_api/model/area_demographic_filter.rb', line 25

def initialize(
  one_of: nil,
  **dynamic_attributes
)
  @type = "area"
  
  @one_of = one_of

  dynamic_attributes.each do |key, value|
    self.class.attr_accessor key

    if value.is_a?(Hash)
      struct_klass = Struct.new(*value.keys.map(&:to_sym))
      struct_values = value.map { |_k, v| v.is_a?(Hash) ? Line::Bot::V2::Utils.hash_to_struct(v) : v }
      instance_variable_set("@#{key}", struct_klass.new(*struct_values))
    else
      instance_variable_set("@#{key}", value)
    end
  end
end

Instance Attribute Details

#one_ofArray['jp_01','jp_02','jp_03','jp_04','jp_05','jp_06','jp_07','jp_08','jp_09','jp_10','jp_11','jp_12','jp_13','jp_14','jp_15','jp_16','jp_17','jp_18','jp_19','jp_20','jp_21','jp_22','jp_23','jp_24','jp_25','jp_26','jp_27','jp_28','jp_29','jp_30','jp_31','jp_32','jp_33','jp_34','jp_35','jp_36','jp_37','jp_38','jp_39','jp_40','jp_41','jp_42','jp_43','jp_44','jp_45','jp_46','jp_47','tw_01','tw_02','tw_03','tw_04','tw_05','tw_06','tw_07','tw_08','tw_09','tw_10','tw_11','tw_12','tw_13','tw_14','tw_15','tw_16','tw_17','tw_18','tw_19','tw_20','tw_21','tw_22','th_01','th_02','th_03','th_04','th_05','th_06','th_07','th_08','id_01','id_02','id_03','id_04','id_05','id_06','id_07','id_08','id_09','id_10','id_11','id_12']

Returns:

  • (Array['jp_01','jp_02','jp_03','jp_04','jp_05','jp_06','jp_07','jp_08','jp_09','jp_10','jp_11','jp_12','jp_13','jp_14','jp_15','jp_16','jp_17','jp_18','jp_19','jp_20','jp_21','jp_22','jp_23','jp_24','jp_25','jp_26','jp_27','jp_28','jp_29','jp_30','jp_31','jp_32','jp_33','jp_34','jp_35','jp_36','jp_37','jp_38','jp_39','jp_40','jp_41','jp_42','jp_43','jp_44','jp_45','jp_46','jp_47','tw_01','tw_02','tw_03','tw_04','tw_05','tw_06','tw_07','tw_08','tw_09','tw_10','tw_11','tw_12','tw_13','tw_14','tw_15','tw_16','tw_17','tw_18','tw_19','tw_20','tw_21','tw_22','th_01','th_02','th_03','th_04','th_05','th_06','th_07','th_08','id_01','id_02','id_03','id_04','id_05','id_06','id_07','id_08','id_09','id_10','id_11','id_12'])


22
23
24
# File 'lib/line/bot/v2/messaging_api/model/area_demographic_filter.rb', line 22

def one_of
  @one_of
end

#typeObject (readonly)

Returns the value of attribute type.



19
20
21
# File 'lib/line/bot/v2/messaging_api/model/area_demographic_filter.rb', line 19

def type
  @type
end

Class Method Details

.create(args) ⇒ Line::Bot::V2::MessagingApi::AreaDemographicFilter

Create an instance of the class from a hash

Parameters:

  • args (Hash)

    Hash containing all the required attributes

Returns:



49
50
51
52
# File 'lib/line/bot/v2/messaging_api/model/area_demographic_filter.rb', line 49

def self.create(args) # steep:ignore
  symbolized_args = Line::Bot::V2::Utils.deep_symbolize(args)
  return new(**symbolized_args) # steep:ignore
end

Instance Method Details

#==(other) ⇒ Boolean

Returns true if the objects are equal, false otherwise.

Parameters:

  • other (Object)

    Object to compare

Returns:

  • (Boolean)

    true if the objects are equal, false otherwise



56
57
58
59
60
61
62
# File 'lib/line/bot/v2/messaging_api/model/area_demographic_filter.rb', line 56

def ==(other)
  return false unless self.class == other.class

  instance_variables.all? do |var|
      instance_variable_get(var) == other.instance_variable_get(var)
  end
end

#hashInteger

Returns Hash code of the object.

Returns:

  • (Integer)

    Hash code of the object



65
66
67
# File 'lib/line/bot/v2/messaging_api/model/area_demographic_filter.rb', line 65

def hash
  [self.class, *instance_variables.map { |var| instance_variable_get(var) }].hash
end