Class: ShortURL::Services::Bitly
- Inherits:
-
ShortURL::Service
- Object
- ShortURL::Service
- ShortURL::Services::Bitly
- Defined in:
- lib/shorturl/services/bitly.rb
Instance Attribute Summary
Attributes inherited from ShortURL::Service
#action, #block, #code, #field, #method, #port, #response_block, #ssl
Instance Method Summary collapse
-
#initialize ⇒ Bitly
constructor
A new instance of Bitly.
- #on_body(body) ⇒ Object
Methods inherited from ShortURL::Service
Constructor Details
#initialize ⇒ Bitly
Returns a new instance of Bitly.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/shorturl/services/bitly.rb', line 7 def initialize super("api-ssl.bitly.com") @method = :get @port = 443 @ssl = true @action = "/v3/shorten/" creds = ShortURL.credentials_for('bitly') username = creds['username'] key = creds['key'] @field = "format=txt&login=#{username}&apiKey=#{key}&longUrl" end |
Instance Method Details
#on_body(body) ⇒ Object
22 23 24 |
# File 'lib/shorturl/services/bitly.rb', line 22 def on_body(body) body end |