Class: ShopifyApp::SessionRepository

Inherits:
Object
  • Object
show all
Defined in:
lib/shopify_app/session/session_repository.rb

Defined Under Namespace

Classes: ConfigurationError

Class Method Summary collapse

Class Method Details

.retrieve(id) ⇒ Object


14
15
16
# File 'lib/shopify_app/session/session_repository.rb', line 14

def retrieve(id)
  storage.retrieve(id)
end

.storageObject


22
23
24
# File 'lib/shopify_app/session/session_repository.rb', line 22

def storage
  load_storage || raise(ConfigurationError.new("ShopifySessionRepository.storage is not configured!"))
end

.storage=(storage) ⇒ Object


6
7
8
9
10
11
12
# File 'lib/shopify_app/session/session_repository.rb', line 6

def storage=(storage)
  @storage = storage

  unless storage.nil? || self.storage.respond_to?(:store) && self.storage.respond_to?(:retrieve)
    raise ArgumentError, "storage must respond to :store and :retrieve"
  end
end

.store(session) ⇒ Object


18
19
20
# File 'lib/shopify_app/session/session_repository.rb', line 18

def store(session)
  storage.store(session)
end