Talk to a resource that is contacted over HTTP or HTTPS.

Configured with a Hoodoo::Services::Discovery::ForHTTP discovery result instance.

Methods
C
D
L
S
U
Instance Public methods
create( body_hash, query_hash = nil )
# File lib/hoodoo/client/endpoint/endpoints/http.rb, line 85
def create( body_hash, query_hash = nil )
  d            = @description.dup
  d.action     = :create
  d.body_hash  = body_hash
  d.query_hash = query_hash

  return do_http( d )
end
delete( ident, query_hash = nil )
# File lib/hoodoo/client/endpoint/endpoints/http.rb, line 108
def delete( ident, query_hash = nil )
  d            = @description.dup
  d.action     = :delete
  d.ident      = ident
  d.query_hash = query_hash

  return do_http( d )
end
list( query_hash = nil )
# File lib/hoodoo/client/endpoint/endpoints/http.rb, line 49
def list( query_hash = nil )
  d            = @description.dup # This does NOT dup the objects to which @description points
  d.action     = :list
  d.query_hash = query_hash

  return inject_enumeration_state( do_http( d ), query_hash )
end
show( ident, query_hash = nil )

See Hoodoo::Client::Endpoint#show.

In RESTful HTTP, `GET /resources/#{ident = nil}` gets evaluated as `GET /resources/`, which is of course interpreted as a list request. Since this is undesirable behaviour, the ident must be populated, and this will return `404 Not Found` if it is not.

# File lib/hoodoo/client/endpoint/endpoints/http.rb, line 64
def show( ident, query_hash = nil )
  if ident.nil?
    data = response_class_for( :show ).new
    data.platform_errors.add_error(
      'platform.not_found',
      'reference' => {entity_name: 'nil identifier given on :show action'}
    )

    return data
  end

  d            = @description.dup
  d.action     = :show
  d.ident      = ident
  d.query_hash = query_hash

  return do_http( d )
end
update( ident, body_hash, query_hash = nil )
# File lib/hoodoo/client/endpoint/endpoints/http.rb, line 96
def update( ident, body_hash, query_hash = nil )
  d            = @description.dup
  d.action     = :update
  d.ident      = ident
  d.body_hash  = body_hash
  d.query_hash = query_hash

  return do_http( d )
end
Instance Protected methods
configure_with( resource, version, options )

See Hoodoo::Client::Endpoint#configure_with.

Requires a Hoodoo::Services::Discovery::ForHTTP instance in the discovery_result field of the options Hash.

# File lib/hoodoo/client/endpoint/endpoints/http.rb, line 31
def configure_with( resource, version, options )
  unless @discovery_result.is_a?( Hoodoo::Services::Discovery::ForHTTP )
    raise "Hoodoo::Client::Endpoint::HTTP must be configured with a Hoodoo::Services::Discovery::ForHTTP instance - got '#{ @discovery_result.class.name }'"
  end

  @description                   = Hoodoo::Client::Endpoint::HTTPBased::DescriptionOfRequest.new
  @description.discovery_result  = @discovery_result
  @description.endpoint_uri      = @discovery_result.endpoint_uri
  @description.proxy_uri         = @discovery_result.proxy_uri
  @description.ca_file           = @discovery_result.ca_file
  @description.http_timeout      = @discovery_result.http_timeout
  @description.http_open_timeout = @discovery_result.http_open_timeout
end