Module: Justimmo

Defined in:
lib/justimmo.rb,
lib/justimmo/api.rb,
lib/justimmo/config.rb,
lib/justimmo/errors.rb,
lib/justimmo/logger.rb,
lib/justimmo/parser.rb,
lib/justimmo/realty.rb,
lib/justimmo/version.rb,
lib/justimmo/employee.rb

Overview

The Justimmo API.

Defined Under Namespace

Modules: API, Parser Classes: Config, Employee, Logger, Realty

Constant Summary collapse

JustimmoError =
Class.new(StandardError)
InitializationError =
Class.new(JustimmoError)
VERSION =
'0.3.0'

Class Method Summary collapse

Class Method Details

.configure(&block) ⇒ Object

Loads configuration and initializes the API.


15
16
17
18
19
20
# File 'lib/justimmo.rb', line 15

def configure(&block)
  Justimmo::Config.configure(&block)
  Justimmo::Logger.configure(Justimmo::Config)

  initialize_api
end

.configured?true, false

Check if the API was initialized.


40
41
42
# File 'lib/justimmo.rb', line 40

def configured?
  Justimmo::Config.configured?
end

.initialize_apiObject

Load the API with the version specified in the configuration.

Raises:


24
25
26
27
28
29
30
# File 'lib/justimmo.rb', line 24

def initialize_api
  return if initialized?
  raise InitializationError, 'Missing configuration' unless configured?
  require 'justimmo/employee'
  require 'justimmo/realty'
  @initialized = true
end

.initialized?true, false

Check if the API was initialized.


34
35
36
# File 'lib/justimmo.rb', line 34

def initialized?
  @initialized || false
end