Class CloudKit::OAuthStore

  1. lib/cloudkit/oauth_store.rb
Parent: Object

An OAuthStore is a thin abstraction around CloudKit::Store, providing consistent collection names, and allowing automatic upgrades in later releases if needed.

Methods

public class

  1. new

public instance

  1. load_static_consumer
  2. version

Public class methods

new ()

Initialize a Store for use with OAuth middleware. Load the static consumer resource if it does not exist.

[show source]
    # File lib/cloudkit/oauth_store.rb, line 11
11:     def initialize
12:       @@store = Store.new(
13:         :collections => [
14:           :cloudkit_oauth_nonces,
15:           :cloudkit_oauth_tokens,
16:           :cloudkit_oauth_request_tokens,
17:           :cloudkit_oauth_consumers]
18:         ) unless @@store
19:       load_static_consumer
20:     end

Public instance methods

load_static_consumer ()

Load the static consumer entity if it does not already exist. See the OAuth Discovery spec for more info on static consumers.

[show source]
    # File lib/cloudkit/oauth_store.rb, line 43
43:     def load_static_consumer
44:       json = JSON.generate(:secret => '')
45:       @@store.put(CloudKit::URI.new('/cloudkit_oauth_consumers/cloudkitconsumer'), :json => json)
46:     end
version ()

Return the version number for this store.

[show source]
    # File lib/cloudkit/oauth_store.rb, line 39
39:     def version; 1; end