Class: OpenCoinage::XMLRPC::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/opencoinage/xmlrpc/client.rb

Overview

An OpenCoinage XML-RPC API client implementation.

See Also:

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Client) initialize(url, options = {})

Initializes the XML-RPC client.

Parameters:

  • (String, #to_s) url

    a valid URL specifying the XML-RPC endpoint

  • (Hash{Symbol => Object}) options (defaults to: {})


16
17
18
# File 'lib/opencoinage/xmlrpc/client.rb', line 16

def initialize(url, options = {})
  @url, @options = RDF::URI(url), options.dup
end

Instance Attribute Details

- (RDF::URI) url (readonly)

The URL for the XML-RPC endpoint.

Returns:

  • (RDF::URI)


24
25
26
# File 'lib/opencoinage/xmlrpc/client.rb', line 24

def url
  @url
end

Instance Method Details

- (Hash) describe(token)

Returns information about the given token.

Parameters:

  • (Token) token

    the token to describe

Returns:

  • (Hash)

    a key-value mapping describing the token

Raises:

  • (NotImplementedError)

See Also:



53
54
55
# File 'lib/opencoinage/xmlrpc/client.rb', line 53

def describe(token)
  raise NotImplementedError, "#{self.class}#describe"
end

- (Token) reissue(token, identifier = nil)

Issues a new token equivalent to the given token.

Parameters:

  • (Token) token

    the valid token to reissue

  • (Integer) identifier (defaults to: nil)

    a unique identifier for the new token

Returns:

  • (Token)

    a new token

Raises:

  • (NotImplementedError)

See Also:



66
67
68
# File 'lib/opencoinage/xmlrpc/client.rb', line 66

def reissue(token, identifier = nil)
  raise NotImplementedError, "#{self.class}#reissue"
end

- (Boolean) verify(token)

Returns true if the given token is valid, false otherwise.

Parameters:

  • (Token) the

    token to verify

Returns:

  • (Boolean)

    true or false

Raises:

  • (NotImplementedError)

See Also:



42
43
44
# File 'lib/opencoinage/xmlrpc/client.rb', line 42

def verify(token)
  raise NotImplementedError, "#{self.class}#verify"
end

- (String) version

Returns the server's version number.

Returns:

  • (String)

    an "x.y.z" version number string

Raises:

  • (NotImplementedError)

See Also:



31
32
33
# File 'lib/opencoinage/xmlrpc/client.rb', line 31

def version
  raise NotImplementedError, "#{self.class}#version"
end