yam 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +6 -6
- data/lib/yammer/oauth2_client.rb +23 -10
- data/lib/yammer/version.rb +1 -1
- data/spec/oauth2_client_spec.rb +4 -4
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa809413d7a9291efe4669d094af8662f6fc9892
|
4
|
+
data.tar.gz: c9fb753cce0165376014d48147e853ea409775c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4086614c5f23ada408f3d80e8cbf754879bcf5bad3c0e0063b38b78fc372eeb07448006135faaddda4bbf8ab86030cade2ae3029f4116269c6c66602303cbdcb
|
7
|
+
data.tar.gz: 8b4c69ad3ee8b4f399e1abe86a9eadd455a5b11874b082df3b096b7fd3ab618c42ccf68954b4aef1fd1dd0d5106be34186f37ecad2a57a3513432a15976651be
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -53,7 +53,7 @@ Setup a Yammer client application as described on the [Yammer Developer site](ht
|
|
53
53
|
|
54
54
|
|
55
55
|
```ruby
|
56
|
-
GET https://www.yammer.com/
|
56
|
+
GET https://www.yammer.com/oauth2/authorize?client_id=[:client_id]&response_type=code
|
57
57
|
```
|
58
58
|
|
59
59
|
2. Have your users follow the URL you constructed above to allow your application to access their data
|
@@ -89,9 +89,9 @@ This gem comes bundled with an OAuth2 wrapper that makes provides convenience me
|
|
89
89
|
|
90
90
|
```ruby
|
91
91
|
|
92
|
-
require 'yammer
|
92
|
+
require 'yammer'
|
93
93
|
|
94
|
-
yammer_client =
|
94
|
+
yammer_client = Yammer::OAuth2Client.new('PRbTcg9qjgKsp4jjpm1pw', 'Xn7kp7Ly0TCY4GtZWkmSsqGEPg10DmMADyjWkf2U')
|
95
95
|
|
96
96
|
```
|
97
97
|
|
@@ -105,7 +105,7 @@ file. The supported grants include Authorization Code and Implicit. They are ava
|
|
105
105
|
|
106
106
|
# generate authorization url
|
107
107
|
auth_url = yammer_client.webserver_authorization_url
|
108
|
-
# => https://www.yammer.com/
|
108
|
+
# => https://www.yammer.com/oauth2/authorize?client_id=PRbTcg9qjgKsp4jjpm1pw&response_type=code
|
109
109
|
|
110
110
|
# exchange authorization code for access token. we will get back a Net::HTTPResponse
|
111
111
|
response = yammer_client.access_token_from_authorization_code('11a0b0b64db56c30e2ef', { :redirect_uri => 'https://localhost/callback'})
|
@@ -124,8 +124,8 @@ response.body
|
|
124
124
|
|
125
125
|
#### Implicit Grant (Client-side authorization)
|
126
126
|
```ruby
|
127
|
-
authorization_url = yammer_client.
|
128
|
-
# => "https://www.yammer.com/
|
127
|
+
authorization_url = yammer_client.webclient_authorization_url(:redirect_uri => 'http://localhost/oauth2/callback')
|
128
|
+
# => "https://www.yammer.com/oauth2/authorize/?client_id=PRbTcg9qjgKsp4jjpm1pw&redirect_uri=http%3A%2F%2Flocalhost%2Foauth%2Fcallback&response_type=token"
|
129
129
|
```
|
130
130
|
|
131
131
|
## Configuring yammer-client
|
data/lib/yammer/oauth2_client.rb
CHANGED
@@ -18,8 +18,8 @@ module Yammer
|
|
18
18
|
class OAuth2Client < OAuth2Client::Client
|
19
19
|
|
20
20
|
SITE_URL = 'https://www.yammer.com'
|
21
|
-
TOKEN_PATH = '/oauth2/
|
22
|
-
AUTHORIZE_PATH = '/
|
21
|
+
TOKEN_PATH = '/oauth2/access_token'
|
22
|
+
AUTHORIZE_PATH = '/oauth2/authorize'
|
23
23
|
|
24
24
|
def initialize(client_id, client_secret, opts={})
|
25
25
|
site_url = opts.delete(:site_url) || SITE_URL
|
@@ -37,11 +37,11 @@ module Yammer
|
|
37
37
|
#
|
38
38
|
# @opts [Hash] additional parameters to be include in URL eg. scope, state, etc
|
39
39
|
#
|
40
|
-
# client =
|
41
|
-
# client.
|
40
|
+
# >> client = Yammer::OAuth2Client.new('ETSIGVSxmgZitijWZr0G6w', '4bJZY38TCBB9q8IpkeualA2lZsPhOSclkkSKw3RXuE')
|
41
|
+
# >> client.webclient_authorization_url({
|
42
42
|
# :redirect_uri => 'https://localhost/oauth/cb',
|
43
43
|
# })
|
44
|
-
# >> https://www.yammer.com/
|
44
|
+
# >> https://www.yammer.com/oauth2/authorize/?client_id={client_id}&
|
45
45
|
# redirect_uri=http%3A%2F%2Flocalhost%2Foauth%2Fcb&response_type=token
|
46
46
|
#
|
47
47
|
def webclient_authorization_url(opts={})
|
@@ -55,11 +55,11 @@ module Yammer
|
|
55
55
|
#
|
56
56
|
# @opts [Hash] additional parameters to be include in URL eg. scope, state, etc
|
57
57
|
#
|
58
|
-
# >> client =
|
58
|
+
# >> client = Yammer::OAuth2Client.new('ETSIGVSxmgZitijWZr0G6w', '4bJZY38TCBB9q8IpkeualA2lZsPhOSclkkSKw3RXuE')
|
59
59
|
# >> client.webserver_authorization_url({
|
60
60
|
# :redirect_uri => 'https://localhost/oauth/cb',
|
61
61
|
# })
|
62
|
-
# >> https://www.yammer.com/
|
62
|
+
# >> https://www.yammer.com/oauth2/authorize/?client_id={client_id}&
|
63
63
|
# redirect_uri=http%3A%2F%2Flocalhost%2Foauth%2Fcb&response_type=code
|
64
64
|
#
|
65
65
|
def webserver_authorization_url(opts={})
|
@@ -75,9 +75,8 @@ module Yammer
|
|
75
75
|
# @opts [Hash] may include redirect uri and other query parameters
|
76
76
|
#
|
77
77
|
# >> client = YammerClient.new(config)
|
78
|
-
# >> client.
|
78
|
+
# >> client.access_token_from_authorization_code('G3Y6jU3a', {
|
79
79
|
# :redirect_uri => 'https://localhost:3000/oauth/v2/callback',
|
80
|
-
# :code => 'G3Y6jU3a',
|
81
80
|
# })
|
82
81
|
#
|
83
82
|
# POST /oauth2/access_token HTTP/1.1
|
@@ -95,6 +94,12 @@ module Yammer
|
|
95
94
|
#
|
96
95
|
# @opts [Hash] parameters that will be added to URL query string
|
97
96
|
#
|
97
|
+
# >> client = Yammer::OAuth2Client.new('ETSIGVSxmgZitijWZr0G6w', '4bJZY38TCBB9q8IpkeualA2lZsPhOSclkkSKw3RXuE')
|
98
|
+
# >> client.access_token_from_client_credentials({
|
99
|
+
# :client_id => "ZitijWZr0",
|
100
|
+
# :client_secret => "F8TCBB9q8IpkeualA2lZsPhOSc"
|
101
|
+
# })
|
102
|
+
#
|
98
103
|
# POST /oauth2/access_token HTTP/1.1
|
99
104
|
# Host: www.yammer.com
|
100
105
|
# Content-Type: application/x-www-form-urlencoded
|
@@ -109,6 +114,14 @@ module Yammer
|
|
109
114
|
#
|
110
115
|
# @opts [Hash] parameters that will be added to URL query string
|
111
116
|
#
|
117
|
+
# >> client = Yammer::OAuth2Client.new('ETSIGVSxmgZitijWZr0G6w', '4bJZY38TCBB9q8IpkeualA2lZsPhOSclkkSKw3RXuE')
|
118
|
+
# >> client.access_token_from_client_credentials({
|
119
|
+
# :client_id => "ZitijWZr0",
|
120
|
+
# :client_secret => "F8TCBB9q8IpkeualA2lZsPhOSc",
|
121
|
+
# :email => "user@domain.com",
|
122
|
+
# :password => "abc123"
|
123
|
+
# })
|
124
|
+
#
|
112
125
|
# POST /oauth2/access_token HTTP/1.1
|
113
126
|
# Host: www.yammer.com
|
114
127
|
# Content-Type: application/x-www-form-urlencoded
|
@@ -119,4 +132,4 @@ module Yammer
|
|
119
132
|
self.password.get_token(username, password, opts)
|
120
133
|
end
|
121
134
|
end
|
122
|
-
end
|
135
|
+
end
|
data/lib/yammer/version.rb
CHANGED
data/spec/oauth2_client_spec.rb
CHANGED
@@ -48,7 +48,7 @@ describe Yammer::OAuth2Client do
|
|
48
48
|
)
|
49
49
|
|
50
50
|
parsed_url = Addressable::URI.parse(auth_url)
|
51
|
-
expect(parsed_url.path).to eq '/
|
51
|
+
expect(parsed_url.path).to eq '/oauth2/authorize'
|
52
52
|
expect(parsed_url.query_values).to eq params
|
53
53
|
expect(parsed_url.scheme).to eq 'https'
|
54
54
|
expect(parsed_url.host).to eq 'www.yammer.com'
|
@@ -58,7 +58,7 @@ describe Yammer::OAuth2Client do
|
|
58
58
|
describe "#access_token_from_authorization_code" do
|
59
59
|
it "makes a POST request to exchange authorization code for access token" do
|
60
60
|
|
61
|
-
stub_request(:post, "https://www.yammer.com/oauth2/
|
61
|
+
stub_request(:post, "https://www.yammer.com/oauth2/access_token").with(
|
62
62
|
:body => {
|
63
63
|
:grant_type => 'authorization_code',
|
64
64
|
:code => 'MmOGL795LbIZuJJVnL49Cc',
|
@@ -84,7 +84,7 @@ describe Yammer::OAuth2Client do
|
|
84
84
|
describe "#access_token_from_client_credentials" do
|
85
85
|
it "makes a POST request to exchange client credentiaks for access token" do
|
86
86
|
|
87
|
-
stub_request(:post, "https://www.yammer.com/oauth2/
|
87
|
+
stub_request(:post, "https://www.yammer.com/oauth2/access_token").with(
|
88
88
|
:body => {
|
89
89
|
:grant_type => 'client_credentials',
|
90
90
|
:client_id => 'PRbTcg9qjgKsp4jjpm1pw',
|
@@ -103,7 +103,7 @@ describe Yammer::OAuth2Client do
|
|
103
103
|
describe "#access_token_from_resource_owner_credentials" do
|
104
104
|
it "makes a POST request to exchange client credentiaks for access token" do
|
105
105
|
|
106
|
-
stub_request(:post, "https://www.yammer.com/oauth2/
|
106
|
+
stub_request(:post, "https://www.yammer.com/oauth2/access_token").with(
|
107
107
|
:body => {
|
108
108
|
:grant_type => 'password',
|
109
109
|
:username => 'thekev',
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Mutyaba
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
B+kZ9/4dAvmKkr2NPSoxBQtO7Rz0HDNLtjMxkXbQUWMDsGnB6Kk1WUBb/w3kQ9Ah
|
30
30
|
JgIHF4cG
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2014-02
|
32
|
+
date: 2014-04-02 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: oj
|
metadata.gz.sig
CHANGED
Binary file
|