tumble 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,6 @@ module Tumble
4
4
  def initialize(token, secret)
5
5
  @token = token
6
6
  @secret = secret
7
- @faraday_connection = faraday_connection
8
7
  end
9
8
 
10
9
  def base_url
@@ -29,7 +28,7 @@ module Tumble
29
28
 
30
29
  def request(method, path, params)
31
30
  path = "/v2#{path}" unless path =~ /^\/v2/
32
- response = @faraday_connection.send(method) do |request|
31
+ response = faraday_connection.send(method) do |request|
33
32
  case method
34
33
  when :delete, :get
35
34
  request.url(path, params)
@@ -50,8 +49,7 @@ module Tumble
50
49
  :user_agent => 'tumble'
51
50
  }
52
51
  }
53
- Faraday::Connection.new(options) do |builder|
54
- builder.use Faraday::Request::Multipart
52
+ @faraday_connection ||= Faraday::Connection.new(options) do |builder|
55
53
  builder.use Faraday::Request::UrlEncoded
56
54
  builder.use FaradayMiddleware::Mashify
57
55
  builder.use FaradayMiddleware::ParseJson
@@ -6,19 +6,16 @@ module Tumble
6
6
  class TumblrOAuth < Faraday::Middleware
7
7
 
8
8
  def call(env)
9
- params = env[:body] || {}
10
- signature_params = params
11
- params.each do |key, value|
12
- signature_params = {} if value.respond_to?(:content_type)
13
- end
9
+ params = env[:body].is_a?(Hash) ? env[:body] : {}
10
+ signature_params = params.reject{ |k,v| v.respond_to?(:content_type) }
14
11
  header = SimpleOAuth::Header.new(env[:method], env[:url], signature_params, @options)
15
12
  env[:request_headers]['Authorization'] = header.to_s
16
-
17
13
  @app.call(env)
18
14
  end
19
15
 
20
16
  def initialize(app, options)
21
- @app, @options = app, options
17
+ @app = app
18
+ @options = options
22
19
  end
23
20
  end
24
21
  end
data/lib/tumble.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  end
4
4
 
5
5
  module Tumble
6
- VERSION = '0.0.4'
6
+ VERSION = '0.0.5'
7
7
 
8
8
  def self.configure
9
9
  yield Config
data/tumble.gemspec CHANGED
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
3
3
  s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5") if s.respond_to? :required_rubygems_version=
4
4
 
5
5
  s.name = 'tumble'
6
- s.version = '0.0.4'
6
+ s.version = '0.0.5'
7
7
 
8
8
  s.summary = 'Library for accessing the Tumblr api v2'
9
9
  # TODO: s.description
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tumble
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday
17
- requirement: &2162083700 !ruby/object:Gem::Requirement
17
+ requirement: &70102148042320 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2162083700
25
+ version_requirements: *70102148042320
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rake
28
- requirement: &2162083240 !ruby/object:Gem::Requirement
28
+ requirement: &70102148041860 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *2162083240
36
+ version_requirements: *70102148041860
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: rspec
39
- requirement: &2162082820 !ruby/object:Gem::Requirement
39
+ requirement: &70102148041440 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *2162082820
47
+ version_requirements: *70102148041440
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: webmock
50
- requirement: &2162082400 !ruby/object:Gem::Requirement
50
+ requirement: &70102148041020 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,7 +55,7 @@ dependencies:
55
55
  version: '0'
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *2162082400
58
+ version_requirements: *70102148041020
59
59
  description:
60
60
  email: aubreyholland@gmail.com
61
61
  executables: []