ananke 1.0.5 → 1.0.6

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.
@@ -33,7 +33,8 @@ module Ananke
33
33
  def make_response_item(path, mod, link_list, link_to_list, obj, key)
34
34
  id = get_id(obj, key)
35
35
  out :info, "#{path} - Cannot find key(#{key}) on object #{obj}" if !id
36
- dic = {path.to_sym => obj}
36
+ #dic = {path.to_sym => obj}
37
+ dic = Serialize.to_h(obj)
37
38
  links = build_links(link_list, link_to_list, path, id, mod) if Ananke.settings[:links]
38
39
  dic[:links] = links if links && !links.empty?
39
40
  dic
@@ -45,8 +46,8 @@ module Ananke
45
46
 
46
47
  #dic = result_list.empty? ? {} : {"#{path}_list".to_sym => result_list}
47
48
  dic = result_list.empty? ? {} : {"items".to_sym => result_list}
48
- link_self = build_link_self(path, '') if Ananke.settings[:links]
49
- dic[:links] = link_self if link_self
49
+ #link_self = build_link_self(path, '') if Ananke.settings[:links]
50
+ #dic[:links] = link_self if link_self
50
51
 
51
52
  Serialize.to_j(dic)
52
53
  else
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ananke
2
- VERSION = "1.0.5"
2
+ VERSION = "1.0.6"
3
3
  end
@@ -70,7 +70,7 @@ describe 'Basic Ananke REST' do
70
70
  """ do
71
71
  get "/user"
72
72
  check_status(200)
73
- last_response.body.should == '{"items":[{"user":{"user_id":1,"username":"one"}},{"user":{"user_id":2,"username":"two"}}]}'
73
+ last_response.body.should == '{"items":[{"user_id":1,"username":"one"},{"user_id":2,"username":"two"}]}'
74
74
  end
75
75
 
76
76
  it """
@@ -81,7 +81,7 @@ describe 'Basic Ananke REST' do
81
81
  """ do
82
82
  get "/user/1"
83
83
  check_status(200)
84
- last_response.body.should == '{"user":{"user_id":1,"username":"one"}}'
84
+ last_response.body.should == '{"user_id":1,"username":"one"}'
85
85
  end
86
86
 
87
87
  it """
@@ -26,6 +26,6 @@ describe 'Link-To Resource' do
26
26
 
27
27
  get "/link_to/1"
28
28
  check_status(200)
29
- last_response.body.should == '{"link_to":{"link_id":"1"},"links":[{"rel":"self","uri":"/link_to/1"},{"rel":"to","uri":"/to/link_to/1"}]}'
29
+ last_response.body.should == '{"link_id":"1","links":[{"rel":"self","uri":"/link_to/1"},{"rel":"to","uri":"/to/link_to/1"}]}'
30
30
  end
31
31
  end
@@ -26,7 +26,7 @@ describe 'Resource' do
26
26
 
27
27
  post "/self", body={:user_id => 1, :username => '1234'}
28
28
  check_status(201)
29
- last_response.body.should == '{"self":{"user_id":1},"links":[{"rel":"self","uri":"/self/1"}]}'
29
+ last_response.body.should == '{"user_id":1,"links":[{"rel":"self","uri":"/self/1"}]}'
30
30
 
31
31
  hash = JSON.parse(last_response.body)
32
32
  uri = hash['links'].map{|l| l['uri'] if l['rel'] == 'self'}[0]
@@ -69,7 +69,7 @@ describe 'Resource' do
69
69
  """ do
70
70
  post "/linked", body={:user_id => 1, :username => '1234'}
71
71
  check_status(201)
72
- last_response.body.should == '{"linked":{"user_id":1},"links":[{"rel":"self","uri":"/linked/1"},{"rel":"line","uri":"/line/1"},{"rel":"line","uri":"/line/2"}]}'
72
+ last_response.body.should == '{"user_id":1,"links":[{"rel":"self","uri":"/linked/1"},{"rel":"line","uri":"/line/1"},{"rel":"line","uri":"/line/2"}]}'
73
73
 
74
74
  hash = JSON.parse(last_response.body)
75
75
  hash['links'].each do |l|
@@ -81,7 +81,7 @@ describe 'Resource' do
81
81
  it "Should return links on Get One" do
82
82
  get "/linked/1"
83
83
  check_status(200)
84
- last_response.body.should == '{"linked":{"user_id":1},"links":[{"rel":"self","uri":"/linked/1"},{"rel":"line","uri":"/line/1"},{"rel":"line","uri":"/line/2"}]}'
84
+ last_response.body.should == '{"user_id":1,"links":[{"rel":"self","uri":"/linked/1"},{"rel":"line","uri":"/line/1"},{"rel":"line","uri":"/line/2"}]}'
85
85
  end
86
86
 
87
87
  it """
@@ -102,6 +102,6 @@ describe 'Resource' do
102
102
 
103
103
  post "/linked_fail", body={:user_id => 1, :username => '1234'}
104
104
  check_status(201)
105
- last_response.body.should == '{"linked_fail":{"user_id":1},"links":[{"rel":"self","uri":"/linked_fail/1"}]}'
105
+ last_response.body.should == '{"user_id":1,"links":[{"rel":"self","uri":"/linked_fail/1"}]}'
106
106
  end
107
107
  end
@@ -26,7 +26,7 @@ describe 'Resource Route-For' do
26
26
 
27
27
  get "/route_for/custom/1"
28
28
  check_status(200)
29
- last_response.body.should == '{"items":[{"route_for":{"route_for_id":"1","content":"Test"},"links":[{"rel":"self","uri":"/route_for/1"}]}],"links":[{"rel":"self","uri":"/route_for/custom/1"}]}'
29
+ last_response.body.should == '{"items":[{"route_for_id":"1","content":"Test","links":[{"rel":"self","uri":"/route_for/1"}]}]}'
30
30
  end
31
31
 
32
32
  it """
@@ -46,7 +46,7 @@ describe 'Resource Route-For' do
46
46
 
47
47
  post "/route_for/multi", body={:id => 1, :name => 'some name'}
48
48
  check_status(200)
49
- last_response.body.should == '{"items":[{"route_for":{"route_for_id":"1","content":"Test"},"links":[{"rel":"self","uri":"/route_for/1"}]}],"links":[{"rel":"self","uri":"/route_for/multi"}]}'
49
+ last_response.body.should == '{"items":[{"route_for_id":"1","content":"Test","links":[{"rel":"self","uri":"/route_for/1"}]}]}'
50
50
  end
51
51
 
52
52
  it """
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ananke
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.5
5
+ version: 1.0.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Andries Coetzee
@@ -130,7 +130,7 @@ licenses: []
130
130
  post_install_message: |
131
131
  **************************************************
132
132
 
133
- Thank you for installing ananke-1.0.5
133
+ Thank you for installing ananke-1.0.6
134
134
 
135
135
  Please be sure to look at README.rdoc to see what might have changed
136
136
  since the last release and how to use this GEM.
@@ -159,7 +159,7 @@ rubyforge_project:
159
159
  rubygems_version: 1.5.0
160
160
  signing_key:
161
161
  specification_version: 3
162
- summary: ananke-1.0.5
162
+ summary: ananke-1.0.6
163
163
  test_files:
164
164
  - spec/dumping.rb
165
165
  - spec/cov_adapter.rb