Class: Line::Bot::V2::ManageAudience::AudienceGroup

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

Overview

Audience group

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(audience_group_id: nil, type: nil, description: nil, status: nil, failed_type: nil, audience_count: nil, created: nil, request_id: nil, click_url: nil, is_ifa_audience: nil, permission: nil, create_route: nil, **dynamic_attributes) ⇒ AudienceGroup

Returns a new instance of AudienceGroup.

Parameters:

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

    The audience ID.

  • type (String, nil) (defaults to: nil)

    (‘UPLOAD’|‘CLICK’|‘IMP’|‘CHAT_TAG’|‘FRIEND_PATH’|‘RESERVATION’|‘APP_EVENT’|‘VIDEO_VIEW’|‘WEBTRAFFIC’|‘IMAGE_CLICK’|‘RICHMENU_IMP’|‘RICHMENU_CLICK’)

  • description (String, nil) (defaults to: nil)

    The audience’s name.

  • status (String, nil) (defaults to: nil)

    (‘IN_PROGRESS’|‘READY’|‘FAILED’|‘EXPIRED’|‘INACTIVE’|‘ACTIVATING’)

  • failed_type (String, nil) (defaults to: nil)

    (‘AUDIENCE_GROUP_AUDIENCE_INSUFFICIENT’|‘INTERNAL_ERROR’|”)

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

    The number of users included in the audience.

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

    When the audience was created (in UNIX time).

  • request_id (String, nil) (defaults to: nil)

    The request ID that was specified when the audience was created. This is only included when ‘audienceGroup.type` is CLICK or IMP.

  • click_url (String, nil) (defaults to: nil)

    The URL that was specified when the audience was created. This is only included when ‘audienceGroup.type` is CLICK and link URL is specified.

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

    The value indicating the type of account to be sent, as specified when creating the audience for uploading user IDs.

  • permission (String, nil) (defaults to: nil)

    (‘READ’|‘READ_WRITE’)

  • create_route (String, nil) (defaults to: nil)

    (‘OA_MANAGER’|‘MESSAGING_API’|‘POINT_AD’|‘AD_MANAGER’)



65
66
67
68
69
70
71
72
73
74
75
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
103
104
105
# File 'lib/line/bot/v2/manage_audience/model/audience_group.rb', line 65

def initialize(
  audience_group_id: nil,
  type: nil,
  description: nil,
  status: nil,
  failed_type: nil,
  audience_count: nil,
  created: nil,
  request_id: nil,
  click_url: nil,
  is_ifa_audience: nil,
  permission: nil,
  create_route: nil,
  **dynamic_attributes
)
  
  @audience_group_id = audience_group_id
  @type = type
  @description = description
  @status = status
  @failed_type = failed_type
  @audience_count = audience_count
  @created = created
  @request_id = request_id
  @click_url = click_url
  @is_ifa_audience = is_ifa_audience
  @permission = permission
  @create_route = create_route

  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_countInteger?

Returns The number of users included in the audience.

Returns:

  • (Integer, nil)

    The number of users included in the audience.



33
34
35
# File 'lib/line/bot/v2/manage_audience/model/audience_group.rb', line 33

def audience_count
  @audience_count
end

#audience_group_idInteger?

Returns The audience ID.

Returns:

  • (Integer, nil)

    The audience ID.



18
19
20
# File 'lib/line/bot/v2/manage_audience/model/audience_group.rb', line 18

def audience_group_id
  @audience_group_id
end

#click_urlString?

Returns The URL that was specified when the audience was created. This is only included when ‘audienceGroup.type` is CLICK and link URL is specified.

Returns:

  • (String, nil)

    The URL that was specified when the audience was created. This is only included when ‘audienceGroup.type` is CLICK and link URL is specified.



42
43
44
# File 'lib/line/bot/v2/manage_audience/model/audience_group.rb', line 42

def click_url
  @click_url
end

#create_routeString?

Returns (‘OA_MANAGER’|‘MESSAGING_API’|‘POINT_AD’|‘AD_MANAGER’).

Returns:

  • (String, nil)

    (‘OA_MANAGER’|‘MESSAGING_API’|‘POINT_AD’|‘AD_MANAGER’)



