class BacklogApi::Client
Constants
- HOST
- METHOD
- PATH
- PORT
- PROXY_HOST
- PROXY_PORT
- TIMEOUT
- USE_SSL
Attributes
client[RW]
host[RW]
password[RW]
space[RW]
user[RW]
Public Class Methods
new(user = nil , password = nil , space = nil)
click to toggle source
# File lib/backlog_api/client.rb, line 16 def initialize(user = nil , password = nil , space = nil) login_from_args(user, password, space) || login_from_netrc || login_from_environment_variables @client = XMLRPC::Client.new(@host, PATH, PORT, PROXY_HOST, PROXY_PORT, @user, @password, USE_SSL, TIMEOUT) end
Private Instance Methods
call(api_method, params = nil)
click to toggle source
# File lib/backlog_api/client.rb, line 32 def call(api_method, params = nil) if params @client.call(api_method, params) else @client.call(api_method) end end
login_from_args(user = nil, password = nil, space = nil)
click to toggle source
# File lib/backlog_api/client.rb, line 57 def login_from_args(user = nil, password = nil, space = nil) return unless user && password && space @user = user @password = password @space = space @host = HOST % @space end
login_from_environment_variables()
click to toggle source
# File lib/backlog_api/client.rb, line 49 def login_from_environment_variables return unless ENV["BACKLOG_USER"] && ENV["BACKLOG_PASSWORD"] && ENV["BACKLOG_SPACE"] @user = ENV["BACKLOG_USER"] @password = ENV["BACKLOG_PASSWORD"] @space = ENV["BACKLOG_SPACE"] @host = HOST % @space end
login_from_netrc()
click to toggle source
# File lib/backlog_api/client.rb, line 40 def login_from_netrc netrc = Net::Netrc.locate HOST.sub('.','') % '' return unless netrc @user = netrc.user @password = netrc.password @space = netrc.space @host = HOST % @space end