typetalk 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +6 -0
- data/README.md +7 -1
- data/lib/typetalk/api.rb +9 -3
- data/lib/typetalk/api/auth.rb +35 -13
- data/lib/typetalk/api/mention.rb +10 -6
- data/lib/typetalk/api/message.rb +31 -17
- data/lib/typetalk/api/notification.rb +28 -14
- data/lib/typetalk/api/topic.rb +23 -13
- data/lib/typetalk/api/user.rb +4 -2
- data/lib/typetalk/connection.rb +4 -2
- data/lib/typetalk/version.rb +1 -1
- data/spec/cassettes/Typetalk_Api/_access_token/should_get_access_token.yml +40 -0
- data/spec/cassettes/Typetalk_Api/_access_token/should_not_update_access_token.yml +40 -0
- data/spec/cassettes/Typetalk_Api/_access_token/should_update_access_token_when_access_token_is_expired.yml +77 -0
- data/spec/cassettes/Typetalk_Api_Auth/_update_access_token/should_get_the_correct_resource_by_client_credentials.yml +77 -0
- data/spec/cassettes/Typetalk_Api_Auth/_update_access_token/should_raise_error_when_refresh_token_is_wrong.yml +77 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/typetalk/api/auth_spec.rb +22 -0
- data/spec/typetalk/api/message_spec.rb +5 -5
- data/spec/typetalk/api_spec.rb +45 -0
- data/typetalk.gemspec +2 -2
- metadata +61 -25
- checksums.yaml +0 -7
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,7 +1,13 @@
|
|
1
|
-
# Typetalk
|
1
|
+
# Typetalk [![Build Status](https://secure.travis-ci.org/umakoz/typetalk.png)](http://travis-ci.org/umakoz/typetalk)
|
2
2
|
|
3
3
|
A Ruby wrapper for [Typetalk API](http://developers.typetalk.in/api.html). The Typetalk gem provides an easy-to-use wrapper for Typetalk's REST APIs.
|
4
4
|
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
* Ruby 1.9.3 or higher
|
8
|
+
* Typetalk account
|
9
|
+
|
10
|
+
|
5
11
|
|
6
12
|
|
7
13
|
|
data/lib/typetalk/api.rb
CHANGED
@@ -5,7 +5,7 @@ module Typetalk
|
|
5
5
|
class Api
|
6
6
|
include Connection
|
7
7
|
|
8
|
-
Dir[File.join(
|
8
|
+
Dir[File.join(File.dirname(__FILE__), 'api/*.rb')].each{|f| require f}
|
9
9
|
include Auth
|
10
10
|
include User
|
11
11
|
include Topic
|
@@ -15,8 +15,14 @@ module Typetalk
|
|
15
15
|
|
16
16
|
|
17
17
|
def access_token
|
18
|
-
@access_token
|
19
|
-
|
18
|
+
if @access_token.nil?
|
19
|
+
@access_token = get_access_token
|
20
|
+
@access_token.expire_time = Time.now.to_i + @access_token.expires_in.to_i
|
21
|
+
elsif Time.now.to_i >= @access_token.expire_time
|
22
|
+
@access_token = update_access_token(@access_token.refresh_token)
|
23
|
+
@access_token.expire_time = Time.now.to_i + @access_token.expires_in.to_i
|
24
|
+
end
|
25
|
+
@access_token.access_token
|
20
26
|
end
|
21
27
|
|
22
28
|
|
data/lib/typetalk/api/auth.rb
CHANGED
@@ -4,32 +4,54 @@ module Typetalk
|
|
4
4
|
module Auth
|
5
5
|
attr_accessor :authorization_code
|
6
6
|
|
7
|
-
def get_access_token(
|
7
|
+
def get_access_token(options={})
|
8
|
+
options = {client_id:nil, client_secret:nil, grant_type:nil, scope:nil, code:nil, redirect_uri:nil}.merge(options)
|
9
|
+
|
8
10
|
body = {
|
9
|
-
client_id: client_id || Typetalk.config.client_id,
|
10
|
-
client_secret: client_secret || Typetalk.config.client_secret,
|
11
|
-
grant_type: grant_type || Typetalk.config.grant_type,
|
12
|
-
scope: scope || Typetalk.config.scope,
|
11
|
+
client_id: options[:client_id] || Typetalk.config.client_id,
|
12
|
+
client_secret: options[:client_secret] || Typetalk.config.client_secret,
|
13
|
+
grant_type: options[:grant_type] || Typetalk.config.grant_type,
|
14
|
+
scope: options[:scope] || Typetalk.config.scope,
|
13
15
|
}
|
14
16
|
|
15
17
|
if body[:grant_type] == 'authorization_code'
|
16
|
-
body[:code] = code || @authorization_code
|
17
|
-
body[:redirect_uri] = redirect_uri || Typetalk.config.redirect_uri
|
18
|
+
body[:code] = options[:code] || @authorization_code
|
19
|
+
body[:redirect_uri] = options[:redirect_uri] || Typetalk.config.redirect_uri
|
20
|
+
end
|
21
|
+
|
22
|
+
response = connection.post do |req|
|
23
|
+
req.url 'https://typetalk.in/oauth2/access_token'
|
24
|
+
req.body = body
|
18
25
|
end
|
26
|
+
parse_response(response)
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
def update_access_token(refresh_token, options={})
|
31
|
+
options = {client_id:nil, client_secret:nil}.merge(options)
|
32
|
+
|
33
|
+
body = {
|
34
|
+
client_id: options[:client_id] || Typetalk.config.client_id,
|
35
|
+
client_secret: options[:client_secret] || Typetalk.config.client_secret,
|
36
|
+
grant_type: 'refresh_token',
|
37
|
+
refresh_token: refresh_token
|
38
|
+
}
|
19
39
|
|
20
40
|
response = connection.post do |req|
|
21
|
-
|
22
|
-
|
41
|
+
req.url 'https://typetalk.in/oauth2/access_token'
|
42
|
+
req.body = body
|
23
43
|
end
|
24
44
|
parse_response(response)
|
25
45
|
end
|
26
46
|
|
27
47
|
|
28
|
-
def self.authorize_url(
|
48
|
+
def self.authorize_url(options={})
|
49
|
+
options = {client_id:nil, redirect_uri:nil, scope:nil}.merge(options)
|
50
|
+
|
29
51
|
params = {
|
30
|
-
client_id: client_id || Typetalk.config.client_id,
|
31
|
-
redirect_uri: redirect_uri || Typetalk.config.redirect_uri,
|
32
|
-
scope: scope || Typetalk.config.scope,
|
52
|
+
client_id: options[:client_id] || Typetalk.config.client_id,
|
53
|
+
redirect_uri: options[:redirect_uri] || Typetalk.config.redirect_uri,
|
54
|
+
scope: options[:scope] || Typetalk.config.scope,
|
33
55
|
response_type: 'code',
|
34
56
|
}
|
35
57
|
url = URI.parse('https://typetalk.in/oauth2/authorize')
|
data/lib/typetalk/api/mention.rb
CHANGED
@@ -3,21 +3,25 @@ module Typetalk
|
|
3
3
|
|
4
4
|
module Mention
|
5
5
|
|
6
|
-
def get_mentions(
|
6
|
+
def get_mentions(options={})
|
7
|
+
options = {token:nil, from:nil, unread:nil}.merge(options)
|
8
|
+
|
7
9
|
response = connection.get do |req|
|
8
10
|
req.url "#{endpoint}/mentions"
|
9
|
-
req.params[:access_token] = token || access_token
|
10
|
-
req.params[:from] = from unless from.nil?
|
11
|
-
req.params[:unread] = unread unless unread.nil?
|
11
|
+
req.params[:access_token] = options[:token] || access_token
|
12
|
+
req.params[:from] = options[:from] unless options[:from].nil?
|
13
|
+
req.params[:unread] = options[:unread] unless options[:unread].nil?
|
12
14
|
end
|
13
15
|
parse_response(response)
|
14
16
|
end
|
15
17
|
|
16
18
|
|
17
|
-
def read_mention(mention_id,
|
19
|
+
def read_mention(mention_id, options={})
|
20
|
+
options = {token:nil}.merge(options)
|
21
|
+
|
18
22
|
response = connection.put do |req|
|
19
23
|
req.url "#{endpoint}/mentions/#{mention_id}"
|
20
|
-
req.params[:access_token] = token || access_token
|
24
|
+
req.params[:access_token] = options[:token] || access_token
|
21
25
|
end
|
22
26
|
parse_response(response)
|
23
27
|
end
|
data/lib/typetalk/api/message.rb
CHANGED
@@ -5,74 +5,88 @@ module Typetalk
|
|
5
5
|
|
6
6
|
module Message
|
7
7
|
|
8
|
-
def post_message(topic_id, message,
|
8
|
+
def post_message(topic_id, message, options={})
|
9
|
+
options = {token:nil, reply_to:nil, file_keys:nil, talk_ids:nil}.merge(options)
|
10
|
+
|
9
11
|
response = connection.post do |req|
|
10
12
|
req.url "#{endpoint}/topics/#{topic_id}"
|
11
|
-
req.params[:access_token] = token || access_token
|
13
|
+
req.params[:access_token] = options[:token] || access_token
|
12
14
|
body = {}
|
13
15
|
body[:message] = message
|
14
|
-
body[:replyTo] = reply_to unless reply_to.nil?
|
15
|
-
body.merge! to_request_params(
|
16
|
-
body.merge! to_request_params(
|
16
|
+
body[:replyTo] = options[:reply_to] unless options[:reply_to].nil?
|
17
|
+
body.merge! to_request_params(:fileKeys, options[:file_keys])
|
18
|
+
body.merge! to_request_params(:talkIds, options[:talk_ids])
|
17
19
|
req.body = body
|
18
20
|
end
|
19
21
|
parse_response(response)
|
20
22
|
end
|
21
23
|
|
22
24
|
|
23
|
-
def upload_attachment(topic_id, file,
|
25
|
+
def upload_attachment(topic_id, file, options={})
|
26
|
+
options = {token:nil}.merge(options)
|
27
|
+
|
24
28
|
raise InvalidFileSize if File.size(file) > 10485760 # > 10MB
|
25
29
|
|
26
30
|
response = connection(multipart:true).post do |req|
|
27
31
|
req.url "#{endpoint}/topics/#{topic_id}/attachments"
|
28
|
-
req.params[:access_token] = token || access_token
|
32
|
+
req.params[:access_token] = options[:token] || access_token
|
29
33
|
req.body = { file: Faraday::UploadIO.new(file, MIME::Types.type_for(file).first.to_s) }
|
30
34
|
end
|
31
35
|
parse_response(response)
|
32
36
|
end
|
33
37
|
|
34
38
|
|
35
|
-
def get_message(topic_id, post_id,
|
39
|
+
def get_message(topic_id, post_id, options={})
|
40
|
+
options = {token:nil}.merge(options)
|
41
|
+
|
36
42
|
response = connection.get do |req|
|
37
43
|
req.url "#{endpoint}/topics/#{topic_id}/posts/#{post_id}"
|
38
|
-
req.params[:access_token] = token || access_token
|
44
|
+
req.params[:access_token] = options[:token] || access_token
|
39
45
|
end
|
40
46
|
parse_response(response)
|
41
47
|
end
|
42
48
|
|
43
49
|
|
44
|
-
def remove_message(topic_id, post_id,
|
50
|
+
def remove_message(topic_id, post_id, options={})
|
51
|
+
options = {token:nil}.merge(options)
|
52
|
+
|
45
53
|
response = connection.delete do |req|
|
46
54
|
req.url "#{endpoint}/topics/#{topic_id}/posts/#{post_id}"
|
47
|
-
req.params[:access_token] = token || access_token
|
55
|
+
req.params[:access_token] = options[:token] || access_token
|
48
56
|
end
|
49
57
|
parse_response(response)
|
50
58
|
response.status == 200
|
51
59
|
end
|
52
60
|
|
53
61
|
|
54
|
-
def like_message(topic_id, post_id,
|
62
|
+
def like_message(topic_id, post_id, options={})
|
63
|
+
options = {token:nil}.merge(options)
|
64
|
+
|
55
65
|
response = connection.post do |req|
|
56
66
|
req.url "#{endpoint}/topics/#{topic_id}/posts/#{post_id}/like"
|
57
|
-
req.params[:access_token] = token || access_token
|
67
|
+
req.params[:access_token] = options[:token] || access_token
|
58
68
|
end
|
59
69
|
parse_response(response)
|
60
70
|
end
|
61
71
|
|
62
72
|
|
63
|
-
def unlike_message(topic_id, post_id,
|
73
|
+
def unlike_message(topic_id, post_id, options={})
|
74
|
+
options = {token:nil}.merge(options)
|
75
|
+
|
64
76
|
response = connection.delete do |req|
|
65
77
|
req.url "#{endpoint}/topics/#{topic_id}/posts/#{post_id}/like"
|
66
|
-
req.params[:access_token] = token || access_token
|
78
|
+
req.params[:access_token] = options[:token] || access_token
|
67
79
|
end
|
68
80
|
parse_response(response)
|
69
81
|
end
|
70
82
|
|
71
83
|
|
72
|
-
def read_message(topic_id, post_id=nil,
|
84
|
+
def read_message(topic_id, post_id=nil, options={})
|
85
|
+
options = {token:nil}.merge(options)
|
86
|
+
|
73
87
|
response = connection.post do |req|
|
74
88
|
req.url "#{endpoint}/bookmark/save"
|
75
|
-
req.params[:access_token] = token || access_token
|
89
|
+
req.params[:access_token] = options[:token] || access_token
|
76
90
|
body = {}
|
77
91
|
body[:topicId] = topic_id
|
78
92
|
body[:postId] = post_id unless post_id.nil?
|
@@ -3,28 +3,34 @@ module Typetalk
|
|
3
3
|
|
4
4
|
module Notification
|
5
5
|
|
6
|
-
def get_notifications(
|
6
|
+
def get_notifications(options={})
|
7
|
+
options = {token:nil}.merge(options)
|
8
|
+
|
7
9
|
response = connection.get do |req|
|
8
10
|
req.url "#{endpoint}/notifications"
|
9
|
-
req.params[:access_token] = token || access_token
|
11
|
+
req.params[:access_token] = options[:token] || access_token
|
10
12
|
end
|
11
13
|
parse_response(response)
|
12
14
|
end
|
13
15
|
|
14
16
|
|
15
|
-
def get_notifications_status(
|
17
|
+
def get_notifications_status(options={})
|
18
|
+
options = {token:nil}.merge(options)
|
19
|
+
|
16
20
|
response = connection.get do |req|
|
17
21
|
req.url "#{endpoint}/notifications/status"
|
18
|
-
req.params[:access_token] = token || access_token
|
22
|
+
req.params[:access_token] = options[:token] || access_token
|
19
23
|
end
|
20
24
|
parse_response(response)
|
21
25
|
end
|
22
26
|
|
23
27
|
|
24
|
-
def read_notifications(
|
28
|
+
def read_notifications(options={})
|
29
|
+
options = {token:nil}.merge(options)
|
30
|
+
|
25
31
|
response = connection.put do |req|
|
26
32
|
req.url "#{endpoint}/notifications/open"
|
27
|
-
req.params[:access_token] = token || access_token
|
33
|
+
req.params[:access_token] = options[:token] || access_token
|
28
34
|
end
|
29
35
|
parse_response(response)
|
30
36
|
end
|
@@ -33,19 +39,23 @@ module Typetalk
|
|
33
39
|
|
34
40
|
|
35
41
|
|
36
|
-
def accept_team(team_id, invite_team_id,
|
42
|
+
def accept_team(team_id, invite_team_id, options={})
|
43
|
+
options = {token:nil}.merge(options)
|
44
|
+
|
37
45
|
response = connection.post do |req|
|
38
46
|
req.url "#{endpoint}/teams/#{team_id}/members/invite/#{invite_team_id}/accept"
|
39
|
-
req.params[:access_token] = token || access_token
|
47
|
+
req.params[:access_token] = options[:token] || access_token
|
40
48
|
end
|
41
49
|
parse_response(response)
|
42
50
|
end
|
43
51
|
|
44
52
|
|
45
|
-
def decline_team(team_id, invite_team_id,
|
53
|
+
def decline_team(team_id, invite_team_id, options={})
|
54
|
+
options = {token:nil}.merge(options)
|
55
|
+
|
46
56
|
response = connection.post do |req|
|
47
57
|
req.url "#{endpoint}/teams/#{team_id}/members/invite/#{invite_team_id}/decline"
|
48
|
-
req.params[:access_token] = token || access_token
|
58
|
+
req.params[:access_token] = options[:token] || access_token
|
49
59
|
end
|
50
60
|
parse_response(response)
|
51
61
|
end
|
@@ -54,19 +64,23 @@ module Typetalk
|
|
54
64
|
|
55
65
|
|
56
66
|
|
57
|
-
def accept_topic(topic_id, invite_topic_id,
|
67
|
+
def accept_topic(topic_id, invite_topic_id, options={})
|
68
|
+
options = {token:nil}.merge(options)
|
69
|
+
|
58
70
|
response = connection.post do |req|
|
59
71
|
req.url "#{endpoint}/topics/#{topic_id}/members/invite/#{invite_topic_id}/accept"
|
60
|
-
req.params[:access_token] = token || access_token
|
72
|
+
req.params[:access_token] = options[:token] || access_token
|
61
73
|
end
|
62
74
|
parse_response(response)
|
63
75
|
end
|
64
76
|
|
65
77
|
|
66
|
-
def decline_topic(topic_id, invite_topic_id,
|
78
|
+
def decline_topic(topic_id, invite_topic_id, options={})
|
79
|
+
options = {token:nil}.merge(options)
|
80
|
+
|
67
81
|
response = connection.post do |req|
|
68
82
|
req.url "#{endpoint}/topics/#{topic_id}/members/invite/#{invite_topic_id}/decline"
|
69
|
-
req.params[:access_token] = token || access_token
|
83
|
+
req.params[:access_token] = options[:token] || access_token
|
70
84
|
end
|
71
85
|
parse_response(response)
|
72
86
|
end
|
data/lib/typetalk/api/topic.rb
CHANGED
@@ -3,49 +3,59 @@ module Typetalk
|
|
3
3
|
|
4
4
|
module Topic
|
5
5
|
|
6
|
-
def get_topics(
|
6
|
+
def get_topics(options={})
|
7
|
+
options = {token:nil}.merge(options)
|
8
|
+
|
7
9
|
response = connection.get do |req|
|
8
10
|
req.url "#{endpoint}/topics"
|
9
|
-
req.params[:access_token] = token || access_token
|
11
|
+
req.params[:access_token] = options[:token] || access_token
|
10
12
|
end
|
11
13
|
parse_response(response)
|
12
14
|
end
|
13
15
|
|
14
16
|
|
15
|
-
def get_topic(topic_id,
|
17
|
+
def get_topic(topic_id, options={})
|
18
|
+
options = {token:nil, count:nil, from:nil, direction:nil}.merge(options)
|
19
|
+
|
16
20
|
response = connection.get do |req|
|
17
21
|
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
|
+
req.params[:access_token] = options[:token] || access_token
|
23
|
+
req.params[:count] = options[:count] unless options[:count].nil?
|
24
|
+
req.params[:from] = options[:from] unless options[:from].nil?
|
25
|
+
req.params[:direction] = options[:direction] unless options[:direction].nil?
|
22
26
|
end
|
23
27
|
parse_response(response)
|
24
28
|
end
|
25
29
|
|
26
30
|
|
27
|
-
def get_topic_members(topic_id,
|
31
|
+
def get_topic_members(topic_id, options={})
|
32
|
+
options = {token:nil}.merge(options)
|
33
|
+
|
28
34
|
response = connection.get do |req|
|
29
35
|
req.url "#{endpoint}/topics/#{topic_id}/members/status"
|
30
|
-
req.params[:access_token] = token || access_token
|
36
|
+
req.params[:access_token] = options[:token] || access_token
|
31
37
|
end
|
32
38
|
parse_response(response)
|
33
39
|
end
|
34
40
|
|
35
41
|
|
36
|
-
def favorite_topic(topic_id,
|
42
|
+
def favorite_topic(topic_id, options={})
|
43
|
+
options = {token:nil}.merge(options)
|
44
|
+
|
37
45
|
response = connection.post do |req|
|
38
46
|
req.url "#{endpoint}/topics/#{topic_id}/favorite"
|
39
|
-
req.params[:access_token] = token || access_token
|
47
|
+
req.params[:access_token] = options[:token] || access_token
|
40
48
|
end
|
41
49
|
parse_response(response)
|
42
50
|
end
|
43
51
|
|
44
52
|
|
45
|
-
def unfavorite_topic(topic_id,
|
53
|
+
def unfavorite_topic(topic_id, options={})
|
54
|
+
options = {token:nil}.merge(options)
|
55
|
+
|
46
56
|
response = connection.delete do |req|
|
47
57
|
req.url "#{endpoint}/topics/#{topic_id}/favorite"
|
48
|
-
req.params[:access_token] = token || access_token
|
58
|
+
req.params[:access_token] = options[:token] || access_token
|
49
59
|
end
|
50
60
|
parse_response(response)
|
51
61
|
end
|
data/lib/typetalk/api/user.rb
CHANGED
@@ -3,10 +3,12 @@ module Typetalk
|
|
3
3
|
|
4
4
|
module User
|
5
5
|
|
6
|
-
def get_profile(
|
6
|
+
def get_profile(options={})
|
7
|
+
options = {token:nil}.merge(options)
|
8
|
+
|
7
9
|
response = connection.get do |req|
|
8
10
|
req.url "#{endpoint}/profile"
|
9
|
-
req.params[:access_token] = token || access_token
|
11
|
+
req.params[:access_token] = options[:token] || access_token
|
10
12
|
end
|
11
13
|
parse_response(response)
|
12
14
|
end
|
data/lib/typetalk/connection.rb
CHANGED
@@ -16,9 +16,11 @@ module Typetalk
|
|
16
16
|
}
|
17
17
|
end
|
18
18
|
|
19
|
-
def connection(
|
19
|
+
def connection(options={})
|
20
|
+
options = {multipart:nil}.merge(options)
|
21
|
+
|
20
22
|
Faraday.new(connection_options) do |conn|
|
21
|
-
conn.request :multipart if multipart
|
23
|
+
conn.request :multipart if options[:multipart]
|
22
24
|
conn.use Faraday::Request::UrlEncoded
|
23
25
|
conn.use Faraday::Adapter::NetHttp
|
24
26
|
# conn.use Faraday::Response::ParseJson
|
data/lib/typetalk/version.rb
CHANGED
@@ -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, 29 May 2014 04:42:34 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, 29 May 2014 04:42:34 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, 29 May 2014 05:05:58 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, 29 May 2014 05:05:59 GMT
|
40
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,77 @@
|
|
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, 29 May 2014 05:12:37 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, 29 May 2014 05:12:38 GMT
|
40
|
+
- request:
|
41
|
+
method: post
|
42
|
+
uri: https://typetalk.in/oauth2/access_token
|
43
|
+
body:
|
44
|
+
encoding: UTF-8
|
45
|
+
string: client_id=(CLIENT_ID)&client_secret=(CLIENT_SECRET)&grant_type=refresh_token&refresh_token=(REFRESH_TOKEN)
|
46
|
+
headers:
|
47
|
+
Accept:
|
48
|
+
- application/json; charset=utf-8
|
49
|
+
User-Agent:
|
50
|
+
- Typetalk Rubygem 0.0.1
|
51
|
+
Content-Type:
|
52
|
+
- application/x-www-form-urlencoded
|
53
|
+
Accept-Encoding:
|
54
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
55
|
+
response:
|
56
|
+
status:
|
57
|
+
code: 200
|
58
|
+
message: OK
|
59
|
+
headers:
|
60
|
+
Server:
|
61
|
+
- nginx
|
62
|
+
Date:
|
63
|
+
- Thu, 29 May 2014 05:12:38 GMT
|
64
|
+
Content-Type:
|
65
|
+
- application/json; charset=utf-8
|
66
|
+
Transfer-Encoding:
|
67
|
+
- chunked
|
68
|
+
Connection:
|
69
|
+
- keep-alive
|
70
|
+
Strict-Transport-Security:
|
71
|
+
- max-age=2592000
|
72
|
+
body:
|
73
|
+
encoding: UTF-8
|
74
|
+
string: '{"access_token":"(UPDATED_ACCESS_TOKEN)","expires_in":3600,"scope":"topic.read,topic.post,my","refresh_token":"(REFRESH_TOKEN)","token_type":"Bearer"}'
|
75
|
+
http_version:
|
76
|
+
recorded_at: Thu, 29 May 2014 05:12:38 GMT
|
77
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,77 @@
|
|
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, 29 May 2014 05:11:57 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, 29 May 2014 05:11:57 GMT
|
40
|
+
- request:
|
41
|
+
method: post
|
42
|
+
uri: https://typetalk.in/oauth2/access_token
|
43
|
+
body:
|
44
|
+
encoding: UTF-8
|
45
|
+
string: client_id=(CLIENT_ID)&client_secret=(CLIENT_SECRET)&grant_type=refresh_token&refresh_token=(REFRESH_TOKEN)
|
46
|
+
headers:
|
47
|
+
Accept:
|
48
|
+
- application/json; charset=utf-8
|
49
|
+
User-Agent:
|
50
|
+
- Typetalk Rubygem 0.0.1
|
51
|
+
Content-Type:
|
52
|
+
- application/x-www-form-urlencoded
|
53
|
+
Accept-Encoding:
|
54
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
55
|
+
response:
|
56
|
+
status:
|
57
|
+
code: 200
|
58
|
+
message: OK
|
59
|
+
headers:
|
60
|
+
Server:
|
61
|
+
- nginx
|
62
|
+
Date:
|
63
|
+
- Thu, 29 May 2014 05:11:58 GMT
|
64
|
+
Content-Type:
|
65
|
+
- application/json; charset=utf-8
|
66
|
+
Transfer-Encoding:
|
67
|
+
- chunked
|
68
|
+
Connection:
|
69
|
+
- keep-alive
|
70
|
+
Strict-Transport-Security:
|
71
|
+
- max-age=2592000
|
72
|
+
body:
|
73
|
+
encoding: UTF-8
|
74
|
+
string: '{"access_token":"(ACCESS_TOKEN)","expires_in":3600,"scope":"topic.read,topic.post,my","refresh_token":"(REFRESH_TOKEN)","token_type":"Bearer"}'
|
75
|
+
http_version:
|
76
|
+
recorded_at: Thu, 29 May 2014 05:11:58 GMT
|
77
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,77 @@
|
|
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, 29 May 2014 04:12: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, 29 May 2014 04:12:51 GMT
|
40
|
+
- request:
|
41
|
+
method: post
|
42
|
+
uri: https://typetalk.in/oauth2/access_token
|
43
|
+
body:
|
44
|
+
encoding: UTF-8
|
45
|
+
string: client_id=(CLIENT_ID)&client_secret=(CLIENT_SECRET)&grant_type=refresh_token&refresh_token=dummy_token
|
46
|
+
headers:
|
47
|
+
Accept:
|
48
|
+
- application/json; charset=utf-8
|
49
|
+
User-Agent:
|
50
|
+
- Typetalk Rubygem 0.0.1
|
51
|
+
Content-Type:
|
52
|
+
- application/x-www-form-urlencoded
|
53
|
+
Accept-Encoding:
|
54
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
55
|
+
response:
|
56
|
+
status:
|
57
|
+
code: 401
|
58
|
+
message: Unauthorized
|
59
|
+
headers:
|
60
|
+
Server:
|
61
|
+
- nginx
|
62
|
+
Date:
|
63
|
+
- Thu, 29 May 2014 04:12:52 GMT
|
64
|
+
Content-Type:
|
65
|
+
- application/json; charset=utf-8
|
66
|
+
Content-Length:
|
67
|
+
- '56'
|
68
|
+
Connection:
|
69
|
+
- keep-alive
|
70
|
+
Www-Authenticate:
|
71
|
+
- Bearer error="invalid_grant", error_description="NotFound"
|
72
|
+
body:
|
73
|
+
encoding: UTF-8
|
74
|
+
string: '{"error":"invalid_grant","error_description":"NotFound"}'
|
75
|
+
http_version:
|
76
|
+
recorded_at: Thu, 29 May 2014 04:12:52 GMT
|
77
|
+
recorded_with: VCR 2.9.0
|
data/spec/spec_helper.rb
CHANGED
@@ -16,6 +16,7 @@ VCR.configure do |c|
|
|
16
16
|
c.before_record do |i|
|
17
17
|
i.request.body.sub!(/(&?client_id=)[^&]+/, '\1(CLIENT_ID)')
|
18
18
|
i.request.body.sub!(/(&?client_secret=)[^&]+/, '\1(CLIENT_SECRET)')
|
19
|
+
i.request.body.sub!(/(&?refresh_token=)[^&]+/, '\1(REFRESH_TOKEN)')
|
19
20
|
i.request.uri.sub!(/((\?|&)?access_token=)[^&]+/, '\1(ACCESS_TOKEN)')
|
20
21
|
|
21
22
|
begin
|
@@ -55,6 +55,28 @@ describe Typetalk::Api::Auth do
|
|
55
55
|
|
56
56
|
|
57
57
|
|
58
|
+
describe '#update_access_token', :vcr do
|
59
|
+
it 'should get the correct resource by client_credentials' do
|
60
|
+
response = api.get_access_token
|
61
|
+
|
62
|
+
response = api.update_access_token(response.refresh_token)
|
63
|
+
expect(response).to be_a(Hashie::Mash)
|
64
|
+
expect(response.access_token).to eq('(ACCESS_TOKEN)')
|
65
|
+
expect(response.refresh_token).to eq('(REFRESH_TOKEN)')
|
66
|
+
expect(response.scope).to eq('topic.read,topic.post,my')
|
67
|
+
expect(response.token_type).to eq('Bearer')
|
68
|
+
expect(response.expires_in).to eq(3600)
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
it 'should raise error when refresh_token is wrong' do
|
73
|
+
response = api.get_access_token
|
74
|
+
expect{ api.update_access_token('dummy_token') }.to raise_error(Typetalk::InvalidRequest)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
|
58
80
|
describe '.authorize_url' do
|
59
81
|
before do
|
60
82
|
Typetalk.configure do |config|
|
@@ -33,8 +33,8 @@ describe Typetalk::Api::Message do
|
|
33
33
|
|
34
34
|
|
35
35
|
it 'should get the correct resource for attachments' do
|
36
|
-
attachment1 = api.upload_attachment(topic_id, File.join(
|
37
|
-
attachment2 = api.upload_attachment(topic_id, File.join(
|
36
|
+
attachment1 = api.upload_attachment(topic_id, File.join(File.dirname(__FILE__), '../../fixtures/attachments/logo_typetalk.jpg'))
|
37
|
+
attachment2 = api.upload_attachment(topic_id, File.join(File.dirname(__FILE__), '../../fixtures/attachments/logo_cacoo.jpg'))
|
38
38
|
response = api.post_message(topic_id, 'Test Message 2 - 4', file_keys:[attachment1.fileKey, attachment2.fileKey])
|
39
39
|
expect(response).to be_a(Hashie::Mash)
|
40
40
|
expect(response.post.message).to eq('Test Message 2 - 4')
|
@@ -71,7 +71,7 @@ describe Typetalk::Api::Message do
|
|
71
71
|
|
72
72
|
describe '#upload_attachment', :vcr do
|
73
73
|
it 'should get the correct resource' do
|
74
|
-
response = api.upload_attachment(topic_id, File.join(
|
74
|
+
response = api.upload_attachment(topic_id, File.join(File.dirname(__FILE__), '../../fixtures/attachments/logo_typetalk.jpg'))
|
75
75
|
expect(response).to be_a(Hashie::Mash)
|
76
76
|
expect(response.fileName).to eq('logo_typetalk.jpg')
|
77
77
|
expect(response.fileSize).to eq(7622)
|
@@ -80,12 +80,12 @@ describe Typetalk::Api::Message do
|
|
80
80
|
|
81
81
|
|
82
82
|
it 'should raise error when topic_id is wrong' do
|
83
|
-
expect{ api.upload_attachment('dummy', File.join(
|
83
|
+
expect{ api.upload_attachment('dummy', File.join(File.dirname(__FILE__), '../../fixtures/attachments/logo_typetalk.jpg')) }.to raise_error(Typetalk::InvalidRequest)
|
84
84
|
end
|
85
85
|
|
86
86
|
|
87
87
|
it 'should raise error when file size 10MB', vcr:false do
|
88
|
-
file = File.join(
|
88
|
+
file = File.join(File.dirname(__FILE__), '../../fixtures/attachments/10mb.txt')
|
89
89
|
File.write(file, 'a' * (10485760 + 1))
|
90
90
|
expect{ api.upload_attachment(topic_id, file) }.to raise_error(Typetalk::InvalidFileSize)
|
91
91
|
File.unlink(file)
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Typetalk::Api do
|
5
|
+
|
6
|
+
let(:api) { Typetalk::Api.new }
|
7
|
+
|
8
|
+
describe '#access_token', :vcr do
|
9
|
+
it 'should get access_token' do
|
10
|
+
expect(api.instance_variable_get(:@access_token)).to be_nil
|
11
|
+
|
12
|
+
response = api.access_token
|
13
|
+
expect(response).to eq('(ACCESS_TOKEN)')
|
14
|
+
|
15
|
+
expect(api.instance_variable_get(:@access_token).expire_time).to eq(Time.now.to_i + 3600)
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
it 'should not update access_token' do
|
20
|
+
expect(api.instance_variable_get(:@access_token)).to be_nil
|
21
|
+
|
22
|
+
response = api.access_token
|
23
|
+
expect(response).to eq('(ACCESS_TOKEN)')
|
24
|
+
|
25
|
+
response = api.access_token
|
26
|
+
expect(response).to eq('(ACCESS_TOKEN)')
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
it 'should update access_token when access_token is expired' do
|
31
|
+
expect(api.instance_variable_get(:@access_token)).to be_nil
|
32
|
+
|
33
|
+
response = api.access_token
|
34
|
+
expect(response).to eq('(ACCESS_TOKEN)')
|
35
|
+
|
36
|
+
at = api.instance_variable_get(:@access_token)
|
37
|
+
at.expire_time = Time.now.to_i # expired
|
38
|
+
api.instance_variable_set(:@access_token, at)
|
39
|
+
|
40
|
+
response = api.access_token
|
41
|
+
expect(response).to eq('(UPDATED_ACCESS_TOKEN)')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
data/typetalk.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["umakoz@gmail.com"]
|
11
11
|
spec.summary = %q{A Ruby wrapper for Typetalk}
|
12
12
|
spec.description = %q{A Ruby wrapper for Typetalk}
|
13
|
-
spec.homepage = "https://github.com/umakoz/typetalk"
|
13
|
+
spec.homepage = "https://github.com/umakoz/typetalk-rb"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.required_ruby_version = '>=
|
21
|
+
spec.required_ruby_version = '>= 1.9.3'
|
22
22
|
|
23
23
|
spec.add_dependency "hashie"
|
24
24
|
spec.add_dependency "faraday"
|
metadata
CHANGED
@@ -1,60 +1,68 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typetalk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- umakoz
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
12
|
+
date: 2014-05-29 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: hashie
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- - '>='
|
19
|
+
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: '0'
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
|
-
- - '>='
|
27
|
+
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '0'
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: faraday
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
|
-
- - '>='
|
35
|
+
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
33
37
|
version: '0'
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
|
-
- - '>='
|
43
|
+
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: '0'
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: mime-types
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
|
-
- - '>='
|
51
|
+
- - ! '>='
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: '0'
|
48
54
|
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
|
-
- - '>='
|
59
|
+
- - ! '>='
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: '0'
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: bundler
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
67
|
- - ~>
|
60
68
|
- !ruby/object:Gem::Version
|
@@ -62,6 +70,7 @@ dependencies:
|
|
62
70
|
type: :development
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
75
|
- - ~>
|
67
76
|
- !ruby/object:Gem::Version
|
@@ -69,71 +78,81 @@ dependencies:
|
|
69
78
|
- !ruby/object:Gem::Dependency
|
70
79
|
name: rake
|
71
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
72
82
|
requirements:
|
73
|
-
- - '>='
|
83
|
+
- - ! '>='
|
74
84
|
- !ruby/object:Gem::Version
|
75
85
|
version: '0'
|
76
86
|
type: :development
|
77
87
|
prerelease: false
|
78
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
79
90
|
requirements:
|
80
|
-
- - '>='
|
91
|
+
- - ! '>='
|
81
92
|
- !ruby/object:Gem::Version
|
82
93
|
version: '0'
|
83
94
|
- !ruby/object:Gem::Dependency
|
84
95
|
name: rspec
|
85
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
86
98
|
requirements:
|
87
|
-
- - '>='
|
99
|
+
- - ! '>='
|
88
100
|
- !ruby/object:Gem::Version
|
89
101
|
version: '0'
|
90
102
|
type: :development
|
91
103
|
prerelease: false
|
92
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
93
106
|
requirements:
|
94
|
-
- - '>='
|
107
|
+
- - ! '>='
|
95
108
|
- !ruby/object:Gem::Version
|
96
109
|
version: '0'
|
97
110
|
- !ruby/object:Gem::Dependency
|
98
111
|
name: webmock
|
99
112
|
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
100
114
|
requirements:
|
101
|
-
- - '>='
|
115
|
+
- - ! '>='
|
102
116
|
- !ruby/object:Gem::Version
|
103
117
|
version: '0'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
107
122
|
requirements:
|
108
|
-
- - '>='
|
123
|
+
- - ! '>='
|
109
124
|
- !ruby/object:Gem::Version
|
110
125
|
version: '0'
|
111
126
|
- !ruby/object:Gem::Dependency
|
112
127
|
name: vcr
|
113
128
|
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
114
130
|
requirements:
|
115
|
-
- - '>='
|
131
|
+
- - ! '>='
|
116
132
|
- !ruby/object:Gem::Version
|
117
133
|
version: '0'
|
118
134
|
type: :development
|
119
135
|
prerelease: false
|
120
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
121
138
|
requirements:
|
122
|
-
- - '>='
|
139
|
+
- - ! '>='
|
123
140
|
- !ruby/object:Gem::Version
|
124
141
|
version: '0'
|
125
142
|
- !ruby/object:Gem::Dependency
|
126
143
|
name: awesome_print
|
127
144
|
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
128
146
|
requirements:
|
129
|
-
- - '>='
|
147
|
+
- - ! '>='
|
130
148
|
- !ruby/object:Gem::Version
|
131
149
|
version: '0'
|
132
150
|
type: :development
|
133
151
|
prerelease: false
|
134
152
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
135
154
|
requirements:
|
136
|
-
- - '>='
|
155
|
+
- - ! '>='
|
137
156
|
- !ruby/object:Gem::Version
|
138
157
|
version: '0'
|
139
158
|
description: A Ruby wrapper for Typetalk
|
@@ -145,6 +164,7 @@ extra_rdoc_files: []
|
|
145
164
|
files:
|
146
165
|
- .gitignore
|
147
166
|
- .rspec
|
167
|
+
- .travis.yml
|
148
168
|
- Gemfile
|
149
169
|
- LICENSE.txt
|
150
170
|
- README.md
|
@@ -160,6 +180,9 @@ files:
|
|
160
180
|
- lib/typetalk/connection.rb
|
161
181
|
- lib/typetalk/error.rb
|
162
182
|
- lib/typetalk/version.rb
|
183
|
+
- spec/cassettes/Typetalk_Api/_access_token/should_get_access_token.yml
|
184
|
+
- spec/cassettes/Typetalk_Api/_access_token/should_not_update_access_token.yml
|
185
|
+
- spec/cassettes/Typetalk_Api/_access_token/should_update_access_token_when_access_token_is_expired.yml
|
163
186
|
- spec/cassettes/Typetalk_Api_Auth/_get_access_token/should_get_the_correct_resource_by_authorization_code.yml
|
164
187
|
- spec/cassettes/Typetalk_Api_Auth/_get_access_token/should_get_the_correct_resource_by_client_credentials.yml
|
165
188
|
- spec/cassettes/Typetalk_Api_Auth/_get_access_token/should_get_the_correct_resource_by_client_credentials_when_scope_changed.yml
|
@@ -167,6 +190,8 @@ files:
|
|
167
190
|
- spec/cassettes/Typetalk_Api_Auth/_get_access_token/should_raise_error_when_client_id_is_wrong.yml
|
168
191
|
- spec/cassettes/Typetalk_Api_Auth/_get_access_token/should_raise_error_when_client_secret_is_wrong.yml
|
169
192
|
- spec/cassettes/Typetalk_Api_Auth/_get_access_token/should_raise_error_when_redirect_uri_mismatch.yml
|
193
|
+
- spec/cassettes/Typetalk_Api_Auth/_update_access_token/should_get_the_correct_resource_by_client_credentials.yml
|
194
|
+
- spec/cassettes/Typetalk_Api_Auth/_update_access_token/should_raise_error_when_refresh_token_is_wrong.yml
|
170
195
|
- spec/cassettes/Typetalk_Api_Mention/_get_mentions/should_get_the_correct_resource.yml
|
171
196
|
- spec/cassettes/Typetalk_Api_Mention/_get_mentions/should_get_the_correct_resource_till_mention.yml
|
172
197
|
- spec/cassettes/Typetalk_Api_Mention/_get_mentions/should_get_the_unread_resource.yml
|
@@ -229,32 +254,40 @@ files:
|
|
229
254
|
- spec/typetalk/api/notification_spec.rb
|
230
255
|
- spec/typetalk/api/topic_spec.rb
|
231
256
|
- spec/typetalk/api/user_spec.rb
|
257
|
+
- spec/typetalk/api_spec.rb
|
232
258
|
- typetalk.gemspec
|
233
|
-
homepage: https://github.com/umakoz/typetalk
|
259
|
+
homepage: https://github.com/umakoz/typetalk-rb
|
234
260
|
licenses:
|
235
261
|
- MIT
|
236
|
-
metadata: {}
|
237
262
|
post_install_message:
|
238
263
|
rdoc_options: []
|
239
264
|
require_paths:
|
240
265
|
- lib
|
241
266
|
required_ruby_version: !ruby/object:Gem::Requirement
|
267
|
+
none: false
|
242
268
|
requirements:
|
243
|
-
- - '>='
|
269
|
+
- - ! '>='
|
244
270
|
- !ruby/object:Gem::Version
|
245
|
-
version:
|
271
|
+
version: 1.9.3
|
246
272
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
273
|
+
none: false
|
247
274
|
requirements:
|
248
|
-
- - '>='
|
275
|
+
- - ! '>='
|
249
276
|
- !ruby/object:Gem::Version
|
250
277
|
version: '0'
|
278
|
+
segments:
|
279
|
+
- 0
|
280
|
+
hash: 930648927955685077
|
251
281
|
requirements: []
|
252
282
|
rubyforge_project:
|
253
|
-
rubygems_version:
|
283
|
+
rubygems_version: 1.8.23
|
254
284
|
signing_key:
|
255
|
-
specification_version:
|
285
|
+
specification_version: 3
|
256
286
|
summary: A Ruby wrapper for Typetalk
|
257
287
|
test_files:
|
288
|
+
- spec/cassettes/Typetalk_Api/_access_token/should_get_access_token.yml
|
289
|
+
- spec/cassettes/Typetalk_Api/_access_token/should_not_update_access_token.yml
|
290
|
+
- spec/cassettes/Typetalk_Api/_access_token/should_update_access_token_when_access_token_is_expired.yml
|
258
291
|
- spec/cassettes/Typetalk_Api_Auth/_get_access_token/should_get_the_correct_resource_by_authorization_code.yml
|
259
292
|
- spec/cassettes/Typetalk_Api_Auth/_get_access_token/should_get_the_correct_resource_by_client_credentials.yml
|
260
293
|
- spec/cassettes/Typetalk_Api_Auth/_get_access_token/should_get_the_correct_resource_by_client_credentials_when_scope_changed.yml
|
@@ -262,6 +295,8 @@ test_files:
|
|
262
295
|
- spec/cassettes/Typetalk_Api_Auth/_get_access_token/should_raise_error_when_client_id_is_wrong.yml
|
263
296
|
- spec/cassettes/Typetalk_Api_Auth/_get_access_token/should_raise_error_when_client_secret_is_wrong.yml
|
264
297
|
- spec/cassettes/Typetalk_Api_Auth/_get_access_token/should_raise_error_when_redirect_uri_mismatch.yml
|
298
|
+
- spec/cassettes/Typetalk_Api_Auth/_update_access_token/should_get_the_correct_resource_by_client_credentials.yml
|
299
|
+
- spec/cassettes/Typetalk_Api_Auth/_update_access_token/should_raise_error_when_refresh_token_is_wrong.yml
|
265
300
|
- spec/cassettes/Typetalk_Api_Mention/_get_mentions/should_get_the_correct_resource.yml
|
266
301
|
- spec/cassettes/Typetalk_Api_Mention/_get_mentions/should_get_the_correct_resource_till_mention.yml
|
267
302
|
- spec/cassettes/Typetalk_Api_Mention/_get_mentions/should_get_the_unread_resource.yml
|
@@ -324,3 +359,4 @@ test_files:
|
|
324
359
|
- spec/typetalk/api/notification_spec.rb
|
325
360
|
- spec/typetalk/api/topic_spec.rb
|
326
361
|
- spec/typetalk/api/user_spec.rb
|
362
|
+
- spec/typetalk/api_spec.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: c8abe69ef420d358276adc435f463c3bcdbb1d17
|
4
|
-
data.tar.gz: cf7b032089f7482505217065765e9b7614e37859
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 286c0578f142feff79ed45b1f1757e4bc15591301feba0dc4cfe116431e1f8f73efdb52bb10538966c858d24a9f024dbeda0a5bb1ac8943a6b1e282021b13cc8
|
7
|
-
data.tar.gz: 6576852ef676d8745a7a9a3010040c3e5ee73f00830999f3692170275fd98caab156b902f396635a29271bc166832615e1feead36b9e11814668eacf484a0104
|