Class: Bottle::Conversation

Inherits:
Object
  • Object
show all
Defined in:
lib/api_objects/conversation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(phone = nil, handle = nil, name = nil, tags = nil) ⇒ Conversation

Returns a new instance of Conversation.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/api_objects/conversation.rb', line 7

def initialize(phone=nil, handle=nil, name=nil, tags=nil)
  @url_extension = 'conversations'
  if phone.is_a?(Hash)
    attributes = phone.convert_keys_to_symbols
    @phone = attributes[:phone]
    @handle = attributes[:handle]
    @tags = attributes[:tags]
    @name = attributes[:name]
    @id = attributes[:id]
    @conversation_id = attributes[:conversation_id]
    @created_at = attributes[:created_at]
    @updated_at = attributes[:updated_at]
    @relationship_status = attributes[:relationship_status]
    @object_name = attributes[:object_name]
    @object_key = attributes[:object_key]
    @user_id = attributes[:user_id]
    @last_viewed_timestamp = attributes[:last_viewed_timestamp]
    @conversation_name = attributes[:conversation_name]
    @conversation_type = attributes[:conversation_type]
    @conversation_status = attributes[:conversation_status]
    @user_display_identifier = attributes[:user_display_identifier]
    @avatar_color = attributes[:avatar_color]
    @user_phone_active = attributes[:user_phone_active]
    @favorited = attributes[:favorited]
    @last_sent_timestamp = attributes[:last_sent_timestamp]
    @unread_count = attributes[:unread_count]
    @last_message_is_from_user = attributes[:last_message_is_from_user]
    @conversation_title = attributes[:conversation_title]
    @group_identifier = attributes[:group_identifier]
  else
    @phone = phone
    @handle = handle
    @name = name
    @tags = tags
  end
end

Instance Attribute Details

#avatar_colorObject

Returns the value of attribute avatar_color.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def avatar_color
  @avatar_color
end

#conversation_idObject

Returns the value of attribute conversation_id.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def conversation_id
  @conversation_id
end

#conversation_nameObject

Returns the value of attribute conversation_name.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def conversation_name
  @conversation_name
end

#conversation_statusObject

Returns the value of attribute conversation_status.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def conversation_status
  @conversation_status
end

#conversation_titleObject

Returns the value of attribute conversation_title.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def conversation_title
  @conversation_title
end

#conversation_typeObject

Returns the value of attribute conversation_type.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def conversation_type
  @conversation_type
end

#created_atObject

Returns the value of attribute created_at.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def created_at
  @created_at
end

#favoritedObject

Returns the value of attribute favorited.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def favorited
  @favorited
end

#group_identifierObject

Returns the value of attribute group_identifier.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def group_identifier
  @group_identifier
end

#handleObject

Returns the value of attribute handle.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def handle
  @handle
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def id
  @id
end

#last_message_is_from_userObject

Returns the value of attribute last_message_is_from_user.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def last_message_is_from_user
  @last_message_is_from_user
end

#last_sent_timestampObject

Returns the value of attribute last_sent_timestamp.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def last_sent_timestamp
  @last_sent_timestamp
end

#last_viewed_timestampObject

Returns the value of attribute last_viewed_timestamp.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def last_viewed_timestamp
  @last_viewed_timestamp
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def name
  @name
end

#object_keyObject

Returns the value of attribute object_key.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def object_key
  @object_key
end

#object_nameObject

Returns the value of attribute object_name.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def object_name
  @object_name
end

#phoneObject

Returns the value of attribute phone.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def phone
  @phone
end

#relationship_statusObject

Returns the value of attribute relationship_status.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def relationship_status
  @relationship_status
end

#tagsObject

Returns the value of attribute tags.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def tags
  @tags
end

#unread_countObject

Returns the value of attribute unread_count.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def unread_count
  @unread_count
end

#updated_atObject

Returns the value of attribute updated_at.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def updated_at
  @updated_at
end

#user_display_identifierObject

Returns the value of attribute user_display_identifier.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def user_display_identifier
  @user_display_identifier
end

#user_idObject

Returns the value of attribute user_id.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def user_id
  @user_id
end

#user_phone_activeObject

Returns the value of attribute user_phone_active.



4
5
6
# File 'lib/api_objects/conversation.rb', line 4

def user_phone_active
  @user_phone_active
end

Instance Method Details

#send(client) ⇒ Object



44
45
46
# File 'lib/api_objects/conversation.rb', line 44

def send(client)
  client.post(@url_extension, {conversation: {phone: self.phone, handle: self.handle, name: self.name, tags: self.tags}})
end