chaingang 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Gemfile +3 -0
- data/PUBLIC_DOMAIN +103 -0
- data/Rakefile +19 -0
- data/VERSION +1 -0
- data/chaingang.gemspec +25 -0
- data/lib/chaingang/proxy.rb +24 -1
- data/readme.md +42 -0
- data/spec/chaingang/proxy_spec.rb +23 -0
- metadata +52 -14
- data/LICENSE +0 -1
data/.gitignore
ADDED
data/Gemfile
ADDED
data/PUBLIC_DOMAIN
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
This software is PUBLIC DOMAIN
|
2
|
+
|
3
|
+
|
4
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
5
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
6
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
7
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
8
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
9
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,;;iiii;;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
10
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,;ijffffffffffffffffji;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
11
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,;iffffffffffffffffffffffffffi;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
12
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, iffffffffffffffffffffffffffffffi ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
13
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,ijffffffffffffffffffffffffffffffffffji,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
14
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,iffffffffffffffffffffffffffffffffffffffffi,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
15
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,jffffffffffffffffffffffffffffffffffffffffffffj,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
16
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,tfffffffffffffffffffffffffffffffffffffffffffffft,,,,,,,,,,,,,,,,,,,,,,,,,,
|
17
|
+
,,,,,,,,,,,,,,,,,,,,,,,,;ffffffffffffffffffffffffffffffffffffffffffffffffff;,,,,,,,,,,,,,,,,,,,,,,,,
|
18
|
+
,,,,,,,,,,,,,,,,,,,,,,,ffffffffffffffffffffffjt;;,,;;tjffffffffffffffffffffff,,,,,,,,,,,,,,,,,,,,,,,
|
19
|
+
,,,,,,,,,,,,,,,,,,,,,;fffffffffffffffffft: :tffffffffffffffffff;,,,,,,,,,,,,,,,,,,,,,
|
20
|
+
,,,,,,,,,,,,,,,,,,,,,jfffffffffffffffft. .tffffffffffffffffj,,,,,,,,,,,,,,,,,,,,,
|
21
|
+
,,,,,,,,,,,,,,,,,,,ifffffffffffffffi: :ifffffffffffffffi,,,,,,,,,,,,,,,,,,,
|
22
|
+
,,,,,,,,,,,,,,,,,,tffffffffffffffi ifffffffffffffft,,,,,,,,,,,,,,,,,,
|
23
|
+
,,,,,,,,,,,,,,,,,ifffffffffffff, ,fffffffffffffi,,,,,,,,,,,,,,,,,
|
24
|
+
,,,,,,,,,,,,,,,,,fffffffffffffi ifffffffffffff,,,,,,,,,,,,,,,,,
|
25
|
+
,,,,,,,,,,,,,,,;jffffffffffff ffffffffffffj;,,,,,,,,,,,,,,,
|
26
|
+
,,,,,,,,,,,,,,,ffffffffffff: jffffffffffffff,,,,,,,,,,,,,,,
|
27
|
+
,,,,,,,,,,,,,,ffffffffffff. jffffffffffffffff,,,,,,,,,,,,,,
|
28
|
+
,,,,,,,,,,,,,;ffffffffffft :fffffffffffffffff;,,,,,,,,,,,,,
|
29
|
+
,,,,,,,,,,,,,ffffffffffft ,tfffffft; jfffffffffffffffffff,,,,,,,,,,,,,
|
30
|
+
,,,,,,,,,,,,tffffffffff. ;ffffffffffffffff; jfffffffffffffffffffft,,,,,,,,,,,,
|
31
|
+
,,,,,,,,,,,jffffffffff: ,ffffffffffffffffffffff, jffffffffffffffffffffffj,,,,,,,,,,,
|
32
|
+
,,,,,,,,,,,fffffffffff :ffffffffffffffffffffffff: :ffffffffffffffffffffffff,,,,,,,,,,,
|
33
|
+
,,,,,,,,,,iffffffffff ,jfffffffffffffffffffffffff jfffffffffffffffffffffffffi,,,,,,,,,,
|
34
|
+
,,,,,,,,,,ffffffffffi tffffffffffffffffffffffffff jfffffffffffffff iffffffffff,,,,,,,,,,
|
35
|
+
,,,,,,,,,ifffffffff, jfffffffffffffffffffffffff, jfffffffffffffff ,fffffffffi,,,,,,,,,
|
36
|
+
,,,,,,,,,jfffffffff :ffffffffffffffffffffffffff :fffffffffffffff; fffffffffj,,,,,,,,,
|
37
|
+
,,,,,,,, fffffffffi jffffffffffffffffffffffffff jfffffffffffffff ifffffffff ,,,,,,,,
|
38
|
+
,,,,,,,,ifffffffff tffffffffffffffffffffffffff jfffffffffffffff fffffffffi,,,,,,,,
|
39
|
+
,,,,,,,;fffffffffi :fffffffffffffffffffffffff, jfffffffffffffff ifffffffff;,,,,,,,
|
40
|
+
,,,,,,,ifffffffff: jfffffffffffffffffffffffff :fffffffffffffff; :fffffffffi,,,,,,,
|
41
|
+
,,,,,,,ffffffffff :fffffffffffffffffffffffff jfffffffffffffff ffffffffff,,,,,,,
|
42
|
+
,,,,,,,ffffffffft ,fffffffffffffffff; jfffffffffffffff t, tfffffffff,,,,,,,
|
43
|
+
,,,,,,;fffffffff ffffffffffffffff jfffffffffffffff tff fffffffff;,,,,,,
|
44
|
+
,,,,,,ifffffffft fffffffffffffff, :fffffffffffffff;.fff tffffffffi,,,,,,
|
45
|
+
,,,,,,jffffffff: ;ffffffffffffff. jfffffffffffffff .ffff; :ffffffffj,,,,,,
|
46
|
+
,,,,,,fffffffff ffffffffffffff, jfffffffffffffff tffffff fffffffff,,,,,,
|
47
|
+
,,,,,,fffffffff fffffffffffff jfffffffffffffff tfffffff fffffffff,,,,,,
|
48
|
+
,,,,,,fffffffff fffffffffffff :fffffffffffffff; ........ fffffffff,,,,,,
|
49
|
+
,,,,,;ffffffffj ,ffffffffffff; jfffffffffffffff jffffffff;,,,,,
|
50
|
+
,,,,,;ffffffffi tffffffffffff jfffffffffffffff iffffffff;,,,,,
|
51
|
+
,,,,,;ffffffff; fffffffffffff jfffffffffffffff ;ffffffff;,,,,,
|
52
|
+
,,,,,;ffffffff; fffffffffffff :fffffffffffffff; ;ffffffff;,,,,,
|
53
|
+
,,,,,iffffffff, fffffffffffff jfffffffffffffff ,ffffffffi,,,,,
|
54
|
+
,,,,,iffffffff, fffffffffffff jfffffffffffffff ,ffffffffi,,,,,
|
55
|
+
,,,,,;ffffffff; fffffffffffff jfffffffffffffff ;ffffffff;,,,,,
|
56
|
+
,,,,,;ffffffff; fffffffffffff :fffffffffffffff; ;ffffffff;,,,,,
|
57
|
+
,,,,,;ffffffffi tffffffffffff jfffffffffffffff iffffffff;,,,,,
|
58
|
+
,,,,,;ffffffffj ,fffffffffff jfffffffffffffff jffffffff;,,,,,
|
59
|
+
,,,,,,fffffffff fffffffff, jfffffffffffffff jjjjjjjjjjjjj fffffffff,,,,,,
|
60
|
+
,,,,,,fffffffff fffffffff :fffffffffffffff; .fffffffffffff fffffffff,,,,,,
|
61
|
+
,,,,,,fffffffff ffffffff jfffffffffffffff ,ffffffffffffff fffffffff,,,,,,
|
62
|
+
,,,,,,jffffffff: ;ffffff jfffffffffffffff .ffffffffffffff; :ffffffffj,,,,,,
|
63
|
+
,,,,,,ifffffffft ffff, jfffffffffffffff ,fffffffffffffff tffffffffi,,,,,,
|
64
|
+
,,,,,,;fffffffff ffff :fffffffffffffff; ffffffffffffffff fffffffff;,,,,,,
|
65
|
+
,,,,,,,ffffffffft ,ff jfffffffffffffff ifffffffffffffffff, tfffffffff,,,,,,,
|
66
|
+
,,,,,,,ffffffffff : jfffffffffffffff tfffffffffffffffffffffff: ffffffffff,,,,,,,
|
67
|
+
,,,,,,,ifffffffff: jfffffffffffffff tfffffffffffffffffffffffj :fffffffffi,,,,,,,
|
68
|
+
,,,,,,,;fffffffffi :fffffffffffffff;.ffffffffffffffffffffffff: ifffffffff;,,,,,,,
|
69
|
+
,,,,,,,,ifffffffff jfffffffffffffff .fffffffffffffffffffffffft fffffffffi,,,,,,,,
|
70
|
+
,,,,,,,, fffffffffi jfffffffffffffff tffffffffffffffffffffffffj ifffffffff ,,,,,,,,
|
71
|
+
,,,,,,,,,jfffffffff jfffffffffffffff tffffffffffffffffffffffff: fffffffffj,,,,,,,,,
|
72
|
+
,,,,,,,,,ifffffffff, :fffffffffffffff;.ffffffffffffffffffffffffj ,fffffffffi,,,,,,,,,
|
73
|
+
,,,,,,,,,,ffffffffffi jfffffffffffffff .fffffffffffffffffffffffft iffffffffff,,,,,,,,,,
|
74
|
+
,,,,,,,,,,iffffffffff jfffffffffffffff tfffffffffffffffffffffffj, ffffffffffi,,,,,,,,,,
|
75
|
+
,,,,,,,,,,,ffffffffffffffffffffffffff tfffffffffffffffffffffff: fffffffffff,,,,,,,,,,,
|
76
|
+
,,,,,,,,,,,jffffffffffffffffffffffff; ,ffffffffffffffffffffff, :ffffffffffj,,,,,,,,,,,
|
77
|
+
,,,,,,,,,,,,tffffffffffffffffffffff ;ffffffffffffffff; .fffffffffft,,,,,,,,,,,,
|
78
|
+
,,,,,,,,,,,,,fffffffffffffffffffff ,tfffffft; tfffffffffff,,,,,,,,,,,,,
|
79
|
+
,,,,,,,,,,,,,;fffffffffffffffffff tfffffffffff;,,,,,,,,,,,,,
|
80
|
+
,,,,,,,,,,,,,,ffffffffffffffffff; .ffffffffffff,,,,,,,,,,,,,,
|
81
|
+
,,,,,,,,,,,,,,,ffffffffffffffff :ffffffffffff,,,,,,,,,,,,,,,
|
82
|
+
,,,,,,,,,,,,,,,;jfffffffffffff ffffffffffffj;,,,,,,,,,,,,,,,
|
83
|
+
,,,,,,,,,,,,,,,,,fffffffffffffi ifffffffffffff,,,,,,,,,,,,,,,,,
|
84
|
+
,,,,,,,,,,,,,,,,,ifffffffffffff, ,fffffffffffffi,,,,,,,,,,,,,,,,,
|
85
|
+
,,,,,,,,,,,,,,,,,,tffffffffffffffi ifffffffffffffft,,,,,,,,,,,,,,,,,,
|
86
|
+
,,,,,,,,,,,,,,,,,,,ifffffffffffffffi: :ifffffffffffffffi,,,,,,,,,,,,,,,,,,,
|
87
|
+
,,,,,,,,,,,,,,,,,,,,,jfffffffffffffffft. .tffffffffffffffffj,,,,,,,,,,,,,,,,,,,,,
|
88
|
+
,,,,,,,,,,,,,,,,,,,,,;fffffffffffffffffft: :tffffffffffffffffff;,,,,,,,,,,,,,,,,,,,,,
|
89
|
+
,,,,,,,,,,,,,,,,,,,,,,,ffffffffffffffffffffffjt;;,,;;tjffffffffffffffffffffff,,,,,,,,,,,,,,,,,,,,,,,
|
90
|
+
,,,,,,,,,,,,,,,,,,,,,,,,;ffffffffffffffffffffffffffffffffffffffffffffffffff;,,,,,,,,,,,,,,,,,,,,,,,,
|
91
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,tfffffffffffffffffffffffffffffffffffffffffffffft,,,,,,,,,,,,,,,,,,,,,,,,,,
|
92
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,jffffffffffffffffffffffffffffffffffffffffffffj,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
93
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,iffffffffffffffffffffffffffffffffffffffffi,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
94
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,ijffffffffffffffffffffffffffffffffffji,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
95
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, iffffffffffffffffffffffffffffffi ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
96
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,;iffffffffffffffffffffffffffi;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
97
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,;ijffffffffffffffffji;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
98
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,;;iiii;;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
99
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
100
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
101
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
102
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
103
|
+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gemspec|
|
7
|
+
gemspec.name = "chaingang"
|
8
|
+
gemspec.summary = "A chainable API for ActiveResource."
|
9
|
+
gemspec.description = "AREL has proven that chainable APIs rock. Let's give ActiveResource the same love."
|
10
|
+
gemspec.email = "moonmaster9000@gmail.com"
|
11
|
+
gemspec.files = FileList['lib/**/*.rb', 'README.rdoc']
|
12
|
+
gemspec.homepage = "http://github.com/moonmaster9000/chaingang"
|
13
|
+
gemspec.authors = ["Matt Parker"]
|
14
|
+
gemspec.add_dependency('activeresource', '>= 2.2')
|
15
|
+
end
|
16
|
+
Jeweler::GemcutterTasks.new
|
17
|
+
rescue LoadError
|
18
|
+
puts "Jeweler not available. Install it with: gem install jeweler"
|
19
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.2.1
|
data/chaingang.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = %q{chaingang}
|
3
|
+
s.version = File.read "VERSION"
|
4
|
+
|
5
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
|
+
s.authors = ["Matt Parker"]
|
7
|
+
s.date = %q{2011-02-23}
|
8
|
+
s.description = %q{A chainable API (like Arel) for ActiveResource.}
|
9
|
+
s.email = %q{moonmaster9000@gmail.com}
|
10
|
+
s.extra_rdoc_files = [
|
11
|
+
"readme.md"
|
12
|
+
]
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
|
17
|
+
s.homepage = %q{http://github.com/moonmaster9000/chaingang}
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
s.rubygems_version = %q{1.5.0}
|
20
|
+
s.summary = %q{A chainable API (like Arel) for ActiveResource.}
|
21
|
+
|
22
|
+
s.add_dependency(%q<activeresource>, ["~> 3.0"])
|
23
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.4.0"])
|
24
|
+
s.add_development_dependency("dupe", ["~> 0.6.0"])
|
25
|
+
end
|
data/lib/chaingang/proxy.rb
CHANGED
@@ -29,6 +29,13 @@ module ChainGang
|
|
29
29
|
self
|
30
30
|
end
|
31
31
|
|
32
|
+
# allow active resource to execute request with custom xml/json format from default.
|
33
|
+
# Article.find(:all).by?("moonmaster9000").format(:json)
|
34
|
+
def format(fmt)
|
35
|
+
@format = fmt.to_sym
|
36
|
+
self
|
37
|
+
end
|
38
|
+
|
32
39
|
# Set the query string parameters on your request by calling them as methods
|
33
40
|
# with a question mark at the end.
|
34
41
|
# Article.find(:all).where.author?("moonmaster9000") #/articles.xml?author=moonmaster9000
|
@@ -49,7 +56,23 @@ module ChainGang
|
|
49
56
|
options[:params] = @params
|
50
57
|
@client.find_without_chaingang(@find_scope, options)
|
51
58
|
end
|
52
|
-
|
59
|
+
alias_method :execute_without_format, :execute
|
60
|
+
|
61
|
+
# execute the request in specified format, then revert it back after the request.
|
62
|
+
def execute_with_format
|
63
|
+
fmt = @format
|
64
|
+
if fmt && fmt.to_s != @client.format.extension
|
65
|
+
old = @client.format.extension
|
66
|
+
@client.format = fmt.to_sym
|
67
|
+
result = execute_without_format
|
68
|
+
@client.format = old.to_sym
|
69
|
+
return result
|
70
|
+
else
|
71
|
+
execute_without_format
|
72
|
+
end
|
73
|
+
end
|
74
|
+
alias_method :execute, :execute_with_format
|
75
|
+
|
53
76
|
private
|
54
77
|
# @private
|
55
78
|
def value(attr) #:nodoc:
|
data/readme.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Introduction
|
2
|
+
|
3
|
+
Chainable APIs are great. There's no denying it. With Rails 3, ActiveRecord got a chainable API. But not so for ActiveResource,
|
4
|
+
that red-headed stepchild of the Rails 'verse.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
It's a gem. Install it.
|
9
|
+
|
10
|
+
$ gem install chaingang
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
First, `include ChainGang` in your ActiveResource::Base derived client class.
|
15
|
+
|
16
|
+
class Article < ActiveResource::Base
|
17
|
+
self.site = 'http://blah.com'
|
18
|
+
include ChainGang
|
19
|
+
end
|
20
|
+
|
21
|
+
Then, go wild:
|
22
|
+
|
23
|
+
# find all the articles /articles/published.xml?author=moonmaster9000&genre=sci-fi
|
24
|
+
@articles = Article.find(:all).from(:published).where.author?("moonmaster9000").and.genre?("sci-fi")
|
25
|
+
|
26
|
+
# at this point, @articles hasn't actually made the network call yet.
|
27
|
+
@articles.each do |article| # now it's made the network call
|
28
|
+
puts article.title
|
29
|
+
end
|
30
|
+
|
31
|
+
# or, find a specific article by id, but add a "?preview_data=true" onto the query string.
|
32
|
+
@article = Article.find('some-article-id').where.preview_data?(true)
|
33
|
+
|
34
|
+
# or, find the first article by moonmaster9000 and get the title; /articles.xml?author=moonmaster9000
|
35
|
+
@article = Article.find(:first).where.author?("moonmaster9000").title
|
36
|
+
|
37
|
+
# to specifiy the reqeust format, you can use format() method, which temporarily set Article.format for this request.
|
38
|
+
@article = Article.find(:first).where.author?("moonmaster9000").format(:json) # or :xml
|
39
|
+
|
40
|
+
## Documentation
|
41
|
+
|
42
|
+
Checkout http://rdoc.info/gems/chaingang/frames
|
@@ -131,5 +131,28 @@ describe ChainGang do
|
|
131
131
|
@proxy.each {}
|
132
132
|
end
|
133
133
|
end
|
134
|
+
|
135
|
+
describe "#format" do
|
136
|
+
before do
|
137
|
+
@proxy = Client.find
|
138
|
+
@client = @proxy.send(:value, :client)
|
139
|
+
end
|
140
|
+
|
141
|
+
it "should not change client.format" do
|
142
|
+
old_fmt = @client.format.extension
|
143
|
+
@proxy.execute
|
144
|
+
@proxy.send(:value, :format).should be_nil
|
145
|
+
@client.format.extension.should == old_fmt
|
146
|
+
end
|
147
|
+
|
148
|
+
it "should set format" do
|
149
|
+
old_fmt = @client.format.extension
|
150
|
+
Client.should_receive(:find_without_chaingang).and_return("world".to_json)
|
151
|
+
|
152
|
+
@proxy.from("/hello").format(:json).execute
|
153
|
+
@proxy.send(:value, :format).should == :json
|
154
|
+
@client.format.extension.should == old_fmt
|
155
|
+
end
|
156
|
+
end
|
134
157
|
end
|
135
158
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chaingang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 21
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matt Parker
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-02-23 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -24,28 +24,66 @@ dependencies:
|
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
hash: 7
|
30
30
|
segments:
|
31
|
-
-
|
32
|
-
-
|
33
|
-
version: "
|
31
|
+
- 3
|
32
|
+
- 0
|
33
|
+
version: "3.0"
|
34
34
|
type: :runtime
|
35
35
|
version_requirements: *id001
|
36
|
-
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 31
|
45
|
+
segments:
|
46
|
+
- 2
|
47
|
+
- 4
|
48
|
+
- 0
|
49
|
+
version: 2.4.0
|
50
|
+
type: :development
|
51
|
+
version_requirements: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: dupe
|
54
|
+
prerelease: false
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 7
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
- 6
|
64
|
+
- 0
|
65
|
+
version: 0.6.0
|
66
|
+
type: :development
|
67
|
+
version_requirements: *id003
|
68
|
+
description: A chainable API (like Arel) for ActiveResource.
|
37
69
|
email: moonmaster9000@gmail.com
|
38
70
|
executables: []
|
39
71
|
|
40
72
|
extensions: []
|
41
73
|
|
42
74
|
extra_rdoc_files:
|
43
|
-
-
|
75
|
+
- readme.md
|
44
76
|
files:
|
77
|
+
- .gitignore
|
78
|
+
- Gemfile
|
79
|
+
- PUBLIC_DOMAIN
|
80
|
+
- Rakefile
|
81
|
+
- VERSION
|
82
|
+
- chaingang.gemspec
|
45
83
|
- lib/chaingang.rb
|
46
84
|
- lib/chaingang/chaingang.rb
|
47
85
|
- lib/chaingang/proxy.rb
|
48
|
-
-
|
86
|
+
- readme.md
|
49
87
|
- spec/chaingang/proxy_spec.rb
|
50
88
|
- spec/spec_helper.rb
|
51
89
|
has_rdoc: true
|
@@ -78,10 +116,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
116
|
requirements: []
|
79
117
|
|
80
118
|
rubyforge_project:
|
81
|
-
rubygems_version: 1.
|
119
|
+
rubygems_version: 1.6.2
|
82
120
|
signing_key:
|
83
121
|
specification_version: 3
|
84
|
-
summary: A chainable API for ActiveResource.
|
122
|
+
summary: A chainable API (like Arel) for ActiveResource.
|
85
123
|
test_files:
|
86
124
|
- spec/chaingang/proxy_spec.rb
|
87
125
|
- spec/spec_helper.rb
|
data/LICENSE
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
PUBLIC DOMAIN
|