Class: LinkShrink::Shrinkers::Owly

Inherits:
Base
  • Object
show all
Defined in:
lib/link_shrink/shrinkers/owly.rb

Overview

Implements Owly’s URL Shortener API

Instance Attribute Summary

Attributes inherited from Base

#url

Instance Method Summary collapse

Methods inherited from Base

#api_key, #api_key?, #body_parameters, collection, #content_type, error, #generate_chart_url, #http_method, inherited, response_options, #sanitize_url, short_url

Instance Method Details

#api_query_parameterString

Returns URL query parameters

Returns:

  • (String)

    query parameters to be used in request



23
24
25
# File 'lib/link_shrink/shrinkers/owly.rb', line 23

def api_query_parameter
  "?apiKey=#{api_key}&longUrl=#{url}"
end

#api_urlString

Returns full api url

Returns:

  • (String)

    full api url with query parameters



29
30
31
# File 'lib/link_shrink/shrinkers/owly.rb', line 29

def api_url
  base_url.concat api_query_parameter
end

#base_urlString

Returns URL base for API

Returns:

  • (String)

    api base url



17
18
19
# File 'lib/link_shrink/shrinkers/owly.rb', line 17

def base_url
  'http://ow.ly/api/1.1/url/shorten'
end