ruby_json_api_client 0.0.6 → 0.0.7

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: 5f4e6eb4c43b49c31d386896c2cb60215170ef95
4
- data.tar.gz: a97568320d8f72ed8d8df21cbbab841cde5afe05
3
+ metadata.gz: 8a76ad21204734d895e58f15133b82a449b8fadb
4
+ data.tar.gz: 8c00fc9611a86d4654ee295f9bfbb89f616a9beb
5
5
  SHA512:
6
- metadata.gz: 4ece60e0cdd009e363086a9853d936af57f76ed7c14b124b88c34ef9f27abd91a660842ef0ae91c042bd4a567869312021df9ea866acef8510900722a675ae1b
7
- data.tar.gz: dd90e2e84644c5f5cffe5682fd204db7cafa8cad6e25f8092edbb1e6c0907cc116d8a48da1eae661abd699365846c528e8fc68812b7dcd710c0cb4891876ee74
6
+ metadata.gz: a112581a8770b6740771c6a3a3475395915c925b55bc3420028caed7ec8629bf894fb67641333a83c6f19fbdc38099727562e30a34b62ac2972e2c8b7e9e282d
7
+ data.tar.gz: 16c1be8a3bffb30f4e173a9c6c13fe6dea6eb3838ab4a7812c090857bc297cccbfdad2089c578c9a6bfaba16d5711b361a751341ded1d2ff1930f58372c66d06
@@ -135,6 +135,18 @@ module RubyJsonApiClient
135
135
  !!send(self.class._identifier)
136
136
  end
137
137
 
138
+ def new_record?
139
+ !persisted?
140
+ end
141
+
142
+ def marked_for_destruction?
143
+ @marked_for_destruction
144
+ end
145
+
146
+ def _destroy
147
+ marked_for_destruction?
148
+ end
149
+
138
150
  def reload
139
151
  RubyJsonApiClient::Store.instance.reload(self)
140
152
  end
@@ -1,3 +1,3 @@
1
1
  module RubyJsonApiClient
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -69,6 +69,30 @@ describe RubyJsonApiClient::Base do
69
69
  end
70
70
  end
71
71
 
72
+ describe :new_record? do
73
+ it "should not be a new record if it has an id" do
74
+ person = Person.new
75
+ person.instance_variable_set(:@id, 1)
76
+ expect(person.new_record?).to eql(false)
77
+ end
78
+
79
+ it "should be a new record if there is no id" do
80
+ expect(Person.new.new_record?).to eql(true)
81
+ end
82
+ end
83
+
84
+ describe :marked_for_destruction? do
85
+ it "should return false by default" do
86
+ expect(!!Person.new.marked_for_destruction?).to eql(false)
87
+ end
88
+ end
89
+
90
+ describe :_destroy do
91
+ it "should return false by default" do
92
+ expect(!!Person.new._destroy).to eql(false)
93
+ end
94
+ end
95
+
72
96
  describe :== do
73
97
  context "two objects of different classes" do
74
98
  subject { Person.new(id: 1) == Item.new(id: 1) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_json_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Toronto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-19 00:00:00.000000000 Z
11
+ date: 2015-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json