saddle 0.0.49 → 0.0.50

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YmNmNGRkZmYxMGUxNjNhYWQ2MGUzNDYyMTRlODVkODg0Yjk0YjgzZQ==
4
+ Y2YwNTRjYjcwYWE2NDY5NjQ5N2I3ZTU2ODNhM2JlYmY3YjA0NWU3YQ==
5
5
  data.tar.gz: !binary |-
6
- YTJjNmJmNjBlMGJkNjQxM2YyYWE5ZTQyOTk3NmNiODUyZjM3M2E1Nw==
6
+ N2Y3OTg4YzYwMWM5NGJiYmRlYWM5MzRkNDFkZjJkNzk2ZTNlMjIxNg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NWY5OGJmNTc3YjIyNTM4YTk4YzIyMTg1MmQ1YWQxODdlNjUyOTgyOGI1YjFl
10
- OWNjNDEzNWM2MDRmYjliYWZhMWQ2OWM2Zjk4Y2U1N2RmMjE0MzFlZGNmMzIx
11
- N2IyMjkxZjJhZmZlZjZiNjJiZjIxZGVmODRlNzIxZGVhNDY1M2M=
9
+ YjEyZGVkNTkwMjhhNTk3OTZlZTE3M2UyYzIyNzFiZmFhZDg3NjVlMzY0YTlk
10
+ YjQ5MDZhODJhYTUyYTQ2NTEwNjgzNWJjODI5YWYyZjA0NWJjNmMyNDk1NWVl
11
+ OTMxN2NlMGI4NDdkNmE5M2ZiOWRlNjU2ODU4OWZmM2IzOTNlNjM=
12
12
  data.tar.gz: !binary |-
13
- MDdkOTMxN2MxN2VjZTY3M2U5ZDVkYWMzOGYzOTMwZGQ4MDkxZjA0OTgxNzUw
14
- MTJkM2E4NTQ1NDhhNzdhYWM3ZWI3ZDA5M2JlMDZlOTYzZjI4NTZjMGViMjE0
15
- ZGQ4MzkxZTQ1ZWQ4YmQ5ZTNmODQxZDQ1ZTUyMzNhZTlkNGM1ZWE=
13
+ ZjJkYzU3NzYzMTU2ZjFlMGNhMTk0OTZjMzg5ZTQzMGUzMDc3YTI3Y2IxODkw
14
+ OWVlMjY3YzIzYTdhZDYxZDFhMGZmNTJhOTllMzA3NjFkZGE4YmVjOWZlMjU5
15
+ MWQxOWEzZDczMjU2ZGNkZjQ5MjAxZTRkNjFiZWUwZmI2MzA5ODk=
@@ -3,5 +3,6 @@ rvm:
3
3
  - 2.0.0
4
4
  - 1.9.3
5
5
  - jruby-19mode # JRuby in 1.9 mode
6
+ - 1.8.7
6
7
 
7
8
  script: bundle exec rspec
@@ -72,6 +72,11 @@ module Saddle
72
72
  endpoint_instance
73
73
  end
74
74
 
75
+ unless self.respond_to?(:define_singleton_method)
76
+ def define_singleton_method(name, &block)
77
+ (class << self; self end).send(:define_method, name, &block)
78
+ end
79
+ end
75
80
 
76
81
  protected
77
82
 
@@ -156,7 +156,7 @@ module Saddle
156
156
 
157
157
  # Apply additional implementation-specific middlewares
158
158
  @additional_middlewares.each do |m|
159
- builder.use(m[:klass], *m[:args])
159
+ m[:args] ? builder.use(m[:klass], *m[:args]) : builder.use(m[:klass])
160
160
  end
161
161
 
162
162
  # Request encoding
@@ -1,3 +1,3 @@
1
1
  module Saddle
2
- VERSION = '0.0.49'
2
+ VERSION = '0.0.50'
3
3
  end
@@ -21,8 +21,13 @@ Gem::Specification.new do |s|
21
21
  s.files = `git ls-files`.split($\)
22
22
  s.executables = ['saddle']
23
23
  s.test_files = s.files.grep(%r{^(spec)/})
24
+
25
+ if RUBY_VERSION < '1.9'
26
+ s.add_dependency 'activesupport', '~> 3.0'
27
+ else
28
+ s.add_dependency 'activesupport', '>= 3.0'
29
+ end
24
30
 
25
- s.add_dependency 'activesupport', '>= 3.0'
26
31
  s.add_dependency 'faraday', '~> 0.8.7'
27
32
  s.add_dependency 'faraday_middleware', '~> 0.9.0'
28
33
  end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe Saddle::BaseEndpoint do
4
+ let(:base_endpoint) { Saddle::BaseEndpoint.new(Saddle::Client.create) }
5
+
6
+ it 'can define singleton methods' do
7
+ expect(base_endpoint.respond_to?(:define_singleton_method)).to be_true
8
+ end
9
+
10
+ it 'responds to any defined singleton methods' do
11
+ base_endpoint.define_singleton_method(:my_method) { true }
12
+ expect(base_endpoint.my_method).to be_true
13
+ end
14
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Saddle::TraversalEndpoint do
4
+ it 'can build and attach nodes' do
5
+ class TestEndpoint < Saddle::TraversalEndpoint; end
6
+ expect {
7
+ TestEndpoint.new(Saddle::Client.create)._build_and_attach_node(Saddle::TraversalEndpoint)
8
+ }.to_not raise_error
9
+ end
10
+ end
@@ -38,7 +38,7 @@ describe Saddle::Client do
38
38
  end
39
39
 
40
40
  it "should post JSON encoded" do
41
- @stubs.post('/test', '{"a":0,"b":true,"c":"Wingdings"}') {
41
+ @stubs.post('/test', {'a' => 0, 'b' => true, 'c' => 'Wingdings'}.to_json) {
42
42
  [
43
43
  200,
44
44
  {},
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saddle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.49
4
+ version: 0.0.50
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Lewis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-16 00:00:00.000000000 Z
11
+ date: 2013-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -107,6 +107,8 @@ files:
107
107
  - lib/saddle/requester.rb
108
108
  - lib/saddle/version.rb
109
109
  - saddle.gemspec
110
+ - spec/endpoint/base_endpoint_spec.rb
111
+ - spec/endpoint/traversal_endpoint_spec.rb
110
112
  - spec/middleware/authentication/oauth2_authentication_spec.rb
111
113
  - spec/middleware/instrumentation_spec.rb
112
114
  - spec/middleware/logging/airbrake_spec.rb
@@ -144,6 +146,8 @@ specification_version: 4
144
146
  summary: A full-featured, generic consumer layer for you to build API client implementations
145
147
  with.
146
148
  test_files:
149
+ - spec/endpoint/base_endpoint_spec.rb
150
+ - spec/endpoint/traversal_endpoint_spec.rb
147
151
  - spec/middleware/authentication/oauth2_authentication_spec.rb
148
152
  - spec/middleware/instrumentation_spec.rb
149
153
  - spec/middleware/logging/airbrake_spec.rb