Module: Prolenea::ClassMethods
- Included in:
- Prolenea
- Defined in:
- lib/prolenea.rb
Instance Method Summary collapse
- #connect(config = {}) ⇒ Object
- #connected? ⇒ Boolean
- #connection ⇒ Object
- #lookup_number(number) ⇒ Object
Instance Method Details
#connect(config = {}) ⇒ Object
18 19 20 |
# File 'lib/prolenea.rb', line 18 def connect(config = {}) @connection = Connection.new(:uri => config[:uri]) end |
#connected? ⇒ Boolean
22 23 24 |
# File 'lib/prolenea.rb', line 22 def connected? !@connection.nil? end |
#connection ⇒ Object
14 15 16 |
# File 'lib/prolenea.rb', line 14 def connection @connection ? @connection : (raise ProleneaNoConnectionError) end |
#lookup_number(number) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/prolenea.rb', line 26 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. rescue StandardError => se raise ProleneaLookupError.new({:parent_error => se}), se. end |