module SyncwiseApi

taken lock, stock and 2 smoking barrels from rails / activesupport / lib / active_support / inflector / inflections.rb thanks again, rails team!

holds 'inflector methods' (to use a Rails term) to change 'words' from one form to another

using Net::Http to make requests to avoid external gem dependencies

Constants

LOGGER
VERSION

Public Class Methods

make_request(action_code, params) click to toggle source
# File lib/syncwise_api.rb, line 19
def make_request(action_code, params)
  if @clients
    @clients.with do |client|
      client.make_request(action_code, params)
    end
  else
    puts 'You must first call SyncwiseAPI.start(username, password) before you can call SyncwiseApi.make_request.'
  end
end
start(username, password, number_of_clients = 1) click to toggle source
# File lib/syncwise_api.rb, line 15
def start(username, password, number_of_clients = 1)
  @clients ||= ConnectionPool.new(size: number_of_clients, timeout: 5) { SyncwiseApi::Client.new(username, password)}
end

Private Instance Methods

make_request(action_code, params) click to toggle source
# File lib/syncwise_api.rb, line 19
def make_request(action_code, params)
  if @clients
    @clients.with do |client|
      client.make_request(action_code, params)
    end
  else
    puts 'You must first call SyncwiseAPI.start(username, password) before you can call SyncwiseApi.make_request.'
  end
end
start(username, password, number_of_clients = 1) click to toggle source
# File lib/syncwise_api.rb, line 15
def start(username, password, number_of_clients = 1)
  @clients ||= ConnectionPool.new(size: number_of_clients, timeout: 5) { SyncwiseApi::Client.new(username, password)}
end