Class: Line::Bot::V2::MessagingApi::NarrowcastProgressResponse

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

Overview

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(phase:, success_count: nil, failure_count: nil, target_count: nil, failed_description: nil, error_code: nil, accepted_time:, completed_time: nil, **dynamic_attributes) ⇒ NarrowcastProgressResponse

Returns a new instance of NarrowcastProgressResponse.

Parameters:

  • phase (String)

    (‘waiting’|‘sending’|‘succeeded’|‘failed’) The current status. One of: ‘waiting`: Messages are not yet ready to be sent. They are currently being filtered or processed in some way. `sending`: Messages are currently being sent. `succeeded`: Messages were sent successfully. This may not mean the messages were successfully received. `failed`: Messages failed to be sent. Use the failedDescription property to find the cause of the failure.

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

    The number of users who successfully received the message.

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

    The number of users who failed to send the message.

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

    The number of intended recipients of the message.

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

    The reason the message failed to be sent. This is only included with a ‘phase` property value of `failed`.

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

    Error summary. This is only included with a phase property value of failed. One of: ‘1`: An internal error occurred. `2`: An error occurred because there weren’t enough recipients. ‘3`: A conflict error of requests occurs because a request that has already been accepted is retried. `4`: An audience of less than 50 recipients is included as a condition of sending.

  • accepted_time (String)

    Narrowcast message request accepted time in milliseconds. Format: ISO 8601 (e.g. 2020-12-03T10:15:30.121Z) Timezone: UTC

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

    Processing of narrowcast message request completion time in milliseconds. Returned when the phase property is succeeded or failed. Format: ISO 8601 (e.g. 2020-12-03T10:15:30.121Z) Timezone: UTC



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
77
78
79
80
81
# File 'lib/line/bot/v2/messaging_api/model/narrowcast_progress_response.rb', line 49

def initialize(
  phase:,
  success_count: nil,
  failure_count: nil,
  target_count: nil,
  failed_description: nil,
  error_code: nil,
  accepted_time:,
  completed_time: nil,
  **dynamic_attributes
)
  
  @phase = phase
  @success_count = success_count
  @failure_count = failure_count
  @target_count = target_count
  @failed_description = failed_description
  @error_code = error_code
  @accepted_time = accepted_time
  @completed_time = completed_time

  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

#accepted_timeString

Returns Narrowcast message request accepted time in milliseconds. Format: ISO 8601 (e.g. 2020-12-03T10:15:30.121Z) Timezone: UTC.

Returns:

  • (String)

    Narrowcast message request accepted time in milliseconds. Format: ISO 8601 (e.g. 2020-12-03T10:15:30.121Z) Timezone: UTC



36
37
38
# File 'lib/line/bot/v2/messaging_api/model/narrowcast_progress_response.rb', line 36

def accepted_time
  @accepted_time
end

#completed_timeString?

Returns Processing of narrowcast message request completion time in milliseconds. Returned when the phase property is succeeded or failed. Format: ISO 8601 (e.g. 2020-12-03T10:15:30.121Z) Timezone: UTC.

Returns:

  • (String, nil)

    Processing of narrowcast message request completion time in milliseconds. Returned when the phase property is succeeded or failed. Format: ISO 8601 (e.g. 2020-12-03T10:15:30.121Z) Timezone: UTC



39
40
41
# File 'lib/line/bot/v2/messaging_api/model/narrowcast_progress_response.rb', line 39

def completed_time
  @completed_time
end

#error_codeInteger?

Returns Error summary. This is only included with a phase property value of failed. One of: ‘1`: An internal error occurred. `2`: An error occurred because there weren’t enough recipients. ‘3`: A conflict error of requests occurs because a request that has already been accepted is retried. `4`: An audience of less than 50 recipients is included as a condition of sending.

Returns:

  • (Integer, nil)

    Error summary. This is only included with a phase property value of failed. One of: ‘1`: An internal error occurred. `2`: An error occurred because there weren’t enough recipients. ‘3`: A conflict error of requests occurs because a request that has already been accepted is retried. `4`: An audience of less than 50 recipients is included as a condition of sending.



33
34
35
# File 'lib/line/bot/v2/messaging_api/model/narrowcast_progress_response.rb', line 33

def error_code
  @error_code
end

#failed_descriptionString?

Returns The reason the message failed to be sent. This is only included with a ‘phase` property value of `failed`.

Returns:

  • (String, nil)

    The reason the message failed to be sent. This is only included with a ‘phase` property value of `failed`.



30
31
32
# File 'lib/line/bot/v2/messaging_api/model/narrowcast_progress_response.rb', line 30

def failed_description
  @failed_description
end

#failure_countInteger?

Returns The number of users who failed to send the message.

Returns:

  • (Integer, nil)

    The number of users who failed to send the message.



24
25
26
# File 'lib/line/bot/v2/messaging_api/model/narrowcast_progress_response.rb', line 24

def failure_count
  @failure_count
end

#phaseString

Returns (‘waiting’|‘sending’|‘succeeded’|‘failed’) The current status. One of: ‘waiting`: Messages are not yet ready to be sent. They are currently being filtered or processed in some way. `sending`: Messages are currently being sent. `succeeded`: Messages were sent successfully. This may not mean the messages were successfully received. `failed`: Messages failed to be sent. Use the failedDescription property to find the cause of the failure.

Returns:

  • (String)

    (‘waiting’|‘sending’|‘succeeded’|‘failed’) The current status. One of: ‘waiting`: Messages are not yet ready to be sent. They are currently being filtered or processed in some way. `sending`: Messages are currently being sent. `succeeded`: Messages were sent successfully. This may not mean the messages were successfully received. `failed`: Messages failed to be sent. Use the failedDescription property to find the cause of the failure.



18
19
20
# File 'lib/line/bot/v2/messaging_api/model/narrowcast_progress_response.rb', line 18

def phase
  @phase
end

#success_countInteger?

Returns The number of users who successfully received the message.

Returns:

  • (Integer, nil)

    The number of users who successfully received the message.



21
22
23
# File 'lib/line/bot/v2/messaging_api/model/narrowcast_progress_response.rb', line 21

def success_count
  @success_count
end

#target_countInteger?

Returns The number of intended recipients of the message.

Returns:

  • (Integer, nil)

    The number of intended recipients of the message.



27
28
29
# File 'lib/line/bot/v2/messaging_api/model/narrowcast_progress_response.rb', line 27

def target_count
  @target_count
end

Class Method Details

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

Create an instance of the class from a hash

Parameters:

  • args (Hash)

    Hash containing all the required attributes

Returns:



86
87
88
89
# File 'lib/line/bot/v2/messaging_api/model/narrowcast_progress_response.rb', line 86

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



93
94
95
96
97
98
99
# File 'lib/line/bot/v2/messaging_api/model/narrowcast_progress_response.rb', line 93

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



102
103
104
# File 'lib/line/bot/v2/messaging_api/model/narrowcast_progress_response.rb', line 102

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