Class: Hoodoo::Client::Endpoint::AutoSession

Inherits:
Hoodoo::Client::Endpoint show all
Defined in:
lib/hoodoo/client/endpoint/endpoints/auto_session.rb

Overview

This endpoint wraps something which does actual communication but requires a session; it maintains a valid session for that wrapped endpoint automatically. It implements the following model:

  • It requires a Caller ID and Caller Authentication Secret to be instantiated (via the options parameter).

  • If there is no session ID available, it creates one using the above details. Otherwise, it tries to use the given session.

  • If a particular request leads to an ‘invalid session’ response, the request is marked for retry. A new session is obtained first, the retry happens and if it fails this time, the failure is returned to the caller.

Since it wraps another endpoint and requires Caller information to be able to build sessions, instantiation requirements are rather unusual

  • see #configure_with for details.

Instance Attribute Summary

Attributes inherited from Hoodoo::Client::Endpoint

#interaction, #locale, #resource, #session_id, #version

Instance Method Summary collapse

Methods inherited from Hoodoo::Client::Endpoint

endpoint_for, #initialize

Constructor Details

This class inherits a constructor from Hoodoo::Client::Endpoint

Instance Method Details

#create(body_hash, query_hash = nil) ⇒ Object

See Hoodoo::Client::Endpoint#create.



94
95
96
# File 'lib/hoodoo/client/endpoint/endpoints/auto_session.rb', line 94

def create( body_hash, query_hash = nil )
  return auto_retry( :create, body_hash, query_hash )
end

#delete(ident, query_hash = nil) ⇒ Object

See Hoodoo::Client::Endpoint#delete.



106
107
108
# File 'lib/hoodoo/client/endpoint/endpoints/auto_session.rb', line 106

def delete( ident, query_hash = nil )
  return auto_retry( :delete, ident, query_hash )
end

#list(query_hash = nil) ⇒ Object

See Hoodoo::Client::Endpoint#list.



82
83
84
# File 'lib/hoodoo/client/endpoint/endpoints/auto_session.rb', line 82

def list( query_hash = nil )
  return auto_retry( :list, query_hash )
end

#show(ident, query_hash = nil) ⇒ Object

See Hoodoo::Client::Endpoint#show.



88
89
90
# File 'lib/hoodoo/client/endpoint/endpoints/auto_session.rb', line 88

def show( ident, query_hash = nil )
  return auto_retry( :show, ident, query_hash )
end

#update(ident, body_hash, query_hash = nil) ⇒ Object

See Hoodoo::Client::Endpoint#update.



100
101
102
# File 'lib/hoodoo/client/endpoint/endpoints/auto_session.rb', line 100

def update( ident, body_hash, query_hash = nil )
  return auto_retry( :update, ident, body_hash, query_hash )
end