class Hoodoo::Client::Endpoint::AutoSession

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:

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

Public Instance Methods

create( body_hash, query_hash = nil ) click to toggle source

See Hoodoo::Client::Endpoint#create.

# 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 ) click to toggle source

See Hoodoo::Client::Endpoint#delete.

# 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 ) click to toggle source

See Hoodoo::Client::Endpoint#list.

# 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 ) click to toggle source

See Hoodoo::Client::Endpoint#show.

# 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 ) click to toggle source

See Hoodoo::Client::Endpoint#update.

# 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

Protected Instance Methods

configure_with( resource, version, options ) click to toggle source

See Hoodoo::Client::Endpoint#configure_with.

Configuration option keys which must be supplied are:

caller_id

The UUID of the Caller instance to be used for session creation.

caller_secret

The authentication secret of the Caller instance to be used for session creation.

+session_endpoint

A Hooodo::Client::Endpoint subclass which can be used for talking to the Session endpoint (for obvious reasons!).

discovery_result

A Hoodoo::Services::Discovery::ForRemote instance describing the required, remotely available resource endpoint.

The pattern for creating and using this instance is:

  • Discover the location of the remote resource.

  • Use the discovery result to build an appropriate Endpoint subclass instance, e.g. Hoodoo::Client::Endpoint::HTTP.

  • Create a Hoodoo::Services::Discovery::ForRemote instance which describes the above endpoint via the wrapped_endpoint option.

  • Build an instance of this auto-session Endpoint subclass, giving it the above object as the discovery_result.

  • Use this endpoint in the normal fashion. All the special mechanics of session management are handled here.

# File lib/hoodoo/client/endpoint/endpoints/auto_session.rb, line 71
def configure_with( resource, version, options )
  @caller_id        = options[ :caller_id        ]
  @caller_secret    = options[ :caller_secret    ]
  @session_endpoint = options[ :session_endpoint ]
  @wrapped_endpoint = @discovery_result.wrapped_endpoint
end