betty_resource 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a99e0f9122d86d44fa23ea2eff52e2e96482487a
4
- data.tar.gz: ab481d3b4677f148cbc359f71cd119912961e3d4
3
+ metadata.gz: 148310e456e98182ff24114e871e89ebd2c50338
4
+ data.tar.gz: 1e661ff1d9ccae22628624b9256b12ebe82a1b8b
5
5
  SHA512:
6
- metadata.gz: 25801637ce2b747faf20f263e7ec252bf3a384d5a4608411f28f906c744ea26b3e70e0ee8d158216d7e6cb4384ea115b6e198026190534734f2614f6628ca2a6
7
- data.tar.gz: 54566dd55c8c745c3aadec88c6593369ce2836cd58cf6ab5832b2904a12a9b736cb2d60d9d6cbe8ed163de14b533e7f45f94d834d43a2ac1d42840e8ba1b58b6
6
+ metadata.gz: 0b73a5412fba2fa5580b61ea7e8929e16a1df55acb1de9a381959a1272ae5adfcb53959c233c0fb23f09a7a373c8946311751db891badc894d7cb6340dab8d73
7
+ data.tar.gz: d4e0067aed266f7e49312eb307197076d0a4cd2dfe864ffa06c04ec82a4ec05f1bbdf3c4a6fa3cf50acfeecbd876be1334f1b79a641351d5da7ffeea7f0e5d86
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,11 @@
1
1
  = BettyResource CHANGELOG
2
2
 
3
+ === 0.0.11 / 2013-09-26
4
+
5
+ * 1 bugfix:
6
+
7
+ * Set content-type header to application/json when posting
8
+
3
9
  === 0.0.10 / 2013-05-14
4
10
 
5
11
  * 1 bugfix:
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Code Climate](https://codeclimate.com/github/bettyblocks/betty_resource.png)](https://codeclimate.com/github/bettyblocks/betty_resource)
2
+
1
3
  # BettyResource
2
4
 
3
5
  Map Betty5 application resources to Ruby objects through the JSON API!
@@ -90,4 +92,4 @@ For support, remarks and requests, please mail us at [support@bettyblocks.com](m
90
92
 
91
93
  Copyright (c) 2013 BettyBlocks B.V.
92
94
 
93
- [http://bettyblocks.com](http://bettyblocks.com) - [info@bettyblocks.com](mailto:info@bettyblocks.com)
95
+ [http://bettyblocks.com](http://bettyblocks.com) - [info@bettyblocks.com](mailto:info@bettyblocks.com)
@@ -69,7 +69,7 @@ module BettyResource
69
69
  end
70
70
  end
71
71
 
72
- (result.code.to_s[0..1] == "20").tap do |success|
72
+ result.success?.tap do |success|
73
73
  if success
74
74
  model.send :load, result.parsed_response, self
75
75
  else
@@ -92,7 +92,7 @@ module BettyResource
92
92
  private
93
93
 
94
94
  def to_params
95
- {:body => {:record => attributes_as_json}}
95
+ {:body => {:record => attributes_as_json}, :headers => {"Content-Type" => "application/json"}}
96
96
  end
97
97
 
98
98
  # TODO: Test this update
@@ -1,7 +1,7 @@
1
1
  module BettyResource
2
2
  MAJOR = 0
3
3
  MINOR = 0
4
- TINY = 10
4
+ TINY = 11
5
5
 
6
6
  VERSION = [MAJOR, MINOR, TINY].join(".")
7
7
  end
@@ -58,7 +58,7 @@ module Unit
58
58
  assert_equal({"id" => nil, "first_name" => "Paul", "last_name" => "Engel"}, relation.as_json)
59
59
 
60
60
  relation = BettyResource::Relation.get(1)
61
- assert_equal({"id" => 1, "first_name" => "Daniel", "last_name" => "Willemse", "group"=>{"id"=>1}}, relation.as_json)
61
+ assert_equal({"id" => 1, "first_name" => "Daniel", "last_name" => "Willemse", "group"=>{"id"=>1, "name" => "group one"}}, relation.as_json)
62
62
  assert_equal({"id" => 1, "name" => "group one"}, relation.group.as_json)
63
63
  end
64
64
 
@@ -72,6 +72,15 @@ module Unit
72
72
  assert_equal "Kaag", relation.last_name
73
73
  end
74
74
 
75
+ it "should save itself when an %-character is used" do
76
+ relation = BettyResource::Relation.new(:first_name => "Stephan%")
77
+ assert relation.save
78
+ assert relation.id > 0
79
+
80
+ relation = BettyResource::Relation.get(relation.id)
81
+ assert_equal "Stephan%", relation.first_name
82
+ end
83
+
75
84
  it "should not save itself when invalid (first_name is required)" do
76
85
  relation = BettyResource::Relation.new
77
86
  assert !relation.save
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: betty_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chiel Wester
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-05-14 00:00:00.000000000 Z
14
+ date: 2013-09-26 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: httparty
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
146
  version: '0'
147
147
  requirements: []
148
148
  rubyforge_project:
149
- rubygems_version: 2.0.0
149
+ rubygems_version: 2.0.3
150
150
  signing_key:
151
151
  specification_version: 4
152
152
  summary: Map Betty5 application resources to Ruby objects
@@ -156,3 +156,4 @@ test_files:
156
156
  - test/unit/test_base.rb
157
157
  - test/unit/test_configuration.rb
158
158
  - test/unit/test_model.rb
159
+ has_rdoc: