givey_ruby 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/lib/givey_ruby/controller.rb +2 -0
- data/lib/givey_ruby/model.rb +2 -0
- data/lib/givey_ruby/version.rb +1 -1
- data/spec/givey_ruby/configuration_spec.rb +31 -0
- metadata +4 -2
data/.gitignore
CHANGED
@@ -32,6 +32,8 @@ module GiveyRuby
|
|
32
32
|
@access_token ||= begin
|
33
33
|
if session[:access_token]
|
34
34
|
api_token = OAuth2::AccessToken.new(api_client, session[:access_token])
|
35
|
+
elsif ENV['GIVEY_TOKEN']
|
36
|
+
api_token = OAuth2::AccessToken.new(api_client, ENV['GIVEY_TOKEN'])
|
35
37
|
elsif givey_token = token_from_file
|
36
38
|
api_token = OAuth2::AccessToken.new(api_client, givey_token)
|
37
39
|
else
|
data/lib/givey_ruby/model.rb
CHANGED
@@ -14,6 +14,8 @@ module GiveyRuby
|
|
14
14
|
@access_token ||= begin
|
15
15
|
if self.respond_to?(:givey_token) && self.givey_token
|
16
16
|
api_token = OAuth2::AccessToken.new(api_client, self.givey_token)
|
17
|
+
elsif ENV['GIVEY_TOKEN']
|
18
|
+
api_token = OAuth2::AccessToken.new(api_client, ENV['GIVEY_TOKEN'])
|
17
19
|
elsif givey_token = token_from_file
|
18
20
|
api_token = OAuth2::AccessToken.new(api_client, givey_token)
|
19
21
|
else
|
data/lib/givey_ruby/version.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GiveyRuby::Configuration do
|
4
|
+
|
5
|
+
describe "Client options" do
|
6
|
+
|
7
|
+
it "GiveyRuby configure should set OAuth2 client correctly" do
|
8
|
+
GiveyRuby.configure do |config|
|
9
|
+
config.client({api_site: "http://example.com"})
|
10
|
+
end
|
11
|
+
|
12
|
+
GiveyRuby.configuration.client.should be_kind_of(OAuth2::Client)
|
13
|
+
GiveyRuby.configuration.client.site.should == "http://example.com"
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "Session options" do
|
19
|
+
|
20
|
+
it "GiveyRuby configure should set OAuth2 client correctly" do
|
21
|
+
GiveyRuby.configure do |config|
|
22
|
+
config.client({api_site: "http://example.com"})
|
23
|
+
end
|
24
|
+
|
25
|
+
GiveyRuby.configuration.client.should be_kind_of(OAuth2::Client)
|
26
|
+
GiveyRuby.configuration.client.site.should == "http://example.com"
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: givey_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
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: 2013-01-
|
12
|
+
date: 2013-01-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -145,6 +145,7 @@ files:
|
|
145
145
|
- lib/givey_ruby/shared.rb
|
146
146
|
- lib/givey_ruby/version.rb
|
147
147
|
- spec/factories.rb
|
148
|
+
- spec/givey_ruby/configuration_spec.rb
|
148
149
|
- spec/givey_ruby/controller_spec.rb
|
149
150
|
- spec/givey_ruby/model_spec.rb
|
150
151
|
- spec/givey_ruby_spec.rb
|
@@ -178,6 +179,7 @@ specification_version: 3
|
|
178
179
|
summary: Ruby API for accessing Givey API
|
179
180
|
test_files:
|
180
181
|
- spec/factories.rb
|
182
|
+
- spec/givey_ruby/configuration_spec.rb
|
181
183
|
- spec/givey_ruby/controller_spec.rb
|
182
184
|
- spec/givey_ruby/model_spec.rb
|
183
185
|
- spec/givey_ruby_spec.rb
|