rapidash 0.0.3 → 0.0.4
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 +4 -4
- data/lib/rapidash/base.rb +1 -1
- data/lib/rapidash/client.rb +4 -0
- data/lib/rapidash/clientable.rb +6 -0
- data/lib/rapidash/urlable.rb +4 -6
- data/lib/rapidash/version.rb +1 -1
- data/rapidash.gemspec +1 -1
- data/spec/rapidash/base_spec.rb +17 -1
- data/spec/rapidash/client_spec.rb +6 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc6b0e6636bacbfbc9b0294b808b87e69d8ed6d9
|
4
|
+
data.tar.gz: 58ff477a1fd01590ed8deb47647e9be8c0212ff5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 715b0e98003340a217a1d0d3b673a7f0b5d96e4dbbe45b0f26e718d949a5777c5ae16b392573df2f005fa36e69f2dfa1347c5c9e320827ad957ab177ebb438e7
|
7
|
+
data.tar.gz: 470f35e9d9234fd207d1a002875957f453c8fd55541a3c2ecd86a91124fca19dd48d890e3b7f3fe2cac1ec56db000783d7169d4db0768eadec61aa6eb4dd1edc
|
data/lib/rapidash/base.rb
CHANGED
data/lib/rapidash/client.rb
CHANGED
data/lib/rapidash/clientable.rb
CHANGED
@@ -7,6 +7,8 @@ module Rapidash
|
|
7
7
|
|
8
8
|
module ClassMethods
|
9
9
|
|
10
|
+
attr_accessor :patch
|
11
|
+
|
10
12
|
def method(method)
|
11
13
|
case method
|
12
14
|
when :http then include HTTPClient
|
@@ -16,6 +18,10 @@ module Rapidash
|
|
16
18
|
raise ConfigurationError.new "Invalid API Authentication Method"
|
17
19
|
end
|
18
20
|
end
|
21
|
+
|
22
|
+
def use_patch
|
23
|
+
@patch = true
|
24
|
+
end
|
19
25
|
end
|
20
26
|
end
|
21
27
|
end
|
data/lib/rapidash/urlable.rb
CHANGED
@@ -7,12 +7,10 @@ module Rapidash
|
|
7
7
|
|
8
8
|
module ClassMethods
|
9
9
|
def url(url)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
@url += "/#{@id}" if @id
|
15
|
-
end
|
10
|
+
define_method(:initialize) do |*args|
|
11
|
+
super(*args)
|
12
|
+
@url = "#{base_url}#{url.to_s}"
|
13
|
+
@url += "/#{@id}" if @id
|
16
14
|
end
|
17
15
|
end
|
18
16
|
end
|
data/lib/rapidash/version.rb
CHANGED
data/rapidash.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["gazler@gmail.com"]
|
11
11
|
spec.description = %q{Evolve your API}
|
12
12
|
spec.summary = %q{An opinionated core for creating clients for RESTful APIs quickly}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "http://github.com/Gazler/rapidash"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
data/spec/rapidash/base_spec.rb
CHANGED
@@ -10,6 +10,12 @@ end
|
|
10
10
|
class Rapidash::Resource < Rapidash::Base
|
11
11
|
end
|
12
12
|
|
13
|
+
class BaseTesterClient
|
14
|
+
class << self
|
15
|
+
attr_accessor :patch
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
13
19
|
|
14
20
|
describe Rapidash::Base do
|
15
21
|
|
@@ -28,7 +34,7 @@ describe Rapidash::Base do
|
|
28
34
|
end
|
29
35
|
end
|
30
36
|
|
31
|
-
let(:client) {
|
37
|
+
let(:client) { BaseTesterClient.new }
|
32
38
|
let(:headers) { {"content-type" => "application/json"} }
|
33
39
|
let(:subject) { BaseTester.new(client) }
|
34
40
|
|
@@ -60,6 +66,16 @@ describe Rapidash::Base do
|
|
60
66
|
:body => post.to_json
|
61
67
|
})
|
62
68
|
end
|
69
|
+
|
70
|
+
it "should use the patch verb if set on the client" do
|
71
|
+
client.class.patch = true
|
72
|
+
subject.should_receive(:call!)
|
73
|
+
subject.update!(post)
|
74
|
+
subject.instance_variable_get(:@options).should eql({
|
75
|
+
:method => :patch,
|
76
|
+
:body => post.to_json
|
77
|
+
})
|
78
|
+
end
|
63
79
|
end
|
64
80
|
|
65
81
|
describe ".delete!" do
|
@@ -35,6 +35,12 @@ describe Rapidash::Client do
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
describe ".patch" do
|
39
|
+
it "should call request" do
|
40
|
+
subject.should_receive(:request).with(:patch, "foo", {})
|
41
|
+
subject.patch("foo")
|
42
|
+
end
|
43
|
+
end
|
38
44
|
|
39
45
|
describe ".delete" do
|
40
46
|
it "should call request" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rapidash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gary 'Gazler' Rennie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-03-
|
11
|
+
date: 2013-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -146,7 +146,7 @@ files:
|
|
146
146
|
- spec/rapidash/test_client_spec.rb
|
147
147
|
- spec/rapidash/urlable_spec.rb
|
148
148
|
- spec/spec_helper.rb
|
149
|
-
homepage:
|
149
|
+
homepage: http://github.com/Gazler/rapidash
|
150
150
|
licenses:
|
151
151
|
- MIT
|
152
152
|
metadata: {}
|