weary 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/weary.rb +5 -0
- data/spec/weary_spec.rb +16 -5
- data/weary.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/lib/weary.rb
CHANGED
@@ -71,6 +71,10 @@ module Weary
|
|
71
71
|
@password = password
|
72
72
|
return nil
|
73
73
|
end
|
74
|
+
|
75
|
+
def always_with(params)
|
76
|
+
@always_with = params
|
77
|
+
end
|
74
78
|
|
75
79
|
# Declare a resource. Use it with a block to setup the resource
|
76
80
|
#
|
@@ -120,6 +124,7 @@ module Weary
|
|
120
124
|
preparation.format = (@default_format || :json)
|
121
125
|
preparation.domain = @domain
|
122
126
|
preparation.url = (@url_pattern || "<domain><resource>.<format>")
|
127
|
+
preparation.with = @always_with unless @always_with.nil?
|
123
128
|
return preparation
|
124
129
|
end
|
125
130
|
|
data/spec/weary_spec.rb
CHANGED
@@ -62,12 +62,23 @@ describe Weary do
|
|
62
62
|
end
|
63
63
|
|
64
64
|
describe "Common Request Paramaters" do
|
65
|
-
it "should define with params that every resource inherits"
|
66
|
-
|
67
|
-
|
65
|
+
it "should define with params that every resource inherits" do
|
66
|
+
@test.on_domain "http://foo.bar"
|
67
|
+
@test.always_with [:login, :token]
|
68
|
+
r = @test.get "resource"
|
69
|
+
r.with.should == [:login, :token]
|
70
|
+
r.requires = [:foobar]
|
71
|
+
r.with.should == [:login, :token, :foobar]
|
72
|
+
end
|
68
73
|
|
69
|
-
it "should be able to be a hash"
|
70
|
-
|
74
|
+
it "should be able to be a hash" do
|
75
|
+
@test.on_domain "http://foo.bar"
|
76
|
+
@test.always_with :foo => "Foo", :bar => "Bar"
|
77
|
+
r = @test.get "resource"
|
78
|
+
r.with.should == {:foo => "Foo", :bar => "Bar"}
|
79
|
+
r.requires = [:foobar]
|
80
|
+
r.with.should == {:foo => "Foo", :bar => "Bar", :foobar => nil}
|
81
|
+
end
|
71
82
|
end
|
72
83
|
|
73
84
|
describe 'Resource Declaration' do
|
data/weary.gemspec
CHANGED