class Manabu::Client

General client interface which bundles together most client functionality

Attributes

auth[RW]
status[RW]
transactor[RW]

Public Class Methods

new(username, password, host, port = 80, **options) click to toggle source

Initializes with login details and passes options to all linked instances.

Parameters:

username

The User Name or e-mail address

password

The password for the given user

host

The host URL

port

The host port (default 80)

options

A hash of options, such as:

  • force_secure_connection - (default true), set to false to disable HTTPS/SSL

  • transport_type - (default :msgpack), sets transport data type [:msgpack, :json]

# File lib/manabu/client.rb, line 24
def initialize(username, password, host, port = 80, **options)
  @status = :initializing
  @auth = Manabu::Connection::Auth.new(username, password, host, port, options)
  if @auth.success?
    @transactor = @auth.transactor
    @status = :connected
  else
    @status = :failed
    raise Error::Connection::Unauthorized
  end
end

Public Instance Methods

delete(path, **args) click to toggle source

Performs a DELETE against the API

Parameters:

path

The API endpoint path

args

An argument hash

Returns:

The returned data as an object
# File lib/manabu/client.rb, line 92
def delete(path, **args)
  @transactor.delete(path, args)
end
get(path, **args) click to toggle source

Performs a GET against the API

Parameters:

path

The API endpoint path

args

An argument hash

Returns:

The returned data as an object
# File lib/manabu/client.rb, line 50
def get(path, **args)
  @transactor.get(path, args)
end
patch(path, **args) click to toggle source

Performs a PATCH against the API

Parameters:

path

The API endpoint path

args

An argument hash

Returns:

The returned data as an object
# File lib/manabu/client.rb, line 78
def patch(path, **args)
  @transactor.patch(path, args)
end
post(path, **args) click to toggle source

Performs a POST against the API

Parameters:

path

The API endpoint path

args

An argument hash

Returns:

The returned data as an object
# File lib/manabu/client.rb, line 64
def post(path, **args)
  @transactor.post(path, args)
end
simple_get(endpoint) click to toggle source
# File lib/manabu/client.rb, line 36
def simple_get(endpoint)
  @transactor.simple_get(endpoint)
end