yammer-client 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/README.md +3 -3
- data/lib/yammer.rb +4 -0
- data/lib/yammer/api_handler.rb +2 -4
- data/lib/yammer/client.rb +4 -4
- data/lib/yammer/configurable.rb +2 -2
- data/lib/yammer/version.rb +1 -1
- data/spec/client_spec.rb +9 -9
- data/yammer.gemspec +2 -2
- metadata +3 -3
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -158,21 +158,21 @@ yamr.current_user
|
|
158
158
|
*post a update as the current user*
|
159
159
|
|
160
160
|
```ruby
|
161
|
-
yamr.create_message(
|
161
|
+
yamr.create_message('status update')
|
162
162
|
#<Yammer::ApiResponse:0x007fb949434ec8 @headers=#<Net::HTTPOK 200 OK readbody=true>, @body="[JSON Response]", @code=200>
|
163
163
|
```
|
164
164
|
|
165
165
|
*send a private message to another Yammer user*
|
166
166
|
|
167
167
|
```ruby
|
168
|
-
yamr.create_message(
|
168
|
+
yamr.create_message('private message', :direct_to_id => 24)
|
169
169
|
#<Yammer::ApiResponse:0x007fb949434ec8 @headers=#<Net::HTTPOK 200 OK readbody=true>, @body="[JSON Response]", @code=200>
|
170
170
|
```
|
171
171
|
|
172
172
|
*send a message with an Open Graph Object as an attachment*
|
173
173
|
|
174
174
|
```ruby
|
175
|
-
yamr.create_message(
|
175
|
+
yamr.create_message('here is my open graph object', :og_url => "https://www.yammer.com/example/graph/31415926")
|
176
176
|
#<Yammer::ApiResponse:0x007fb949434ec8 @headers=#<Net::HTTPOK 200 OK readbody=true>, @body="[JSON Response]", @code=200>
|
177
177
|
```
|
178
178
|
|
data/lib/yammer.rb
CHANGED
data/lib/yammer/api_handler.rb
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
module Yammer
|
2
2
|
module ApiHandler
|
3
|
+
|
3
4
|
def api_handler
|
4
|
-
|
5
|
+
establish_api_handler
|
5
6
|
end
|
6
7
|
|
7
8
|
def establish_api_handler(opts={})
|
8
9
|
Yammer::Client.new(opts)
|
9
10
|
end
|
10
11
|
|
11
|
-
def reset_api_handler!
|
12
|
-
@api_handler = nil
|
13
|
-
end
|
14
12
|
end
|
15
13
|
end
|
data/lib/yammer/client.rb
CHANGED
@@ -22,7 +22,7 @@ module Yammer
|
|
22
22
|
include Yammer::Api::Subscription
|
23
23
|
include Yammer::Api::OpenGraphObject
|
24
24
|
|
25
|
-
attr_reader :site_url, :
|
25
|
+
attr_reader :site_url, :default_headers, :connection_options
|
26
26
|
|
27
27
|
attr_accessor :client_id, :client_secret, :access_token
|
28
28
|
|
@@ -75,10 +75,10 @@ module Yammer
|
|
75
75
|
# @return [Yammer::ApiResponse]
|
76
76
|
# @!visibility private
|
77
77
|
def request(method, path, params={})
|
78
|
-
@
|
78
|
+
headers = @default_headers.merge({'Authorization' => "Bearer #{@access_token}"})
|
79
79
|
result = http_client.send_request(method, path, {
|
80
|
-
:params
|
81
|
-
:headers =>
|
80
|
+
:params => params,
|
81
|
+
:headers => headers
|
82
82
|
})
|
83
83
|
result
|
84
84
|
end
|
data/lib/yammer/configurable.rb
CHANGED
@@ -7,7 +7,7 @@ module Yammer
|
|
7
7
|
HTTP_ADAPTER = Yammer::HttpAdapter unless defined? HTTP_CONNECTION
|
8
8
|
|
9
9
|
attr_accessor :client_id, :client_secret, :access_token, :site_url,
|
10
|
-
:connection_options, :
|
10
|
+
:connection_options, :default_headers, :http_adapter
|
11
11
|
|
12
12
|
# Return a hash with the default options
|
13
13
|
# @return [Hash]
|
@@ -19,7 +19,7 @@ module Yammer
|
|
19
19
|
:access_token => ENV['YAMMER_ACCESS_TOKEN'],
|
20
20
|
:http_adapter => HTTP_ADAPTER,
|
21
21
|
:connection_options => { :max_redirects => 5, :verify_ssl => true },
|
22
|
-
:
|
22
|
+
:default_headers => {
|
23
23
|
'Accept' => 'application/json',
|
24
24
|
'User-Agent' => "Yammer Ruby Gem #{Yammer::Version}"
|
25
25
|
}
|
data/lib/yammer/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -9,7 +9,7 @@ describe Yammer::Client do
|
|
9
9
|
:client_secret => 'Xn7kp7Ly0TCY4GtZWkmSsqGEPg10DmMADyjWkf2U',
|
10
10
|
:access_token => 'TolNOFka9Uls2DxahNi78A',
|
11
11
|
:connection_options => { :max_redirects => 5, :use_ssl => true },
|
12
|
-
:
|
12
|
+
:default_headers => {"Accept"=>"application/json", "User-Agent"=>"Yammer Ruby Gem #{Yammer::Version}"}
|
13
13
|
}
|
14
14
|
|
15
15
|
Yammer.configure do |config|
|
@@ -29,11 +29,11 @@ describe Yammer::Client do
|
|
29
29
|
|
30
30
|
before :each do
|
31
31
|
@default_conf = {
|
32
|
-
:site_url
|
33
|
-
:client_id
|
34
|
-
:client_secret
|
35
|
-
:access_token
|
36
|
-
:
|
32
|
+
:site_url => nil,
|
33
|
+
:client_id => nil,
|
34
|
+
:client_secret => nil,
|
35
|
+
:access_token => nil,
|
36
|
+
:default_headers => {"Accept"=>"application/json", "User-Agent"=>"Yammer Ruby Gem #{Yammer::Version}"},
|
37
37
|
:connection_options => {}
|
38
38
|
}
|
39
39
|
Yammer.configure do |config|
|
@@ -61,7 +61,7 @@ describe Yammer::Client do
|
|
61
61
|
:client_id => 'PRbTcg9qjgKsp4jjpm1pw',
|
62
62
|
:client_secret => 'Xn7kp7Ly0TCY4GtZWkmSsqGEPg10DmMADyjWkf2U',
|
63
63
|
:access_token => 'TolNOFka9Uls2DxahNi78A',
|
64
|
-
:
|
64
|
+
:default_headers => {"Accept"=>"application/json", "User-Agent"=>"Yammer Ruby Gem 0.1.1"},
|
65
65
|
:connection_options => { :max_redirects => 5, :use_ssl => true }
|
66
66
|
}
|
67
67
|
end
|
@@ -155,7 +155,7 @@ describe Yammer::Client do
|
|
155
155
|
path = '/users'
|
156
156
|
params = {:first_name => 'john', :last_name => 'smith'}
|
157
157
|
query = Addressable::URI.form_encode(params)
|
158
|
-
headers = {'Content-Type' => 'application/x-www-form-urlencoded' }.merge(subject.
|
158
|
+
headers = {'Content-Type' => 'application/x-www-form-urlencoded' }.merge(subject.default_headers)
|
159
159
|
|
160
160
|
stub_request(:post, "https://www.yammer.com/users").with(
|
161
161
|
:body => {
|
@@ -178,7 +178,7 @@ describe Yammer::Client do
|
|
178
178
|
path = '/users/1'
|
179
179
|
params = {:first_name => 'jane', :last_name => 'doe'}
|
180
180
|
query = Addressable::URI.form_encode(params)
|
181
|
-
headers = {'Content-Type' => 'application/x-www-form-urlencoded' }.merge(subject.
|
181
|
+
headers = {'Content-Type' => 'application/x-www-form-urlencoded' }.merge(subject.default_headers)
|
182
182
|
|
183
183
|
stub_request(:put, "https://www.yammer.com/users/1").with(
|
184
184
|
:body => {
|
data/yammer.gemspec
CHANGED
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = 'yammer-client'
|
7
7
|
s.version = Yammer::Version
|
8
8
|
|
9
|
-
s.date = %q{2013-
|
10
|
-
s.summary = "Yammer API Client
|
9
|
+
s.date = %q{2013-06-13}
|
10
|
+
s.summary = "Yammer API Client"
|
11
11
|
s.description = "A Ruby wrapper for accessing Yammer's REST API"
|
12
12
|
s.authors = ["Kevin Mutyaba"]
|
13
13
|
s.email = %q{tiabasnk@gmail.com}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yammer-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
TlNPdFE1OTMySERFb28wRjluWElNWkdRU0xxRVh6M2wKQitrWjkvNGRBdm1L
|
37
37
|
a3IyTlBTb3hCUXRPN1J6MEhETkx0ak14a1hiUVVXTURzR25CNktrMVdVQmIv
|
38
38
|
dzNrUTlBaApKZ0lIRjRjRwotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
|
39
|
-
date: 2013-
|
39
|
+
date: 2013-06-13 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: oj
|
@@ -280,7 +280,7 @@ rubyforge_project:
|
|
280
280
|
rubygems_version: 1.8.25
|
281
281
|
signing_key:
|
282
282
|
specification_version: 3
|
283
|
-
summary: Yammer API Client
|
283
|
+
summary: Yammer API Client
|
284
284
|
test_files:
|
285
285
|
- spec/api/autocomplete_spec.rb
|
286
286
|
- spec/api/group_membership_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|