class Assonnato::Client

Attributes

cookies[R]
host[RW]
port[RW]

Public Class Methods

namespace(*names) click to toggle source
# File lib/assonnato/client.rb, line 23
def self.namespace(*names)
  options = names.last.is_a?(Hash) ? names.pop : {}
  names   = names.map(&:to_sym)
  name    = names.pop
  return if public_method_defined?(name)

  converted  = options.fetch(:full_name, name).to_s
  converted  = converted.split('_').map(&:capitalize).join
  class_name = ''
  class_name = "#{self.name.split('::').last}::" unless options.fetch(:root, false)
  class_name += converted

  define_method(name) do
    ApiFactory.new class_name, self
  end

  self
end
new(host = 'pigro.omnivium.it', port = 80, ssl = false) click to toggle source
# File lib/assonnato/client.rb, line 16
def initialize(host = 'pigro.omnivium.it', port = 80, ssl = false)
  @host    = host
  @port    = port
  @ssl     = ssl
  @cookies = CookieJar.new
end