Module: Bitly

Extended by:
Config
Defined in:
lib/bitly/url.rb,
lib/bitly/utils.rb,
lib/bitly/client.rb,
lib/bitly/config.rb,
lib/bitly/v3/day.rb,
lib/bitly/v3/url.rb,
lib/bitly/v3/user.rb,
lib/bitly/version.rb,
lib/bitly/v3/bitly.rb,
lib/bitly/v3/oauth.rb,
lib/bitly/v3/client.rb,
lib/bitly/v3/country.rb,
lib/bitly/v3/referrer.rb,
lib/bitly/v3/missing_url.rb,
lib/bitly/v3/realtime_link.rb

Defined Under Namespace

Modules: Config, Utils, V3 Classes: Client, Url

Constant Summary collapse

API_URL =
'https://api-ssl.bitly.com/'
API_VERSION =
'2.0.1'
VERSION =
'1.1.1'

Constants included from Config

Config::OPTION_KEYS

Class Method Summary collapse

Methods included from Config

configure, options

Class Method Details

.clientObject

get and initialize a client if configured using Config



27
28
29
30
31
32
33
34
# File 'lib/bitly/client.rb', line 27

def self.client
  # api_verison, login, and api_key are set in Config
  if api_version == 3
    Bitly::V3::Client.new(, api_key, timeout)
  else
    Bitly::Client.new(, api_key)
  end
end

.new(login, api_key = nil, timeout = nil) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/bitly/client.rb', line 10

def self.new(, api_key = nil, timeout=nil)
  if api_version == 3
    Bitly::V3::Client.new(, api_key, timeout)
  else
    Bitly::Client.new(,api_key)
  end
end

.use_api_version_2Object



22
23
24
# File 'lib/bitly/client.rb', line 22

def self.use_api_version_2
  self.api_version = 2
end

.use_api_version_3Object



18
19
20
# File 'lib/bitly/client.rb', line 18

def self.use_api_version_3
  self.api_version = 3
end