tinybucket 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +11 -2
- data/lib/tinybucket.rb +1 -0
- data/lib/tinybucket/config.rb +1 -1
- data/lib/tinybucket/connection.rb +8 -0
- data/lib/tinybucket/version.rb +1 -1
- data/spec/lib/tinybucket_spec.rb +3 -0
- data/tinybucket.gemspec +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65f9c7b6e4cffe83881f78a6c23c787e1f054402
|
4
|
+
data.tar.gz: 2596b76496b6a201d0dbdf9fc22d434b8d2f29b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9133bcb3b6c335495c0b00d678d5bf845a45c58ce476dc6e5e45953f7a9201a565c90e832f0681eafebd75c47bf12fc0c91cad8cf94f5f497404293ccba805c
|
7
|
+
data.tar.gz: cd947d13332ee1ebeafad0f07238e0103905c614ba77fc39f623fcc433701fdd138a35fb08d7bdad941167c7b48f21b7aa463c8658773c004128d759747ac9a7
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -42,10 +42,19 @@ logger = Logger.new($stdout)
|
|
42
42
|
logger.level = Logger::WARN
|
43
43
|
|
44
44
|
Tinybucket.configure do |config|
|
45
|
-
#
|
45
|
+
# Configure logger if you want.
|
46
|
+
#
|
47
|
+
# optional, default: nil (no logging)
|
46
48
|
config.logger = logger
|
47
49
|
|
48
|
-
#
|
50
|
+
# Configure cache_store options if you need.
|
51
|
+
#
|
52
|
+
# see https://github.com/plataformatec/faraday-http-cache
|
53
|
+
#
|
54
|
+
# optional, default: nil (disable request cache)
|
55
|
+
config.cache_store_options = { store: Rails.cache, logger: logger }
|
56
|
+
|
57
|
+
# Configure oauth_token/oauth_secret
|
49
58
|
config.oauth_token = 'key'
|
50
59
|
config.oauth_secret = 'secret'
|
51
60
|
end
|
data/lib/tinybucket.rb
CHANGED
data/lib/tinybucket/config.rb
CHANGED
@@ -36,6 +36,8 @@ module Tinybucket
|
|
36
36
|
consumer_secret: Tinybucket.config.oauth_secret
|
37
37
|
}
|
38
38
|
|
39
|
+
configure_response_cache(conn)
|
40
|
+
|
39
41
|
conn.request :multipart
|
40
42
|
conn.request :url_encoded
|
41
43
|
conn.request :oauth, oauth_secrets
|
@@ -49,6 +51,12 @@ module Tinybucket
|
|
49
51
|
end
|
50
52
|
end
|
51
53
|
|
54
|
+
def configure_response_cache(conn)
|
55
|
+
return unless Tinybucket.config.cache_store_options
|
56
|
+
|
57
|
+
conn.use :http_cache, Tinybucket.config.cache_store_options
|
58
|
+
end
|
59
|
+
|
52
60
|
def stack(parser, options = {}, &block)
|
53
61
|
Faraday::RackBuilder.new(&block) and return if block_given?
|
54
62
|
|
data/lib/tinybucket/version.rb
CHANGED
data/spec/lib/tinybucket_spec.rb
CHANGED
@@ -17,6 +17,7 @@ RSpec.describe Tinybucket do
|
|
17
17
|
let(:logger) { Logger.new($stdout) }
|
18
18
|
let(:oauth_token) { 'test_oauth_token' }
|
19
19
|
let(:oauth_secret) { 'test_oauth_secret' }
|
20
|
+
let(:cache_store_options) { { logger: Tinybucket.logger } }
|
20
21
|
|
21
22
|
it 'is configurable' do
|
22
23
|
expect(config.logger).to be_nil
|
@@ -24,12 +25,14 @@ RSpec.describe Tinybucket do
|
|
24
25
|
expect do
|
25
26
|
Tinybucket.configure do |config|
|
26
27
|
config.logger = logger
|
28
|
+
config.cache_store_options = cache_store_options
|
27
29
|
config.oauth_token = oauth_token
|
28
30
|
config.oauth_secret = oauth_secret
|
29
31
|
end
|
30
32
|
end.not_to raise_error
|
31
33
|
|
32
34
|
expect(config.logger).to eq(logger)
|
35
|
+
expect(config.cache_store_options).to eq(cache_store_options)
|
33
36
|
expect(config.oauth_token).to eq(oauth_token)
|
34
37
|
expect(config.oauth_secret).to eq(oauth_secret)
|
35
38
|
end
|
data/tinybucket.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_runtime_dependency 'activesupport', ['>= 4.1.6']
|
23
23
|
spec.add_runtime_dependency 'faraday', ['= 0.9.0']
|
24
24
|
spec.add_runtime_dependency 'faraday_middleware', ['= 0.9.1']
|
25
|
+
spec.add_runtime_dependency 'faraday-http-cache', ['~> 1.2']
|
25
26
|
spec.add_runtime_dependency 'simple_oauth', ['= 0.2.0']
|
26
27
|
|
27
28
|
spec.add_development_dependency 'bundler', '~> 1.10'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tinybucket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hirakiuc
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.9.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: faraday-http-cache
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.2'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.2'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: simple_oauth
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|