yammer-client 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,8 @@
1
+ 0.1.7
2
+ ====================================
3
+ - Fixed a bug where by access token go cached and was cleared when config changed
4
+ - Updated README
5
+
1
6
  0.1.4
2
7
  ====================================
3
8
  - Added support for invitations
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yammer-client (0.1.6)
4
+ yammer-client (0.1.7)
5
5
  addressable (~> 2.3.3)
6
6
  multi_json (~> 1.3)
7
7
  oj (~> 2.0.10)
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(:body => 'status update')
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(:body => 'private message', :direct_to_id => 24)
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(:body => 'here is my open graph object', og_url: "https://www.yammer.com/example/graph/31415926")
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
 
@@ -19,6 +19,10 @@ module Yammer
19
19
  include Configurable
20
20
  include ApiHandler
21
21
 
22
+ def to_s
23
+ "<#{self.name}: #{self.options.inspect}>"
24
+ end
25
+
22
26
  private
23
27
  def method_missing(method_name, *args, &block)
24
28
  return super unless api_handler.respond_to?(method_name)
@@ -1,15 +1,13 @@
1
1
  module Yammer
2
2
  module ApiHandler
3
+
3
4
  def api_handler
4
- @api_handler ||= establish_api_handler
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
@@ -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, :headers, :connection_options
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
- @headers['Authorization'] ||= "Bearer #{@access_token}"
78
+ headers = @default_headers.merge({'Authorization' => "Bearer #{@access_token}"})
79
79
  result = http_client.send_request(method, path, {
80
- :params => params,
81
- :headers => @headers
80
+ :params => params,
81
+ :headers => headers
82
82
  })
83
83
  result
84
84
  end
@@ -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, :headers, :http_adapter
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
- :headers => {
22
+ :default_headers => {
23
23
  'Accept' => 'application/json',
24
24
  'User-Agent' => "Yammer Ruby Gem #{Yammer::Version}"
25
25
  }
@@ -2,7 +2,7 @@ module Yammer
2
2
  class Version
3
3
  MAJOR = 0 unless defined? Yammer::MAJOR
4
4
  MINOR = 1 unless defined? Yammer::MINOR
5
- PATCH = 6 unless defined? Yammer::PATCH
5
+ PATCH = 7 unless defined? Yammer::PATCH
6
6
  PRE = nil unless defined? Yammer::PRE
7
7
 
8
8
  class << self
@@ -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
- :headers => {"Accept"=>"application/json", "User-Agent"=>"Yammer Ruby Gem #{Yammer::Version}"}
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 => nil,
33
- :client_id => nil,
34
- :client_secret => nil,
35
- :access_token => nil,
36
- :headers => {"Accept"=>"application/json", "User-Agent"=>"Yammer Ruby Gem #{Yammer::Version}"},
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
- :headers => {"Accept"=>"application/json", "User-Agent"=>"Yammer Ruby Gem 0.1.1"},
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.headers)
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.headers)
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 => {
@@ -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-05-28}
10
- s.summary = "Yammer API Client - beta"
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.6
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-05-28 00:00:00.000000000 Z
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 - beta
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