Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Version bump to 0.7.0

  • Loading branch information...
commit ec71108330da742833a0108c1632d66db689542a 1 parent ab55abd
@philnash authored
View
18 History.txt
@@ -1,7 +1,17 @@
+=== 0.7.0 / 2011-1-8
+
+* 1 major bug fix
+
+ * Updates OAuth2 gem and fixes OAuth class
+
+* 1 minor enhancement
+
+ Adds link_history to user model
+
=== 0.6.2 / 2011-11-10
* 2 minor enhancements
-
+
* Adds days parameter to clicks_by_minute v3 API call
* Converts Readme to markdown
@@ -51,7 +61,7 @@
* 1 bug fix
* When expanding a short url with the v3 module, user hash and short url weren't being set properly
-
+
=== 0.5.0 / 2010-05-12
* Loads of major enhancements
@@ -86,7 +96,7 @@
* 1 minor enhancement
* calling bitly.shorten(:history => 1) will add the url to the api user's history.
-
+
* 1 bug fix
* you can no longer call shorten with a keyword, this was unsupported in the API and consequently removed
@@ -96,7 +106,7 @@
* 1 enhancement
* Depends on Crack instead of JSON, so can run on Jruby
-
+
* 1 bug fix
* Does not choke when bit.ly chokes. Returns a BitlyError instead
View
10 bitly.gemspec
@@ -2,11 +2,11 @@
Gem::Specification.new do |s|
s.name = %q{bitly}
- s.version = "0.6.2"
+ s.version = "0.7.0"
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
s.authors = ["Phil Nash"]
- s.date = %q{2011-11-10}
+ s.date = %q{2012-01-08}
s.description = %q{Use the bit.ly API to shorten or expand URLs}
s.email = %q{philnash@gmail.com}
s.extra_rdoc_files = ["README.md", "lib/bitly.rb", "lib/bitly/client.rb", "lib/bitly/url.rb", "lib/bitly/utils.rb", "lib/bitly/v3.rb", "lib/bitly/v3/bitly.rb", "lib/bitly/v3/client.rb", "lib/bitly/v3/country.rb", "lib/bitly/v3/day.rb", "lib/bitly/v3/missing_url.rb", "lib/bitly/v3/oauth.rb", "lib/bitly/v3/realtime_link.rb", "lib/bitly/v3/referrer.rb", "lib/bitly/v3/url.rb", "lib/bitly/v3/user.rb", "lib/bitly/version.rb"]
@@ -26,15 +26,15 @@ Gem::Specification.new do |s|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<crack>, [">= 0.1.4"])
s.add_runtime_dependency(%q<httparty>, [">= 0.7.6"])
- s.add_runtime_dependency(%q<oauth2>, [">= 0.1.1"])
+ s.add_runtime_dependency(%q<oauth2>, ["~> 0.5.0"])
else
s.add_dependency(%q<crack>, [">= 0.1.4"])
s.add_dependency(%q<httparty>, [">= 0.7.6"])
- s.add_dependency(%q<oauth2>, [">= 0.1.1"])
+ s.add_dependency(%q<oauth2>, ["~> 0.5.0"])
end
else
s.add_dependency(%q<crack>, [">= 0.1.4"])
s.add_dependency(%q<httparty>, [">= 0.7.6"])
- s.add_dependency(%q<oauth2>, [">= 0.1.1"])
+ s.add_dependency(%q<oauth2>, ["~> 0.5.0"])
end
end
View
30 lib/bitly/v3/client.rb
@@ -11,21 +11,21 @@ class Client
def initialize(login, api_key)
@default_query_opts = { :login => login, :apiKey => api_key }
end
-
+
# Validates a login and api key
def validate(x_login, x_api_key)
response = get('/validate', :query => { :x_login => x_login, :x_apiKey => x_api_key })
return response['data']['valid'] == 1
end
alias :valid? :validate
-
+
# Checks whether a domain is a bitly.Pro domain
def bitly_pro_domain(domain)
response = get('/bitly_pro_domain', :query => { :domain => domain })
return response['data']['bitly_pro_domain']
end
alias :pro? :bitly_pro_domain
-
+
# Shortens a long url
#
# Options can be:
@@ -39,26 +39,26 @@ def shorten(long_url, opts={})
response = get('/shorten', :query => query)
return Bitly::V3::Url.new(self, response['data'])
end
-
+
# Expands either a hash, short url or array of either.
#
# Returns the results in the order they were entered
def expand(input)
get_method(:expand, input)
end
-
+
# Expands either a hash, short url or array of either and gets click data too.
#
# Returns the results in the order they were entered
def clicks(input)
get_method(:clicks, input)
end
-
+
# Like expand, but gets the title of the page and who created it
def info(input)
- get_method(:info, input)
+ get_method(:info, input)
end
-
+
# Looks up the short url and global hash of a url or array of urls
#
# Returns the results in the order they were entered
@@ -83,7 +83,7 @@ def lookup(input)
end
return results.length > 1 ? results : results[0]
end
-
+
# Expands either a short link or hash and gets the referrer data for that link
#
# This method does not take an array as an input
@@ -108,17 +108,17 @@ def clicks_by_day(input, opts={})
opts.reject! { |k, v| k.to_s != 'days' }
get_method(:clicks_by_day, input, opts)
end
-
+
private
def arrayize(arg)
if arg.is_a?(String)
- [arg]
+ [arg]
else
arg.dup
end
end
-
+
def get(method, opts={})
opts[:query] ||= {}
opts[:query].merge!(@default_query_opts)
@@ -129,11 +129,11 @@ def get(method, opts={})
raise BitlyError.new(response['status_txt'], response['status_code'])
end
end
-
+
def is_a_short_url?(input)
input.match(/^http:\/\//)
end
-
+
def get_single_method(method, input)
raise ArgumentError.new("This method only takes a hash or url input") unless input.is_a? String
if is_a_short_url?(input)
@@ -145,7 +145,7 @@ def get_single_method(method, input)
response = get(query)
return Bitly::V3::Url.new(self,response['data'])
end
-
+
def get_method(method, input, opts={})
input = arrayize(input)
query = input.inject([]) do |query,i|
View
2  lib/bitly/version.rb
@@ -1,3 +1,3 @@
module Bitly
- VERSION = '0.6.2'
+ VERSION = '0.7.0'
end
Please sign in to comment.
Something went wrong with that request. Please try again.