51
52
53
# File 'lib/line/bot/v2/manage_audience/model/audience_group.rb', line 51

def create_route
  @create_route
end

#createdInteger?

Returns When the audience was created (in UNIX time).

Returns:

  • (Integer, nil)

    When the audience was created (in UNIX time).



36
37
38
# File 'lib/line/bot/v2/manage_audience/model/audience_group.rb', line 36

def created
  @created
end

#descriptionString?

Returns The audience’s name.

Returns:

  • (String, nil)

    The audience’s name.



24
25
26
# File 'lib/line/bot/v2/manage_audience/model/audience_group.rb', line 24

def description
  @description
end

#failed_typeString?

Returns (‘AUDIENCE_GROUP_AUDIENCE_INSUFFICIENT’|‘INTERNAL_ERROR’|”).

Returns:

  • (String, nil)

    (‘AUDIENCE_GROUP_AUDIENCE_INSUFFICIENT’|‘INTERNAL_ERROR’|”)



30
31
32
# File 'lib/line/bot/v2/manage_audience/model/audience_group.rb', line 30

def failed_type
  @failed_type
end

#is_ifa_audienceBoolean?

Returns The value indicating the type of account to be sent, as specified when creating the audience for uploading user IDs.

Returns:

  • (Boolean, nil)

    The value indicating the type of account to be sent, as specified when creating the audience for uploading user IDs.



45
46
47
# File 'lib/line/bot/v2/manage_audience/model/audience_group.rb', line 45

def is_ifa_audience
  @is_ifa_audience
end

#permissionString?

Returns (‘READ’|‘READ_WRITE’).

Returns:

  • (String, nil)

    (‘READ’|‘READ_WRITE’)



48
49
50
# File 'lib/line/bot/v2/manage_audience/model/audience_group.rb', line 48

def permission
  @permission
end

#request_idString?

Returns The request ID that was specified when the audience was created. This is only included when ‘audienceGroup.type` is CLICK or IMP.

Returns:

  • (String, nil)

    The request ID that was specified when the audience was created. This is only included when ‘audienceGroup.type` is CLICK or IMP.



39
40
41
# File 'lib/line/bot/v2/manage_audience/model/audience_group.rb', line 39

def request_id
  @request_id
end

#statusString?

Returns (‘IN_PROGRESS’|‘READY’|‘FAILED’|‘EXPIRED’|‘INACTIVE’|‘ACTIVATING’).

Returns:

  • (String, nil)

    (‘IN_PROGRESS’|‘READY’|‘FAILED’|‘EXPIRED’|‘INACTIVE’|‘ACTIVATING’)



27
28
29
# File 'lib/line/bot/v2/manage_audience/model/audience_group.rb', line 27

def status
  @status
end

#typeString?

Returns (‘UPLOAD’|‘CLICK’|‘IMP’|‘CHAT_TAG’|‘FRIEND_PATH’|‘RESERVATION’|‘APP_EVENT’|‘VIDEO_VIEW’|‘WEBTRAFFIC’|‘IMAGE_CLICK’|‘RICHMENU_IMP’|‘RICHMENU_CLICK’).

Returns:

  • (String, nil)

    (‘UPLOAD’|‘CLICK’|‘IMP’|‘CHAT_TAG’|‘FRIEND_PATH’|‘RESERVATION’|‘APP_EVENT’|‘VIDEO_VIEW’|‘WEBTRAFFIC’|‘IMAGE_CLICK’|‘RICHMENU_IMP’|‘RICHMENU_CLICK’)



21
22
23
# File 'lib/line/bot/v2/manage_audience/model/audience_group.rb', line 21

def type
  @type
end

Class Method Details

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

Create an instance of the class from a hash

Parameters:

  • args (Hash)

    Hash containing all the required attributes

Returns:



110
111
112
113
# File 'lib/line/bot/v2/manage_audience/model/audience_group.rb', line 110

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



117
118
119
120
121
122
123
# File 'lib/line/bot/v2/manage_audience/model/audience_group.rb', line 117

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



126
127
128
# File 'lib/line/bot/v2/manage_audience/model/audience_group.rb', line 126

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