Module: FreeAgent

Defined in:
lib/free_agent.rb,
lib/free_agent/base.rb,
lib/free_agent/bill.rb,
lib/free_agent/task.rb,
lib/free_agent/contact.rb,
lib/free_agent/invoice.rb,
lib/free_agent/project.rb,
lib/free_agent/version.rb,
lib/free_agent/attachment.rb,
lib/free_agent/bank_account.rb,
lib/free_agent/invoice_item.rb

Defined Under Namespace

Modules: Version Classes: Attachment, BankAccount, Base, Bill, Contact, Invoice, InvoiceItem, Project, Task

Constant Summary collapse

BASE_URI =
"https://%s.freeagentcentral.com"
VERSION =

The current library version.

Version::STRING

Class Method Summary collapse

Class Method Details

.configure {|self| ... } ⇒ void

This method returns an undefined value.

Sets the client configuration.

Examples:

FreeAgent.configure do |config|
  config.username   = "[email protected]"
  config.password   = "letmein"
  config.subdomain  = "example"
end

Yields:

  • (self)


41
42
43
44
45
46
47
48
# File 'lib/free_agent.rb', line 41

def configure
  if block_given?
    yield self
  else
    raise LocalJumpError, "Required configuration block"
    # TODO: allow users to pass configuration using an environment variable
  end
end

.configured?Boolean

Checks if the client is properly configured.

Returns:

  • (Boolean)


24
25
26
# File 'lib/free_agent.rb', line 24

def configured?
  Base.user && Base.password && Base.site
end

.password=(value) ⇒ Object



55
56
57
# File 'lib/free_agent.rb', line 55

def password=(value)
  Base.password = value
end

.subdomain=(value) ⇒ Object



59
60
61
# File 'lib/free_agent.rb', line 59

def subdomain=(value)
  Base.site = value.blank? ? nil : (BASE_URI % value)
end

.username=(value) ⇒ Object



51
52
53
# File 'lib/free_agent.rb', line 51

def username=(value)
  Base.user = value
end