Class: ShortURL::Services::SnipURL
- Inherits:
-
ShortURL::Service
- Object
- ShortURL::Service
- ShortURL::Services::SnipURL
- Defined in:
- lib/shorturl/services/snipurl.rb
Overview
SnipURL offers a restful HTTP API but it cannot be used without registration.
Instance Attribute Summary
Attributes inherited from ShortURL::Service
#action, #block, #code, #field, #method, #port, #response_block, #ssl
Instance Method Summary collapse
-
#initialize ⇒ SnipURL
constructor
A new instance of SnipURL.
- #on_body(body) ⇒ Object
Methods inherited from ShortURL::Service
Constructor Details
#initialize ⇒ SnipURL
Returns a new instance of SnipURL.
9 10 11 12 13 14 |
# File 'lib/shorturl/services/snipurl.rb', line 9 def initialize super("snipurl.com") @action = "/site/index" @field = "url" end |
Instance Method Details
#on_body(body) ⇒ Object
16 17 18 |
# File 'lib/shorturl/services/snipurl.rb', line 16 def on_body(body) URI.extract(body).grep(/http:\/\/snipurl.com/)[0] end |