Class: LinkShrink::Shrinkers::IsGd

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

Overview

Implements Is.gd Shortener API

Author:

Instance Attribute Summary

Attributes inherited from Base

#url

Instance Method Summary collapse

Methods inherited from Base

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

Instance Method Details

#api_query_parameterString

URL query parameters

Returns:

  • (String)

    query parameters to be used in request



14
15
16
# File 'lib/link_shrink/shrinkers/isgd.rb', line 14

def api_query_parameter
  "?format=simple&url=#{url}"
end

#api_urlString

Returns full api url

Returns:

  • (String)

    full api url with query parameters



26
27
28
# File 'lib/link_shrink/shrinkers/isgd.rb', line 26

def api_url
  base_url.concat api_query_parameter
end

#base_urlString

Returns URL base for API

Returns:

  • (String)

    api base url



8
9
10
# File 'lib/link_shrink/shrinkers/isgd.rb', line 8

def base_url
  'http://is.gd/create.php'
end

#content_typeString

Returns Content-Type to be used in Request headers

Returns:

  • (String)

    text/plain as content-type



20
21
22
# File 'lib/link_shrink/shrinkers/isgd.rb', line 20

def content_type
  'text/plain'
end