Module: Clearbooks

Defined in:
lib/clearbooks.rb,
lib/clearbooks/version.rb,
lib/clearbooks/model/base.rb,
lib/clearbooks/model/item.rb,
lib/clearbooks/error/errors.rb,
lib/clearbooks/model/entity.rb,
lib/clearbooks/model/ledger.rb,
lib/clearbooks/model/invoice.rb,
lib/clearbooks/model/journal.rb,
lib/clearbooks/model/payment.rb,
lib/clearbooks/model/project.rb,
lib/clearbooks/library/client.rb,
lib/clearbooks/model/account_code.rb,
lib/clearbooks/library/configuration.rb

Defined Under Namespace

Classes: AbstractFunction, AccountCode, ArgumentError, Base, ClearbooksError, ClearbooksfileNotFound, ClearbooksfileReadError, Client, Configuration, CookbookNotFound, DependencyNotFound, DeprecatedError, DuplicateDependencyDefined, Entity, InsufficientPrivledges, InternalError, InvalidConfiguration, Invoice, Item, Journal, Ledger, LockfileNotFound, LockfileOutOfSync, LockfileParserError, NoAPISourcesDefined, NoSolutionError, Payment, Project

Constant Summary collapse

DEFAULT_CONFIG =
'.clearbooks/config.yml'.freeze
VERSION =
`git describe --tags`.split("-").first || "0.1.0-wrong-version"

Class Method Summary collapse

Class Method Details

.clientObject

Examples:

Clearbooks.list_invoices

# or
Clearbooks.client.list_invoices


41
42
43
# File 'lib/clearbooks.rb', line 41

def client
  @client ||= Client.new
end

.configConfiguration

Returns Configuration object

Returns:



49
50
51
# File 'lib/clearbooks.rb', line 49

def config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Hash

end

Examples:

Clearbooks.configure do |config|

config.api_key = 'api_key'
config.log = true
config.logger = Logger.new(STDOUT)

Yields:

Returns:

  • (Hash)

    Returns Configuration object



63
64
65
# File 'lib/clearbooks.rb', line 63

def configure
  yield config
end

.method_missing(method, *args, &block) ⇒ Object

Parameters:

  • method (String)

    Some unknown method call on Clearbooks class

  • args (Array)

    Some given function arguments with given method call

  • block (Explicit Block)

    Some given block argument with the function and arguments



74
75
76
# File 'lib/clearbooks.rb', line 74

def method_missing method, *args, &block
  client.send method, *args, &block
end

.respond_to?(*args) ⇒ Boolean

Parameters:

  • args (Array)

    Function and function parameter argument list

Returns:

  • (Boolean)


83
84
85
# File 'lib/clearbooks.rb', line 83

def respond_to? *args
  super || client.respond_to?(*args)
end