Module: Prolenea::ClassMethods

Included in:
Prolenea
Defined in:
lib/prolenea.rb

Instance Method Summary collapse

Instance Method Details

#connect(config = {}) ⇒ Object



17
18
19
# File 'lib/prolenea.rb', line 17

def connect(config = {})
  @connection = Connection.new(:uri => config[:uri])
end

#connectionObject



13
14
15
# File 'lib/prolenea.rb', line 13

def connection
  @connection ? @connection : (raise StandardError)
end

#lookup_number(number) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/prolenea.rb', line 21

def lookup_number(number)
  params = {:dial => number}

  response = self.connection.get '/', params

  response.env[:parsed_body]
rescue ProleneaError => pe
  raise ProleneaLookupError.new({:parent_error => pe}), pe.message
rescue StandardError => se
  raise ProleneaLookupError.new({:parent_error => se}), se.message
end