Class: Sendly::RcsMessageDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/sendly/rcs_resource.rb

Overview

RCS-specific details on a sent message. On a native RCS delivery kind is what was sent ("text" or "card") and agent_name is the brand name recipients see. On an SMS fallback requested_channel is "rcs" and suggestions_dropped is true when suggested replies/actions were dropped (they have no SMS form).

Constant Summary collapse

KINDS =
%w[text card].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ RcsMessageDetails

Returns a new instance of RcsMessageDetails.



73
74
75
76
77
78
79
# File 'lib/sendly/rcs_resource.rb', line 73

def initialize(data)
  @kind = data["kind"]
  @agent_id = data["agentId"] || data["agent_id"]
  @agent_name = data["agentName"] || data["agent_name"]
  @requested_channel = data["requestedChannel"] || data["requested_channel"]
  @suggestions_dropped = data["suggestionsDropped"] || data["suggestions_dropped"] || false
end

Instance Attribute Details

#agent_idObject (readonly)

Returns the value of attribute agent_id.



68
69
70
# File 'lib/sendly/rcs_resource.rb', line 68

def agent_id
  @agent_id
end

#agent_nameObject (readonly)

Returns the value of attribute agent_name.



68
69
70
# File 'lib/sendly/rcs_resource.rb', line 68

def agent_name
  @agent_name
end

#kindObject (readonly)

Returns the value of attribute kind.



68
69
70
# File 'lib/sendly/rcs_resource.rb', line 68

def kind
  @kind
end

#requested_channelObject (readonly)

Returns the value of attribute requested_channel.



68
69
70
# File 'lib/sendly/rcs_resource.rb', line 68

def requested_channel
  @requested_channel
end

#suggestions_droppedObject (readonly)

Returns the value of attribute suggestions_dropped.



68
69
70
# File 'lib/sendly/rcs_resource.rb', line 68

def suggestions_dropped
  @suggestions_dropped
end

Instance Method Details

#to_hObject



81
82
83
84
85
86
87
# File 'lib/sendly/rcs_resource.rb', line 81

def to_h
  {
    kind: kind, agent_id: agent_id, agent_name: agent_name,
    requested_channel: requested_channel,
    suggestions_dropped: suggestions_dropped
  }.compact
end