restpack-resource 0.1.1 → 0.1.2

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- restpack-resource (0.1.0)
4
+ restpack-resource (0.1.1)
5
5
  activesupport (~> 3.2.11)
6
6
  datamapper (~> 1.2.0)
7
7
  dm-pager (~> 1.1.0)
@@ -22,6 +22,7 @@ module RestPack
22
22
  protected
23
23
 
24
24
  def get_paged_resource(options)
25
+ p "options: #{options}"
25
26
  paged_models = get_paged_models(options)
26
27
 
27
28
  paged_resource = {
@@ -18,6 +18,7 @@ module RestPack
18
18
  protected
19
19
 
20
20
  def get_single_resource(options)
21
+ p "options: #{options}"
21
22
  model = self.get(options[:id])
22
23
 
23
24
  raise "404" unless model #TODO: GJ: decide on error handling / status
@@ -1,5 +1,5 @@
1
1
  module RestPack
2
2
  module Resource
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -16,7 +16,7 @@ describe RestPack::Resource do
16
16
  end
17
17
 
18
18
  it "should filter results" do
19
- result = Song.paged_resource(:filters => { artist_id: @artist.id } )
19
+ result = Song.paged_resource(filters: { artist_id: @artist.id } )
20
20
  result[:count].should == 3
21
21
  end
22
22
  end
@@ -40,13 +40,13 @@ describe RestPack::Resource do
40
40
 
41
41
  context "when side-loading" do
42
42
  it "should return related entities with their #as_resource representation" do
43
- result = Song.paged_resource(:includes => [:users])
43
+ result = Song.paged_resource(includes: [:users])
44
44
  result[:users][0][:custom].should == 'This is custom data'
45
45
  end
46
46
 
47
47
  it "should not allow invalid relations" do
48
48
  expect do
49
- Artist.paged_resource(:includes => [:invalid_relations])
49
+ Artist.paged_resource(includes: [:invalid_relations])
50
50
  end.to raise_error(RestPack::Resource::InvalidInclude, "Artist.invalid_relations is not an includable relation")
51
51
  end
52
52
 
@@ -54,19 +54,19 @@ describe RestPack::Resource do
54
54
  context "ManyToOne" do
55
55
  it "should not allow includes that have not been specified with 'resource_can_include'" do
56
56
  expect do
57
- Comment.paged_resource(:includes => [:songs])
57
+ Comment.paged_resource(includes: [:songs])
58
58
  end.to raise_error(RestPack::Resource::InvalidInclude, "Comment.songs is not an includable relation")
59
59
  end
60
60
 
61
61
  it "should return related entities from a 'belongs_to' relationship" do
62
- result = Song.paged_resource(:includes => [:artists])
62
+ result = Song.paged_resource(includes: [:artists])
63
63
  result.should_not == nil
64
64
  result[:artists].should_not == nil
65
65
  result[:artists].size.should == 10
66
66
  end
67
67
 
68
68
  it "should allow multiple includes" do
69
- result = Song.paged_resource(:includes => [:artists, :users])
69
+ result = Song.paged_resource(includes: [:artists, :users])
70
70
  result.should_not == nil
71
71
  result[:artists].should_not == nil
72
72
  result[:artists].size.should == 10
@@ -82,7 +82,7 @@ describe RestPack::Resource do
82
82
  end
83
83
 
84
84
  it "should return related entities from a 'has n' relationship" do
85
- result = Artist.paged_resource(:includes => [:songs])
85
+ result = Artist.paged_resource(includes: [:songs])
86
86
  result.should_not == nil
87
87
  result[:songs].should_not == nil
88
88
  result[:songs].size.should == 11
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restpack-resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: