class MultiBitly::Client
Attributes
api_client[R]
Public Class Methods
new(api_client=Bitly)
click to toggle source
# File lib/multi_bitly/client.rb, line 5 def initialize(api_client=Bitly) @api_client = api_client end
Public Instance Methods
shorten(url)
click to toggle source
# File lib/multi_bitly/client.rb, line 9 def shorten(url) account = account(url) api_response = client(account).shorten(url) response(account, api_response) end
Private Instance Methods
account(url)
click to toggle source
# File lib/multi_bitly/client.rb, line 19 def account(url) Account.new(url) end
client(account)
click to toggle source
# File lib/multi_bitly/client.rb, line 27 def client(account) @_client ||= api_client.new(account.username, account.api_key) rescue => exception raise Error.new("#{exception.class.to_s}: '#{exception.message}'") end
response(account, api_response)
click to toggle source
# File lib/multi_bitly/client.rb, line 23 def response(account, api_response) Response.new(account, api_response) end