Class: ShortURL::Services::Url
- Inherits:
-
ShortURL::Service
- Object
- ShortURL::Service
- ShortURL::Services::Url
- Defined in:
- lib/shorturl/services/url.rb
Instance Attribute Summary
Attributes inherited from ShortURL::Service
#action, #block, #code, #field, #method, #port, #response_block, #ssl
Instance Method Summary collapse
-
#initialize ⇒ Url
constructor
A new instance of Url.
- #on_body(body) ⇒ Object
Methods inherited from ShortURL::Service
Constructor Details
#initialize ⇒ Url
Returns a new instance of Url.
7 8 9 10 11 12 13 |
# File 'lib/shorturl/services/url.rb', line 7 def initialize super("url.ca") @method = :post @action = "/" @field = "longurl" end |
Instance Method Details
#on_body(body) ⇒ Object
15 16 17 |
# File 'lib/shorturl/services/url.rb', line 15 def on_body(body) URI.extract(body).grep(/ur1/)[0] end |