vertebrae 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 62bec3dbf6715f029514cc5388a21bf45ad5b008
4
- data.tar.gz: 2d3140c4d817b9e5b5c8b5fc22c83677fd2a56dc
3
+ metadata.gz: 334c2082e80376ff85f40fe9d97af5bd4f9f1afd
4
+ data.tar.gz: fe8f9b0398f44584ad25d3984d3540b459bfee45
5
5
  SHA512:
6
- metadata.gz: 906d38441f57707df98d07243d9549798493a43e23a4f38cebf5cfb8e933298b4d63c5d0e9303362d99bb69d021badc8be9a58fab8e229331d52946795dca935
7
- data.tar.gz: 8270f673b278bf6e88d37338645c264a2b699e68c450f87cd78e9676ae8ba98f9c2c8dbca23cccdc27d188b5ba7b9ba20196dce981b36825ec26f985fbf2c5e2
6
+ metadata.gz: f18ac99c52a515ab24896c8c567f8c3fac39c0e3db7c7317db3aea91b0c8a31df968d06ed648b9023e10bfc7eb4e2a87d3460bee00b99b8b23730570b7e03506
7
+ data.tar.gz: 281da9a937b67c080b9628564a0242e757e3f9e77ad65b55851fb749788fc474692fa910896f198ea641d9e70f72f2f1351f180af92d597071b29bbc9cf67db9
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
data/lib/api.rb CHANGED
@@ -18,34 +18,10 @@ module Vertebrae
18
18
  def setup
19
19
  end
20
20
 
21
-
22
21
  def default_options
23
22
  {}
24
23
  end
25
24
 
26
- def request(method, path, params, options) # :nodoc:
27
- if !::Vertebrae::Request::METHODS.include?(method)
28
- raise ArgumentError, "unknown http method: #{method}"
29
- end
30
-
31
- path = connection.configuration.prefix + '/' + path
32
-
33
- ::Vertebrae::Base.logger.debug "EXECUTED: #{method} - #{path} with #{params} and #{options}"
34
-
35
- connection.connection.send(method) do |request|
36
-
37
- case method.to_sym
38
- when *(::Vertebrae::Request::METHODS - ::Vertebrae::Request::METHODS_WITH_BODIES)
39
- request.body = params.delete('data') if params.has_key?('data')
40
- request.url(path, params)
41
- when *::Vertebrae::Request::METHODS_WITH_BODIES
42
- request.path = path
43
- request.body = extract_data_from_params(params) unless params.empty?
44
- end
45
- end
46
- end
47
-
48
-
49
25
  def yield_or_eval(&block)
50
26
  return unless block
51
27
  block.arity > 0 ? yield(self) : self.instance_eval(&block)
data/lib/request.rb CHANGED
@@ -24,8 +24,26 @@ module Vertebrae
24
24
  request(:delete, path, params, options)
25
25
  end
26
26
 
27
- def request(method, path, params, options)
28
- raise 'implement me'
27
+ def request(method, path, params, options) # :nodoc:
28
+ if !::Vertebrae::Request::METHODS.include?(method)
29
+ raise ArgumentError, "unknown http method: #{method}"
30
+ end
31
+
32
+ path = connection.configuration.prefix + '/' + path
33
+
34
+ ::Vertebrae::Base.logger.debug "EXECUTED: #{method} - #{path} with #{params} and #{options}"
35
+
36
+ connection.connection.send(method) do |request|
37
+
38
+ case method.to_sym
39
+ when *(::Vertebrae::Request::METHODS - ::Vertebrae::Request::METHODS_WITH_BODIES)
40
+ request.body = params.delete('data') if params.has_key?('data')
41
+ request.url(path, params)
42
+ when *::Vertebrae::Request::METHODS_WITH_BODIES
43
+ request.path = path
44
+ request.body = extract_data_from_params(params) unless params.empty?
45
+ end
46
+ end
29
47
  end
30
48
  end
31
49
  end
data/vertebrae.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "vertebrae"
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nathan Woodhull"]
12
- s.date = "2013-08-08"
12
+ s.date = "2013-08-09"
13
13
  s.description = "A set of low level infrastructure and reusable code for building API clients"
14
14
  s.email = "nathan@controlshiftlabs.com"
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vertebrae
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Woodhull
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-08 00:00:00.000000000 Z
11
+ date: 2013-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport