bottle_ruby 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/api_objects/conversation.rb +49 -0
- data/lib/bottle_ruby.rb +1 -0
- data/lib/client/rest_calls.rb +3 -2
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2225e480768a5c5e61476953388e0016a26df455
|
4
|
+
data.tar.gz: 9fb06709df920162d3b496f1bbfe8aa8da506a99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9122f02366863010a43a4ff19ab64297709a522fa7cf45f3d1594548740da13d72461abea1d44b8fc591e6d51d858a9d814800950fcb39036da5c349665bb6e
|
7
|
+
data.tar.gz: 059e23b3012535a4fa80b79ccf19db5b91d84dab4092a8c3f4f77c8fdcaa2784b08175d8fc0658af6200edba4f3eeefbc74ec144bd5dba0b782ec7baaa4cdef4
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Bottle
|
2
|
+
class Conversation
|
3
|
+
|
4
|
+
attr_accessor :phone, :handle, :name, :tags, :id, :conversation_id, :created_at, :updated_at, :relationship_status, :object_name, :object_key, :user_id, :last_viewed_timestamp, :conversation_name, :conversation_type, :conversation_status, :user_display_identifier, :avatar_color, :user_phone_active, :favorited, :last_sent_timestamp, :unread_count, :last_message_is_from_user, :conversation_title, :group_identifier
|
5
|
+
|
6
|
+
|
7
|
+
def initialize(phone=nil, handle=nil, name=nil, tags=nil)
|
8
|
+
@url_extension = 'conversations'
|
9
|
+
if phone.is_a?(Hash)
|
10
|
+
attributes = phone.convert_keys_to_symbols
|
11
|
+
@phone = attributes[:phone]
|
12
|
+
@handle = attributes[:handle]
|
13
|
+
@tags = attributes[:tags]
|
14
|
+
@name = attributes[:name]
|
15
|
+
@id = attributes[:id]
|
16
|
+
@conversation_id = attributes[:conversation_id]
|
17
|
+
@created_at = attributes[:created_at]
|
18
|
+
@updated_at = attributes[:updated_at]
|
19
|
+
@relationship_status = attributes[:relationship_status]
|
20
|
+
@object_name = attributes[:object_name]
|
21
|
+
@object_key = attributes[:object_key]
|
22
|
+
@user_id = attributes[:user_id]
|
23
|
+
@last_viewed_timestamp = attributes[:last_viewed_timestamp]
|
24
|
+
@conversation_name = attributes[:conversation_name]
|
25
|
+
@conversation_type = attributes[:conversation_type]
|
26
|
+
@conversation_status = attributes[:conversation_status]
|
27
|
+
@user_display_identifier = attributes[:user_display_identifier]
|
28
|
+
@avatar_color = attributes[:avatar_color]
|
29
|
+
@user_phone_active = attributes[:user_phone_active]
|
30
|
+
@favorited = attributes[:favorited]
|
31
|
+
@last_sent_timestamp = attributes[:last_sent_timestamp]
|
32
|
+
@unread_count = attributes[:unread_count]
|
33
|
+
@last_message_is_from_user = attributes[:last_message_is_from_user]
|
34
|
+
@conversation_title = attributes[:conversation_title]
|
35
|
+
@group_identifier = attributes[:group_identifier]
|
36
|
+
else
|
37
|
+
@phone = phone
|
38
|
+
@handle = handle
|
39
|
+
@name = name
|
40
|
+
@tags = tags
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def send(client)
|
45
|
+
client.post(@url_extension, {conversation: {phone: self.phone, handle: self.handle, name: self.name, tags: self.tags}})
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
data/lib/bottle_ruby.rb
CHANGED
data/lib/client/rest_calls.rb
CHANGED
@@ -9,8 +9,9 @@ class Bottle::Client
|
|
9
9
|
def post(url_extension, params)
|
10
10
|
connection = Faraday.new(url: API_URL)
|
11
11
|
response = connection.post(url_extension, params.merge({uid: self.uid, token: self.token}))
|
12
|
-
|
13
|
-
return Bottle::Message.new(
|
12
|
+
attributes = JSON.parse(response.body)
|
13
|
+
return Bottle::Message.new(attributes) if url_extension == 'messages'
|
14
|
+
return Bottle::Conversation.new(attributes) if url_extension == 'conversations'
|
14
15
|
end
|
15
16
|
|
16
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bottle_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Will Schreiber
|
@@ -45,6 +45,7 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
+
- lib/api_objects/conversation.rb
|
48
49
|
- lib/api_objects/message.rb
|
49
50
|
- lib/bottle_ruby.rb
|
50
51
|
- lib/client/rest_calls.rb
|