typetalk 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/.rspec +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +215 -0
- data/Rakefile +7 -0
- data/lib/typetalk.rb +36 -0
- data/lib/typetalk/api.rb +49 -0
- data/lib/typetalk/api/auth.rb +43 -0
- data/lib/typetalk/api/mention.rb +28 -0
- data/lib/typetalk/api/message.rb +105 -0
- data/lib/typetalk/api/notification.rb +77 -0
- data/lib/typetalk/api/topic.rb +56 -0
- data/lib/typetalk/api/user.rb +17 -0
- data/lib/typetalk/connection.rb +31 -0
- data/lib/typetalk/error.rb +7 -0
- data/lib/typetalk/version.rb +3 -0
- data/spec/cassettes/Typetalk_Api_Auth/_get_access_token/should_get_the_correct_resource_by_authorization_code.yml +40 -0
- data/spec/cassettes/Typetalk_Api_Auth/_get_access_token/should_get_the_correct_resource_by_client_credentials.yml +40 -0
- data/spec/cassettes/Typetalk_Api_Auth/_get_access_token/should_get_the_correct_resource_by_client_credentials_when_scope_changed.yml +40 -0
- data/spec/cassettes/Typetalk_Api_Auth/_get_access_token/should_raise_error_when_authorization_code_is_wrong.yml +40 -0
- data/spec/cassettes/Typetalk_Api_Auth/_get_access_token/should_raise_error_when_client_id_is_wrong.yml +40 -0
- data/spec/cassettes/Typetalk_Api_Auth/_get_access_token/should_raise_error_when_client_secret_is_wrong.yml +40 -0
- data/spec/cassettes/Typetalk_Api_Auth/_get_access_token/should_raise_error_when_redirect_uri_mismatch.yml +40 -0
- data/spec/cassettes/Typetalk_Api_Mention/_get_mentions/should_get_the_correct_resource.yml +85 -0
- data/spec/cassettes/Typetalk_Api_Mention/_get_mentions/should_get_the_correct_resource_till_mention.yml +83 -0
- data/spec/cassettes/Typetalk_Api_Mention/_get_mentions/should_get_the_unread_resource.yml +83 -0
- data/spec/cassettes/Typetalk_Api_Mention/_read_mention/should_get_the_correct_resource.yml +83 -0
- data/spec/cassettes/Typetalk_Api_Mention/_read_mention/should_raise_error_when_mention_id_is_wrong.yml +73 -0
- data/spec/cassettes/Typetalk_Api_Message/_get_message/should_get_the_correct_resource.yml +129 -0
- data/spec/cassettes/Typetalk_Api_Message/_get_message/should_raise_error_when_post_id_is_wrong.yml +71 -0
- data/spec/cassettes/Typetalk_Api_Message/_get_message/should_raise_error_when_topic_id_is_wrong.yml +71 -0
- data/spec/cassettes/Typetalk_Api_Message/_like_message/should_get_the_correct_resource.yml +161 -0
- data/spec/cassettes/Typetalk_Api_Message/_like_message/should_raise_error_when_post_id_is_wrong.yml +73 -0
- data/spec/cassettes/Typetalk_Api_Message/_post_message/should_get_the_correct_resource.yml +85 -0
- data/spec/cassettes/Typetalk_Api_Message/_post_message/should_get_the_correct_resource_for_attachments.yml +536 -0
- data/spec/cassettes/Typetalk_Api_Message/_post_message/should_get_the_correct_resource_for_reply.yml +130 -0
- data/spec/cassettes/Typetalk_Api_Message/_post_message/should_get_the_correct_resource_for_talks.yml +88 -0
- data/spec/cassettes/Typetalk_Api_Message/_post_message/should_raise_error_when_topic_id_is_wrong.yml +73 -0
- data/spec/cassettes/Typetalk_Api_Message/_read_message/should_get_the_correct_resource.yml +171 -0
- data/spec/cassettes/Typetalk_Api_Message/_read_message/should_get_the_correct_resource_till_post.yml +171 -0
- data/spec/cassettes/Typetalk_Api_Message/_read_message/should_raise_error_when_post_id_is_wrong.yml +73 -0
- data/spec/cassettes/Typetalk_Api_Message/_remove_message/should_get_the_correct_resource.yml +199 -0
- data/spec/cassettes/Typetalk_Api_Message/_remove_message/should_raise_error_when_post_id_is_wrong.yml +71 -0
- data/spec/cassettes/Typetalk_Api_Message/_unlike_message/should_get_the_correct_resource.yml +200 -0
- data/spec/cassettes/Typetalk_Api_Message/_unlike_message/should_raise_error_when_post_id_is_wrong.yml +71 -0
- data/spec/cassettes/Typetalk_Api_Message/_upload_attachment/should_get_the_correct_resource.yml +258 -0
- data/spec/cassettes/Typetalk_Api_Message/_upload_attachment/should_raise_error_when_topic_id_is_wrong.yml +250 -0
- data/spec/cassettes/Typetalk_Api_Notification/_accept_team/should_get_the_correct_resource.yml +119 -0
- data/spec/cassettes/Typetalk_Api_Notification/_accept_team/should_raise_error_when_invite_team_id_is_wrong.yml +73 -0
- data/spec/cassettes/Typetalk_Api_Notification/_accept_team/should_raise_error_when_team_id_is_wrong.yml +73 -0
- data/spec/cassettes/Typetalk_Api_Notification/_accept_topic/should_get_the_correct_resource.yml +120 -0
- data/spec/cassettes/Typetalk_Api_Notification/_accept_topic/should_raise_error_when_invite_topic_id_is_wrong.yml +73 -0
- data/spec/cassettes/Typetalk_Api_Notification/_accept_topic/should_raise_error_when_topic_id_is_wrong.yml +73 -0
- data/spec/cassettes/Typetalk_Api_Notification/_decline_team/should_get_the_correct_resource.yml +118 -0
- data/spec/cassettes/Typetalk_Api_Notification/_decline_team/should_raise_error_when_invite_team_id_is_wrong.yml +73 -0
- data/spec/cassettes/Typetalk_Api_Notification/_decline_team/should_raise_error_when_team_id_is_wrong.yml +73 -0
- data/spec/cassettes/Typetalk_Api_Notification/_decline_topic/should_get_the_correct_resource.yml +120 -0
- data/spec/cassettes/Typetalk_Api_Notification/_decline_topic/should_raise_error_when_invite_topic_id_is_wrong.yml +73 -0
- data/spec/cassettes/Typetalk_Api_Notification/_decline_topic/should_raise_error_when_topic_id_is_wrong.yml +73 -0
- data/spec/cassettes/Typetalk_Api_Notification/_get_notifications/should_get_the_correct_resource.yml +101 -0
- data/spec/cassettes/Typetalk_Api_Notification/_get_notifications_status/should_get_the_correct_resource.yml +79 -0
- data/spec/cassettes/Typetalk_Api_Notification/_read_notifications/should_get_the_correct_resource.yml +81 -0
- data/spec/cassettes/Typetalk_Api_Topic/_favorite_topic/should_get_the_correct_resource.yml +82 -0
- data/spec/cassettes/Typetalk_Api_Topic/_favorite_topic/should_raise_error_when_topic_id_is_wrong.yml +73 -0
- data/spec/cassettes/Typetalk_Api_Topic/_get_topic/should_get_the_correct_backward_resource.yml +85 -0
- data/spec/cassettes/Typetalk_Api_Topic/_get_topic/should_get_the_correct_forward_resource.yml +84 -0
- data/spec/cassettes/Typetalk_Api_Topic/_get_topic/should_get_the_correct_resource.yml +88 -0
- data/spec/cassettes/Typetalk_Api_Topic/_get_topic/should_raise_error_when_topic_id_is_wrong.yml +71 -0
- data/spec/cassettes/Typetalk_Api_Topic/_get_topic_members/should_get_the_correct_resource.yml +81 -0
- data/spec/cassettes/Typetalk_Api_Topic/_get_topic_members/should_raise_error_when_topic_id_is_wrong.yml +71 -0
- data/spec/cassettes/Typetalk_Api_Topic/_get_topics/should_get_the_correct_resource.yml +83 -0
- data/spec/cassettes/Typetalk_Api_Topic/_unfavorite_topic/should_get_the_correct_resource.yml +80 -0
- data/spec/cassettes/Typetalk_Api_Topic/_unfavorite_topic/should_raise_error_when_topic_id_is_wrong.yml +71 -0
- data/spec/cassettes/Typetalk_Api_User/_get_profile/should_get_the_correct_resource.yml +81 -0
- data/spec/cassettes/Typetalk_Api_User/_get_profile/should_raise_error_when_access_token_is_wrong.yml +73 -0
- data/spec/cassettes/Typetalk_Api_User/_get_profile/should_raise_error_when_scope_is_wrong.yml +73 -0
- data/spec/fixtures/attachments/logo_cacoo.jpg +0 -0
- data/spec/fixtures/attachments/logo_typetalk.jpg +0 -0
- data/spec/spec_helper.rb +36 -0
- data/spec/typetalk/api/auth_spec.rb +81 -0
- data/spec/typetalk/api/mention_spec.rb +73 -0
- data/spec/typetalk/api/message_spec.rb +232 -0
- data/spec/typetalk/api/notification_spec.rb +200 -0
- data/spec/typetalk/api/topic_spec.rb +150 -0
- data/spec/typetalk/api/user_spec.rb +27 -0
- data/typetalk.gemspec +33 -0
- metadata +326 -0
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'mime/types'
|
2
|
+
|
3
|
+
module Typetalk
|
4
|
+
class Api
|
5
|
+
|
6
|
+
module Message
|
7
|
+
|
8
|
+
def post_message(topic_id, message, token:nil, reply_to:nil, file_keys:nil, talk_ids:nil)
|
9
|
+
response = connection.post do |req|
|
10
|
+
req.url "#{endpoint}/topics/#{topic_id}"
|
11
|
+
req.params[:access_token] = token || access_token
|
12
|
+
body = {}
|
13
|
+
body[:message] = message
|
14
|
+
body[:replyTo] = reply_to unless reply_to.nil?
|
15
|
+
body.merge! to_request_params('fileKeys', file_keys)
|
16
|
+
body.merge! to_request_params('talkIds', talk_ids)
|
17
|
+
req.body = body
|
18
|
+
end
|
19
|
+
parse_response(response)
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
def upload_attachment(topic_id, file, token:nil)
|
24
|
+
raise InvalidFileSize if File.size(file) > 10485760 # > 10MB
|
25
|
+
|
26
|
+
response = connection(multipart:true).post do |req|
|
27
|
+
req.url "#{endpoint}/topics/#{topic_id}/attachments"
|
28
|
+
req.params[:access_token] = token || access_token
|
29
|
+
req.body = { file: Faraday::UploadIO.new(file, MIME::Types.type_for(file).first.to_s) }
|
30
|
+
end
|
31
|
+
parse_response(response)
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
def get_message(topic_id, post_id, token:nil)
|
36
|
+
response = connection.get do |req|
|
37
|
+
req.url "#{endpoint}/topics/#{topic_id}/posts/#{post_id}"
|
38
|
+
req.params[:access_token] = token || access_token
|
39
|
+
end
|
40
|
+
parse_response(response)
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
def remove_message(topic_id, post_id, token:nil)
|
45
|
+
response = connection.delete do |req|
|
46
|
+
req.url "#{endpoint}/topics/#{topic_id}/posts/#{post_id}"
|
47
|
+
req.params[:access_token] = token || access_token
|
48
|
+
end
|
49
|
+
parse_response(response)
|
50
|
+
response.status == 200
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
def like_message(topic_id, post_id, token:nil)
|
55
|
+
response = connection.post do |req|
|
56
|
+
req.url "#{endpoint}/topics/#{topic_id}/posts/#{post_id}/like"
|
57
|
+
req.params[:access_token] = token || access_token
|
58
|
+
end
|
59
|
+
parse_response(response)
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
def unlike_message(topic_id, post_id, token:nil)
|
64
|
+
response = connection.delete do |req|
|
65
|
+
req.url "#{endpoint}/topics/#{topic_id}/posts/#{post_id}/like"
|
66
|
+
req.params[:access_token] = token || access_token
|
67
|
+
end
|
68
|
+
parse_response(response)
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
def read_message(topic_id, post_id=nil, token:nil)
|
73
|
+
response = connection.post do |req|
|
74
|
+
req.url "#{endpoint}/bookmark/save"
|
75
|
+
req.params[:access_token] = token || access_token
|
76
|
+
body = {}
|
77
|
+
body[:topicId] = topic_id
|
78
|
+
body[:postId] = post_id unless post_id.nil?
|
79
|
+
req.body = body
|
80
|
+
end
|
81
|
+
parse_response(response)
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
private
|
87
|
+
def to_request_params(key, values)
|
88
|
+
params = {}
|
89
|
+
unless values.nil?
|
90
|
+
if values.is_a?(Array)
|
91
|
+
values.each_with_index do |k, i|
|
92
|
+
break if i > 4
|
93
|
+
params["#{key}[#{i}]"] = k.to_s
|
94
|
+
end
|
95
|
+
else
|
96
|
+
params["#{key}[0]"] = values.to_s
|
97
|
+
end
|
98
|
+
end
|
99
|
+
params
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Typetalk
|
2
|
+
class Api
|
3
|
+
|
4
|
+
module Notification
|
5
|
+
|
6
|
+
def get_notifications(token:nil)
|
7
|
+
response = connection.get do |req|
|
8
|
+
req.url "#{endpoint}/notifications"
|
9
|
+
req.params[:access_token] = token || access_token
|
10
|
+
end
|
11
|
+
parse_response(response)
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
def get_notifications_status(token:nil)
|
16
|
+
response = connection.get do |req|
|
17
|
+
req.url "#{endpoint}/notifications/status"
|
18
|
+
req.params[:access_token] = token || access_token
|
19
|
+
end
|
20
|
+
parse_response(response)
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def read_notifications(token:nil)
|
25
|
+
response = connection.put do |req|
|
26
|
+
req.url "#{endpoint}/notifications/open"
|
27
|
+
req.params[:access_token] = token || access_token
|
28
|
+
end
|
29
|
+
parse_response(response)
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
def accept_team(team_id, invite_team_id, token:nil)
|
37
|
+
response = connection.post do |req|
|
38
|
+
req.url "#{endpoint}/teams/#{team_id}/members/invite/#{invite_team_id}/accept"
|
39
|
+
req.params[:access_token] = token || access_token
|
40
|
+
end
|
41
|
+
parse_response(response)
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
def decline_team(team_id, invite_team_id, token:nil)
|
46
|
+
response = connection.post do |req|
|
47
|
+
req.url "#{endpoint}/teams/#{team_id}/members/invite/#{invite_team_id}/decline"
|
48
|
+
req.params[:access_token] = token || access_token
|
49
|
+
end
|
50
|
+
parse_response(response)
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
def accept_topic(topic_id, invite_topic_id, token:nil)
|
58
|
+
response = connection.post do |req|
|
59
|
+
req.url "#{endpoint}/topics/#{topic_id}/members/invite/#{invite_topic_id}/accept"
|
60
|
+
req.params[:access_token] = token || access_token
|
61
|
+
end
|
62
|
+
parse_response(response)
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
def decline_topic(topic_id, invite_topic_id, token:nil)
|
67
|
+
response = connection.post do |req|
|
68
|
+
req.url "#{endpoint}/topics/#{topic_id}/members/invite/#{invite_topic_id}/decline"
|
69
|
+
req.params[:access_token] = token || access_token
|
70
|
+
end
|
71
|
+
parse_response(response)
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Typetalk
|
2
|
+
class Api
|
3
|
+
|
4
|
+
module Topic
|
5
|
+
|
6
|
+
def get_topics(token:nil)
|
7
|
+
response = connection.get do |req|
|
8
|
+
req.url "#{endpoint}/topics"
|
9
|
+
req.params[:access_token] = token || access_token
|
10
|
+
end
|
11
|
+
parse_response(response)
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
def get_topic(topic_id, token:nil, count:nil, from:nil, direction:nil)
|
16
|
+
response = connection.get do |req|
|
17
|
+
req.url "#{endpoint}/topics/#{topic_id}"
|
18
|
+
req.params[:access_token] = token || access_token
|
19
|
+
req.params[:count] = count unless count.nil?
|
20
|
+
req.params[:from] = from unless from.nil?
|
21
|
+
req.params[:direction] = direction unless direction.nil?
|
22
|
+
end
|
23
|
+
parse_response(response)
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
def get_topic_members(topic_id, token:nil)
|
28
|
+
response = connection.get do |req|
|
29
|
+
req.url "#{endpoint}/topics/#{topic_id}/members/status"
|
30
|
+
req.params[:access_token] = token || access_token
|
31
|
+
end
|
32
|
+
parse_response(response)
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
def favorite_topic(topic_id, token:nil)
|
37
|
+
response = connection.post do |req|
|
38
|
+
req.url "#{endpoint}/topics/#{topic_id}/favorite"
|
39
|
+
req.params[:access_token] = token || access_token
|
40
|
+
end
|
41
|
+
parse_response(response)
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
def unfavorite_topic(topic_id, token:nil)
|
46
|
+
response = connection.delete do |req|
|
47
|
+
req.url "#{endpoint}/topics/#{topic_id}/favorite"
|
48
|
+
req.params[:access_token] = token || access_token
|
49
|
+
end
|
50
|
+
parse_response(response)
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Typetalk
|
2
|
+
class Api
|
3
|
+
|
4
|
+
module User
|
5
|
+
|
6
|
+
def get_profile(token:nil)
|
7
|
+
response = connection.get do |req|
|
8
|
+
req.url "#{endpoint}/profile"
|
9
|
+
req.params[:access_token] = token || access_token
|
10
|
+
end
|
11
|
+
parse_response(response)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
|
3
|
+
module Typetalk
|
4
|
+
|
5
|
+
module Connection
|
6
|
+
private
|
7
|
+
|
8
|
+
def endpoint
|
9
|
+
Typetalk.config.endpoint
|
10
|
+
end
|
11
|
+
|
12
|
+
def connection_options
|
13
|
+
{
|
14
|
+
:headers => {'Accept' => 'application/json; charset=utf-8', 'User-Agent' => "Typetalk Rubygem #{Typetalk::VERSION}"},
|
15
|
+
:proxy => Typetalk.config.proxy,
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def connection(multipart:false)
|
20
|
+
Faraday.new(connection_options) do |conn|
|
21
|
+
conn.request :multipart if multipart
|
22
|
+
conn.use Faraday::Request::UrlEncoded
|
23
|
+
conn.use Faraday::Adapter::NetHttp
|
24
|
+
# conn.use Faraday::Response::ParseJson
|
25
|
+
# conn.use Faraday::Response::Logger
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://typetalk.in/oauth2/access_token
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: client_id=(CLIENT_ID)&client_secret=(CLIENT_SECRET)&code=(AUTHORIZATION_CODE)&grant_type=authorization_code&redirect_uri=http%3A%2F%2Fdummy%2F&scope=topic.read%2Ctopic.post%2Cmy
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json; charset=utf-8
|
12
|
+
User-Agent:
|
13
|
+
- Typetalk Rubygem 0.0.1
|
14
|
+
Content-Type:
|
15
|
+
- application/x-www-form-urlencoded
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- nginx
|
25
|
+
Date:
|
26
|
+
- Thu, 15 May 2014 05:41:51 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Strict-Transport-Security:
|
34
|
+
- max-age=2592000
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: '{"access_token":"(ACCESS_TOKEN)","expires_in":3600,"scope":"topic.read,topic.post,my","refresh_token":"(REFRESH_TOKEN)","token_type":"Bearer"}'
|
38
|
+
http_version:
|
39
|
+
recorded_at: Thu, 15 May 2014 05:41:51 GMT
|
40
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://typetalk.in/oauth2/access_token
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: client_id=(CLIENT_ID)&client_secret=(CLIENT_SECRET)&grant_type=client_credentials&scope=topic.read%2Ctopic.post%2Cmy
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json; charset=utf-8
|
12
|
+
User-Agent:
|
13
|
+
- Typetalk Rubygem 0.0.1
|
14
|
+
Content-Type:
|
15
|
+
- application/x-www-form-urlencoded
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- nginx
|
25
|
+
Date:
|
26
|
+
- Thu, 15 May 2014 05:27:29 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Strict-Transport-Security:
|
34
|
+
- max-age=2592000
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: '{"access_token":"(ACCESS_TOKEN)","expires_in":3600,"scope":"topic.read,topic.post,my","refresh_token":"(REFRESH_TOKEN)","token_type":"Bearer"}'
|
38
|
+
http_version:
|
39
|
+
recorded_at: Thu, 15 May 2014 05:27:29 GMT
|
40
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://typetalk.in/oauth2/access_token
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: client_id=(CLIENT_ID)&client_secret=(CLIENT_SECRET)&grant_type=client_credentials&scope=my
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json; charset=utf-8
|
12
|
+
User-Agent:
|
13
|
+
- Typetalk Rubygem 0.0.1
|
14
|
+
Content-Type:
|
15
|
+
- application/x-www-form-urlencoded
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- nginx
|
25
|
+
Date:
|
26
|
+
- Thu, 15 May 2014 05:27:30 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Strict-Transport-Security:
|
34
|
+
- max-age=2592000
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: '{"access_token":"(ACCESS_TOKEN)","expires_in":3600,"scope":"my","refresh_token":"(REFRESH_TOKEN)","token_type":"Bearer"}'
|
38
|
+
http_version:
|
39
|
+
recorded_at: Thu, 15 May 2014 05:27:30 GMT
|
40
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://typetalk.in/oauth2/access_token
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: client_id=(CLIENT_ID)&client_secret=(CLIENT_SECRET)&code=(AUTHORIZATION_CODE)&grant_type=authorization_code&redirect_uri=http%3A%2F%2Fdummy%2F&scope=topic.read%2Ctopic.post%2Cmy
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json; charset=utf-8
|
12
|
+
User-Agent:
|
13
|
+
- Typetalk Rubygem 0.0.1
|
14
|
+
Content-Type:
|
15
|
+
- application/x-www-form-urlencoded
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 401
|
21
|
+
message: Unauthorized
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- nginx
|
25
|
+
Date:
|
26
|
+
- Thu, 15 May 2014 05:56:36 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Content-Length:
|
30
|
+
- '48'
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Www-Authenticate:
|
34
|
+
- Bearer error="invalid_grant"
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: '{"error":"invalid_grant","error_description":""}'
|
38
|
+
http_version:
|
39
|
+
recorded_at: Thu, 15 May 2014 05:56:36 GMT
|
40
|
+
recorded_with: VCR 2.9.0
|