contextio 1.0.1 → 1.1.0

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/CHANGES.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changes
2
2
 
3
+ ## 1.1.0
4
+
5
+ * Allow passing options to `OAuth` through the gem. Notably, `:timeout` and
6
+ `:open_timeout`. - Geoff Longman
7
+
3
8
  ## 1.0.1
4
9
 
5
10
  * Updated homepage link in README distributed with the gem. - Ben Hamill
data/lib/contextio/api.rb CHANGED
@@ -56,13 +56,17 @@ class ContextIO
56
56
  # @return [String] The OAuth key for the user's Context.IO account.
57
57
  # @!attribute [r] secret
58
58
  # @return [String] The OAuth secret for the user's Context.IO account.
59
- attr_reader :key, :secret
59
+ # @!attribute [r] opts
60
+ # @return [Hash] opts Optional options for OAuth connections.
61
+ attr_reader :key, :secret, :opts
60
62
 
61
63
  # @param [String] key The user's OAuth key for their Context.IO account.
62
64
  # @param [String] secret The user's OAuth secret for their Context.IO account.
63
- def initialize(key, secret)
65
+ # @param [Hash] opts Optional options for OAuth connections. ie. :timeout and :open_timeout are supported
66
+ def initialize(key, secret, opts={})
64
67
  @key = key
65
68
  @secret = secret
69
+ @opts = opts || {}
66
70
  end
67
71
 
68
72
  # Generates the path for a resource_path and params hash for use with the API.
@@ -149,7 +153,7 @@ class ContextIO
149
153
  # @return [OAuth::Consumer] An Oauth consumer object for credentials
150
154
  # purposes.
151
155
  def consumer
152
- @consumer ||= OAuth::Consumer.new(key, secret, site: API.base_url)
156
+ @consumer ||= OAuth::Consumer.new(key, secret, @opts.merge(site: API.base_url))
153
157
  end
154
158
 
155
159
  # @!attribute [r] token
@@ -1,6 +1,6 @@
1
1
  class ContextIO
2
2
  # @private
3
- VERSION = "1.0.1"
3
+ VERSION = "1.1.0"
4
4
 
5
5
  # The gem version.
6
6
  #
data/lib/contextio.rb CHANGED
@@ -17,8 +17,9 @@ class ContextIO
17
17
  # @param [String] key Your OAuth consumer key for your Context.IO account
18
18
  # @param [String] secret Your OAuth consumer secret for your Context.IO
19
19
  # account
20
- def initialize(key, secret)
21
- @api = API.new(key, secret)
20
+ # @param [Hash] opts Optional options for OAuth connections. ie. :timeout and :open_timeout are supported
21
+ def initialize(key, secret, opts={})
22
+ @api = API.new(key, secret, opts)
22
23
  end
23
24
 
24
25
  # Your entry point for dealing with oauth providers.
@@ -19,7 +19,7 @@ describe ContextIO::API do
19
19
  end
20
20
 
21
21
  describe ".new" do
22
- subject { ContextIO::API.new('test_key', 'test_secret') }
22
+ subject { ContextIO::API.new('test_key', 'test_secret', {a:'b'}) }
23
23
 
24
24
  it "takes a key" do
25
25
  expect(subject.key).to eq('test_key')
@@ -28,6 +28,10 @@ describe ContextIO::API do
28
28
  it "takes a secret" do
29
29
  expect(subject.secret).to eq('test_secret')
30
30
  end
31
+
32
+ it "takes an option hash" do
33
+ expect(subject.opts).to eq(a:'b')
34
+ end
31
35
  end
32
36
 
33
37
  describe "#path" do
@@ -14,6 +14,11 @@ describe ContextIO do
14
14
  expect(api.key).to eq('1234')
15
15
  expect(api.secret).to eq('0987')
16
16
  end
17
+
18
+ it "passes opts to its API handle" do
19
+ api = ContextIO.new('1234', '0987', {a:'b'}).api
20
+ expect(api.opts).to eq(a:'b')
21
+ end
17
22
  end
18
23
 
19
24
  describe "#oauth_providers" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contextio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-24 00:00:00.000000000 Z
12
+ date: 2013-01-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth
@@ -167,7 +167,6 @@ files:
167
167
  - .rspec
168
168
  - .yardopts
169
169
  - CHANGES.md
170
- - ChangeLog.md
171
170
  - Gemfile
172
171
  - LICENSE.md
173
172
  - README.md
data/ChangeLog.md DELETED
@@ -1,5 +0,0 @@
1
- # Changes
2
-
3
- ## 0.5.0 / 2012-08-18
4
-
5
- * Major Refactor of all code.