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 CHANGED
@@ -1 +1 @@
1
- 0.3.0
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
- # #always_with && #always_requires methods will set with/requires in
67
- # the prepare_resource method of Weary
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
- # new feature of Resources
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{weary}
5
- s.version = "0.3.0"
5
+ s.version = "0.3.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Mark Wunsch"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Wunsch