Class: Line::Bot::V2::ManageAudience::GetAudienceGroupsResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/line/bot/v2/manage_audience/model/get_audience_groups_response.rb

Overview

Gets data for more than one audience.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(audience_groups: nil, has_next_page: nil, total_count: nil, read_write_audience_group_total_count: nil, page: nil, size: nil, **dynamic_attributes) ⇒ GetAudienceGroupsResponse

Returns a new instance of GetAudienceGroupsResponse.

Parameters:

  • audience_groups (Array[AudienceGroup, Hash[Symbol, untyped]], nil) (defaults to: nil)

    An array of audience data. If there are no audiences that match the specified filter, an empty array will be returned.

  • has_next_page (Boolean, nil) (defaults to: nil)

    true when this is not the last page.

  • total_count (Integer, nil) (defaults to: nil)

    The total number of audiences that can be returned with the specified filter.

  • read_write_audience_group_total_count (Integer, nil) (defaults to: nil)

    Of the audiences you can get with the specified filter, the number of audiences with the update permission set to READ_WRITE.

  • page (Integer, nil) (defaults to: nil)

    The current page number.

  • size (Integer, nil) (defaults to: nil)

    The maximum number of audiences on the current page.



42
43
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
73
74
75
76
# File 'lib/line/bot/v2/manage_audience/model/get_audience_groups_response.rb', line 42

def initialize(
  audience_groups: nil,
  has_next_page: nil,
  total_count: nil,
  read_write_audience_group_total_count: nil,
  page: nil,
  size: nil,
  **dynamic_attributes
)
  
  @audience_groups = audience_groups&.map do |item|
    if item.is_a?(Hash)
      Line::Bot::V2::ManageAudience::AudienceGroup.create(**item) # steep:ignore InsufficientKeywordArguments
    else
      item
    end
  end
  @has_next_page = has_next_page
  @total_count = total_count
  @read_write_audience_group_total_count = read_write_audience_group_total_count
  @page = page
  @size = size

  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

#audience_groupsArray[AudienceGroup]?

Returns An array of audience data. If there are no audiences that match the specified filter, an empty array will be returned.

Returns:

  • (Array[AudienceGroup], nil)

    An array of audience data. If there are no audiences that match the specified filter, an empty array will be returned.



19
20
21
# File 'lib/line/bot/v2/manage_audience/model/get_audience_groups_response.rb', line 19

def audience_groups
  @audience_groups
end

#has_next_pageBoolean?

Returns true when this is not the last page.

Returns:

  • (Boolean, nil)

    true when this is not the last page.



22
23
24
# File 'lib/line/bot/v2/manage_audience/model/get_audience_groups_response.rb', line 22

def has_next_page
  @has_next_page
end

#pageInteger?

Returns The current page number.

Returns:

  • (Integer, nil)

    The current page number.



31
32
33
# File 'lib/line/bot/v2/manage_audience/model/get_audience_groups_response.rb', line 31

def page
  @page
end

#read_write_audience_group_total_countInteger?

Returns Of the audiences you can get with the specified filter, the number of audiences with the update permission set to READ_WRITE.

Returns:

  • (Integer, nil)

    Of the audiences you can get with the specified filter, the number of audiences with the update permission set to READ_WRITE.



28
29
30
# File 'lib/line/bot/v2/manage_audience/model/get_audience_groups_response.rb', line 28

def read_write_audience_group_total_count
  @read_write_audience_group_total_count
end

#sizeInteger?

Returns The maximum number of audiences on the current page.

Returns:

  • (Integer, nil)

    The maximum number of audiences on the current page.



34
35
36
# File 'lib/line/bot/v2/manage_audience/model/get_audience_groups_response.rb', line 34

def size
  @size
end

#total_countInteger?

Returns The total number of audiences that can be returned with the specified filter.

Returns:

  • (Integer, nil)

    The total number of audiences that can be returned with the specified filter.



25
26
27
# File 'lib/line/bot/v2/manage_audience/model/get_audience_groups_response.rb', line 25

def total_count
  @total_count
end

Class Method Details

.create(args) ⇒ Line::Bot::V2::ManageAudience::GetAudienceGroupsResponse

Create an instance of the class from a hash

Parameters:

  • args (Hash)

    Hash containing all the required attributes

Returns:



81
82
83
84
# File 'lib/line/bot/v2/manage_audience/model/get_audience_groups_response.rb', line 81

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



88
89
90
91
92
93
94
# File 'lib/line/bot/v2/manage_audience/model/get_audience_groups_response.rb', line 88

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



97
98
99
# File 'lib/line/bot/v2/manage_audience/model/get_audience_groups_response.rb', line 97

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