Class: CloudKit::UserStore

Inherits:
Object show all
Defined in:
lib/cloudkit/user_store.rb

Overview

A thin layer on top of CloudKit::Store providing consistent URIs and automatic upgrades if required for future releases.

Constant Summary collapse

@@store =
nil

Instance Method Summary collapse

Constructor Details

#initialize(uri = nil) ⇒ UserStore

Returns a new instance of UserStore.



8
9
10
11
12
# File 'lib/cloudkit/user_store.rb', line 8

def initialize(uri=nil)
  unless @@store
    @@store = Store.new(:collections => [:cloudkit_users])
  end
end

Instance Method Details

#delete(uri, options = {}) ⇒ Object

:nodoc:



26
27
28
# File 'lib/cloudkit/user_store.rb', line 26

def delete(uri, options={}) #:nodoc:
  @@store.delete(CloudKit::URI.new(uri), options)
end

#get(uri, options = {}) ⇒ Object

:nodoc:



14
15
16
# File 'lib/cloudkit/user_store.rb', line 14

def get(uri, options={}) #:nodoc:
  @@store.get(CloudKit::URI.new(uri), options)
end

#post(uri, options = {}) ⇒ Object

:nodoc:



18
19
20
# File 'lib/cloudkit/user_store.rb', line 18

def post(uri, options={}) #:nodoc:
  @@store.post(CloudKit::URI.new(uri), options)
end

#put(uri, options = {}) ⇒ Object

:nodoc:



22
23
24
# File 'lib/cloudkit/user_store.rb', line 22

def put(uri, options={}) #:nodoc:
  @@store.put(CloudKit::URI.new(uri), options)
end

#resolve_uris(uris) ⇒ Object

:nodoc:



30
31
32
# File 'lib/cloudkit/user_store.rb', line 30

def resolve_uris(uris) #:nodoc:
  @@store.resolve_uris(uris.map { |uri| CloudKit::URI.new(uri) })
end

#versionObject

Return the version for this UserStore



35
# File 'lib/cloudkit/user_store.rb', line 35

def version; 1; end