Class: ShortURL::Services::SnipURL

Inherits:
ShortURL::Service show all
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

Methods inherited from ShortURL::Service

#call, #on_response

Constructor Details

#initializeSnipURL

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