Method: Bitly::Url#initialize

Defined in:
lib/bitly/url.rb

#initialize(login, api_key, obj = nil) ⇒ Url

Returns a new instance of Url.

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
17
18
19
20
# File 'lib/bitly/url.rb', line 10

def initialize(,api_key,obj=nil)
  unless obj.nil?
    raise BitlyError.new(result['errorMessage'],result['errorCode']) if obj['statusCode'] == "ERROR"
    instance_variablise(obj, VARIABLES)
    @info = obj[:info] if obj[:info]
    @stats = obj[:stats] if obj[:stats]
  end
  @login = 
  @api_key = api_key
  raise ArgumentError.new("Please provide a login and api_key") if @login.nil? || @api_key.nil?
end