Class: Tracker::Jira::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/tracker/jira/host.rb

Overview

This wrapper around XMLRPC::Client that allows simpler method calls via method_missing and doesn’t require to manage the token

Instance Method Summary collapse

Constructor Details

#initialize(client, token) ⇒ Session

Returns a new instance of Session.



29
30
31
# File 'lib/tracker/jira/host.rb', line 29

def initialize(client, token)
  @client, @token = client, token
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, args, &block) ⇒ Object



33
34
35
36
37
# File 'lib/tracker/jira/host.rb', line 33

def method_missing(sym, args, &block)
  token_args = [@token] << args
  xmlrpc_method = "#{Host::JIRA_API}.#{sym.to_s}"
  @client.call(xmlrpc_method, *token_args)
end