activeresource_json_patch 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CHANGELOG +3 -0
- data/VERSION +1 -1
- data/features/step_definitions/include_root_in_json_steps.rb +5 -2
- data/lib/activeresource_json_patch.rb +3 -2
- metadata +4 -3
data/.gitignore
CHANGED
data/CHANGELOG
ADDED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1
|
@@ -19,9 +19,12 @@ When /^I save the book$/ do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
Then /^ActiveResource should send the following back to the server:$/ do |book_body|
|
22
|
-
|
22
|
+
book_body = book_body.gsub(/^\s+/, "").gsub("\n", "").gsub(": \"", ":\"").gsub(": {", ":{").gsub(": [", ":[")
|
23
|
+
update_book = ActiveResource::Request.new(:put, @path, book_body)
|
23
24
|
updated_response = ActiveResource::Response.new("", 204, {"Location" => @path})
|
24
25
|
ActiveResource::HttpMock.respond_to({update_book => updated_response})
|
25
26
|
@book.save
|
26
|
-
|
27
|
+
found = false
|
28
|
+
ActiveResource::HttpMock.requests.each {|r| found = r.body == book_body }
|
29
|
+
found.should be_true
|
27
30
|
end
|
@@ -2,11 +2,12 @@ require 'active_resource'
|
|
2
2
|
|
3
3
|
module ActiveResource
|
4
4
|
class Base
|
5
|
+
self.include_root_in_json = false
|
6
|
+
|
5
7
|
def encode_with_json(options={})
|
6
8
|
case self.class.format
|
7
9
|
when ActiveResource::Formats[:json]
|
8
|
-
|
9
|
-
self.class.format.encode data
|
10
|
+
self.class.format.encode self.class.element_name => attributes
|
10
11
|
else
|
11
12
|
encode_without_json(options)
|
12
13
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeresource_json_patch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matt Parker
|
@@ -75,6 +75,7 @@ extra_rdoc_files:
|
|
75
75
|
- readme.md
|
76
76
|
files:
|
77
77
|
- .gitignore
|
78
|
+
- CHANGELOG
|
78
79
|
- Gemfile
|
79
80
|
- Gemfile.lock
|
80
81
|
- VERSION
|