vault-rails 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Vault
2
2
  module Rails
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.name = "vault-rails"
7
7
  s.version = Vault::Rails::VERSION
8
8
  s.authors = ["Jordan MacDonald"]
9
- s.email = ["jordan@wastedintelligence.com"]
9
+ s.email = ["jordan.macdonald@greatersudbury.ca"]
10
10
  s.homepage = 'https://github.com/cityofgreatersudbury/vault-rails'
11
11
  s.summary = 'CoffeeScript collection class for offline use.'
12
12
  s.description = 'Store and manage collections of objects without a connection.'
@@ -1,5 +1,5 @@
1
1
  class Vault
2
- constructor: (name, urls, options = {}) ->
2
+ constructor: (@name, @urls, options = {}) ->
3
3
  # Setup some internal variables.
4
4
  @objects = []
5
5
  @dirty_object_count = 0
@@ -13,10 +13,6 @@ class Vault
13
13
  # generate unique IDs for new records.
14
14
  @date = new Date
15
15
 
16
- # Import required parameters for the data store.
17
- @name = name
18
- @urls = urls
19
-
20
16
  # Declare default options.
21
17
  @options =
22
18
  autoload: true
@@ -202,12 +198,16 @@ class Vault
202
198
  # Find the object using the specified id.
203
199
  object = @find(id)
204
200
 
201
+ # Package up the object to be sent to the server.
202
+ packaged_object = {}
203
+ packaged_object[@name] = JSON.stringify @strip object
204
+
205
205
  switch object.status
206
206
  when "deleted"
207
207
  $.ajax
208
208
  type: 'DELETE'
209
209
  url: @urls.delete
210
- data: JSON.stringify @strip object
210
+ data: packaged_object
211
211
  fixture: (settings) ->
212
212
  return true
213
213
  success: (data) =>
@@ -228,7 +228,7 @@ class Vault
228
228
  $.ajax
229
229
  type: 'POST'
230
230
  url: @urls.create
231
- data: JSON.stringify @strip object
231
+ data: packaged_object
232
232
  fixture: (settings) =>
233
233
  settings.data.id = @date.getTime()
234
234
 
@@ -249,7 +249,7 @@ class Vault
249
249
  $.ajax
250
250
  type: 'POST'
251
251
  url: @urls.update
252
- data: JSON.stringify @strip object
252
+ data: packaged_object
253
253
  fixture: (settings) ->
254
254
  return true
255
255
  success: (data) =>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vault-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-21 00:00:00.000000000Z
12
+ date: 2011-11-22 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: Store and manage collections of objects without a connection.
15
15
  email:
16
- - jordan@wastedintelligence.com
16
+ - jordan.macdonald@greatersudbury.ca
17
17
  executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []