contextio 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.md +5 -0
- data/lib/contextio/api.rb +7 -3
- data/lib/contextio/version.rb +1 -1
- data/lib/contextio.rb +3 -2
- data/spec/contextio/api_spec.rb +5 -1
- data/spec/contextio_spec.rb +5 -0
- metadata +2 -3
- data/ChangeLog.md +0 -5
data/CHANGES.md
CHANGED
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
|
-
|
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
|
-
|
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
|
data/lib/contextio/version.rb
CHANGED
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
|
-
|
21
|
-
|
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.
|
data/spec/contextio/api_spec.rb
CHANGED
@@ -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
|
data/spec/contextio_spec.rb
CHANGED
@@ -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
|
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:
|
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
|