ruby-bitly 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG ADDED
@@ -0,0 +1,6 @@
1
+ # 0.1.0
2
+
3
+ - Moving read file ~/.bitly from Bitly class to command line script
4
+ - Using Bitly class is an OpenStruct
5
+ - Simplified code
6
+ - bit.ly credentials as parameters
data/README.rdoc CHANGED
@@ -1,31 +1,47 @@
1
1
  = A simple bitly ruby client.
2
2
 
3
3
  == Examples
4
- bitly -s http://rafael.xlii.com.br
4
+ bitly -s http://xlii.com.br
5
5
  bitly -e http://bit.ly/XLII42
6
6
  bitly --user-clicks http://bit.ly/XLII42
7
7
  bitly --global-clicks http://bit.ly/XLII42
8
8
 
9
9
  Other examples:
10
- bitly -q -s http://rafael.xlii.com.br
10
+ bitly -q -s http://xlii.com.br
11
11
  bitly --verbose -e http://bit.ly/XLII42
12
12
 
13
- == Usage
13
+ == Usage
14
14
  bitly [options] url
15
15
 
16
16
  For help: bitly -h
17
17
 
18
18
  == Options
19
- -s, --shorten Shorten a long url
19
+ -s, --shorten Shorten a long url (default option)
20
20
  -e, --expand Expand a short bitly url
21
21
  -u, --user-clicks Show user clicks from the short bitly url
22
22
  -g, --global-clicks Show global clicks from the short bitly url
23
-
23
+
24
+ -l, --login LOGIN Your bit.ly login
25
+ -k, --key KEY Your bit.ly API key
26
+
24
27
  -h, --help Displays help message, then exit
25
28
  -v, --version Display the version, then exit
26
29
  -q, --quiet Output as little as possible, overrides verbose
27
30
  -V, --verbose Verbose output
28
31
 
32
+ == Authentication
33
+ bit.ly API require that authentication credentials be supplied.
34
+
35
+ To get started, you'll need a free bit.ly user account and apiKey. Signup at: http://bit.ly/a/sign_up
36
+ If you already have an account, you can find your apiKey at: http://bit.ly/a/your_api_key
37
+
38
+ You can supply credentials as parameters. By example:
39
+ bitly -l username -k key-here -s http://xlii.com.br
40
+
41
+ Or you can create the file ~/.bitly (YAML format) with this content:
42
+ login: username
43
+ key: key-here
44
+
29
45
  == Author
30
46
  rafaeldx7 ~ rafaeldx7(a)gmail.com
31
47
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.9
1
+ 0.1.0
data/bin/bitly CHANGED
@@ -11,81 +11,94 @@ require 'date'
11
11
 
12
12
  class App
13
13
  VERSION = File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
14
-
15
- attr_reader :options
14
+ ACCOUNT_FILE_PATH = "#{ENV['HOME']}/.bitly"
15
+
16
+ attr_accessor :arguments, :options, :message
16
17
 
17
- def initialize(arguments, stdin)
18
- @arguments = arguments
18
+ def initialize(arguments, stdin = nil)
19
+ self.options = OpenStruct.new
20
+ self.arguments = arguments
19
21
  @stdin = stdin
20
-
21
- # Set defaults
22
- @options = OpenStruct.new
23
- @options.verbose = false
24
- @options.quiet = false
25
22
  end
26
23
 
27
- # Parse options, check arguments, then process the command
28
24
  def run
29
-
30
- if parsed_options? && arguments_valid?
31
-
32
- puts "Start at #{DateTime.now}\n\n" if @options.verbose
33
-
34
- output_options if @options.verbose # [Optional]
25
+ process_options
26
+
27
+ if arguments_valid?
28
+ output_options if options.verbose
35
29
 
36
- process_arguments
37
- puts process_command.to_s
38
-
39
- puts "\nFinished at #{DateTime.now}" if @options.verbose
40
-
30
+ process_arguments
31
+ puts "#{options.message} #{process_command}".strip
41
32
  else
42
- output_usage
33
+ output_help
43
34
  end
44
-
45
35
  end
46
36
 
47
37
  protected
48
38
 
49
- def parsed_options?
39
+ def load_account_data
40
+ begin
41
+ account_data = YAML.load(File.read(ACCOUNT_FILE_PATH))
42
+ rescue
43
+
44
+ end
45
+
46
+ if account_data
47
+ options.login = account_data["login"]
48
+ options.key = account_data["key"]
49
+ end
50
+ end
51
+
52
+ def default_options
53
+ options.verbose = false
54
+ options.quiet = false
55
+ end
56
+
57
+ def process_options
58
+ default_options
50
59
 
51
- # Specify options
52
60
  opts = OptionParser.new
53
61
 
54
- opts.on('-s', '--shorten') { @options.shorten = true }
55
- opts.on('-e', '--expand') { @options.expand = true }
56
- opts.on('-u', '--user-clicks') { @options.user_clicks = true }
57
- opts.on('-g', '--global-clicks') { @options.global_clicks = true }
62
+ opts.on('-s', '--shorten') { options.shorten = true; options.message = 'Short url:' }
63
+ opts.on('-e', '--expand') { options.expand = true; options.message = 'Original url:' }
64
+ opts.on('-u', '--user-clicks') { options.user_clicks = true; options.message = 'User clicks:' }
65
+ opts.on('-g', '--global-clicks') { options.global_clicks = true; options.message = 'Global clicks:' }
66
+
67
+ opts.on('-l', '--login LOGIN') { |login| options.login = login }
68
+ opts.on('-k', '--key KEY') { |key| options.key = key }
58
69
 
59
70
  opts.on('-v', '--version') { output_version ; exit 0 }
60
71
  opts.on('-h', '--help') { output_help }
61
- opts.on('-V', '--verbose') { @options.verbose = true }
62
- opts.on('-q', '--quiet') { @options.quiet = true }
63
-
64
- opts.parse!(@arguments) rescue return false
65
-
66
- process_options
67
- true
68
- end
69
-
70
- # Performs post-parse processing on options
71
- def process_options
72
- @options.verbose = false if @options.quiet
72
+ opts.on('-V', '--verbose') { options.verbose = true }
73
+ opts.on('-q', '--quiet') { options.quiet = true; options.verbose = false; options.message = '' }
74
+
75
+ post_process_options
76
+
77
+ opts.parse!(arguments) rescue return false
73
78
  end
74
79
 
80
+ def post_process_options
81
+ # Bitly API Login / Key
82
+ load_account_data unless options.login and options.key
83
+
84
+ # Default option: --shorten
85
+ options.shorten = true unless options.expand or options.user_clicks or options.global_clicks
86
+ end
87
+
75
88
  def output_options
76
89
  puts "Options:\n"
77
90
 
78
- @options.marshal_dump.each do |name, val|
91
+ options.marshal_dump.each do |name, val|
79
92
  puts " #{name} = #{val}"
80
93
  end
94
+
95
+ puts " URL: #{arguments.first}\n"
81
96
  end
82
97
 
83
- # True if required arguments were provided
84
98
  def arguments_valid?
85
- @arguments.length == 1 and (@options.shorten or @options.expand or @options.user_clicks or @options.global_clicks)
99
+ arguments.length == 1
86
100
  end
87
101
 
88
- # Setup the arguments
89
102
  def process_arguments
90
103
  end
91
104
 
@@ -93,21 +106,17 @@ class App
93
106
  Readme::usage() #exits app
94
107
  end
95
108
 
96
- def output_usage
97
- Readme::usage('usage') # gets usage from comments above
98
- end
99
-
100
109
  def output_version
101
- puts "#{File.basename(__FILE__)} version #{VERSION}"
110
+ puts "bitly version #{VERSION.chomp} [gem ruby-bitly]"
102
111
  end
103
112
 
104
113
  def process_command
105
- return Bitly.shorten(@arguments[0]).short_url if @options.shorten
106
- return Bitly.expand(@arguments[0]).long_url if @options.expand
107
- return Bitly.clicks(@arguments[0]).user_clicks.to_s if @options.user_clicks
108
- return Bitly.clicks(@arguments[0]).global_clicks.to_s if @options.global_clicks
114
+ return Bitly.shorten(arguments.first, options.login, options.key).url if options.shorten
115
+ return Bitly.expand(arguments.first, options.login, options.key).long_url if options.expand
116
+ return Bitly.get_clicks(arguments.first, options.login, options.key).user_clicks.to_s if options.user_clicks
117
+ return Bitly.get_clicks(arguments.first, options.login, options.key).global_clicks.to_s if options.global_clicks
109
118
  end
110
119
  end
111
120
 
112
- app = App.new(ARGV, STDIN)
121
+ app = App.new(ARGV)
113
122
  app.run
data/lib/ruby-bitly.rb CHANGED
@@ -2,137 +2,44 @@ require 'rubygems'
2
2
  require 'yaml'
3
3
  require 'restclient'
4
4
  require 'json'
5
+ require 'ostruct'
5
6
 
6
- class Bitly
7
+ class Bitly < OpenStruct
7
8
 
8
- attr_reader :response, :status_code, :status_txt, :new_hash, :global_hash, :user_hash, :hash, :response, :long_url, :short_url, :global_clicks, :user_clicks
9
-
10
- PERSONAL_FILE_PATH = "#{ENV['HOME']}/.bitly"
11
9
  REST_API_URL = "http://api.bit.ly"
12
10
  ACTION_PATH = { :shorten => '/v3/shorten', :expand => '/v3/expand', :clicks => '/v3/clicks' }
13
-
14
- def initialize
15
- @read_only = false
16
- end
17
-
18
- def read_only?
19
- @read_only
20
- end
21
-
22
- def long_url=(url)
23
- @long_url = url unless read_only?
24
- end
25
-
26
- def short_url=(url)
27
- @short_url = url unless read_only?
28
- end
29
-
30
- def Bitly.load_personal_data
31
- personal_data = YAML.load(File.read(PERSONAL_FILE_PATH))
32
11
 
33
- if personal_data
34
- @@login = personal_data["login"]
35
- @@key = personal_data["key"]
36
- personal_data
37
- end
38
- end
39
-
40
- def read_only_now!
41
- @read_only = true
42
- end
43
-
44
- def shorten
45
- unless read_only?
46
- if @response = Bitly.post_shorten(@long_url)
47
-
48
- @status_code = @response["status_code"]
49
- @status_txt = @response["status_txt"]
50
- @long_url = @response["data"]["long_url"]
51
- @new_hash = @response["data"]["new_hash"]
52
- @global_hash = @response["data"]["global_hash"]
53
- @hash = @response["data"]["hash"]
54
- @short_url = @response["data"]["url"]
55
-
56
- read_only_now!
57
- end
58
- end
59
- end
60
-
61
- def expand
62
- if @response = Bitly.post_expand(@short_url)
12
+ def Bitly.shorten(new_long_url, login, key)
13
+ response = JSON.parse RestClient.post(REST_API_URL + ACTION_PATH[:shorten], { :longURL => new_long_url, :login => login, :apiKey => key })
63
14
 
64
- @long_url = @response["data"]["expand"].first["long_url"]
65
- @global_hash = @response["data"]["expand"].first["global_hash"]
66
- @user_hash = @response["data"]["expand"].first["user_hash"]
67
- @status_code = @response["status_code"]
68
- @status_txt = @response["status_txt"]
69
-
70
- read_only_now!
71
- end
72
- end
73
-
74
- def clicks
75
- if @response = Bitly.get_clicks(@short_url)
15
+ bitly = Bitly.new response["data"]
76
16
 
77
- @global_clicks = @response["data"]["clicks"].first["global_clicks"]
78
- @user_clicks = @response["data"]["clicks"].first["user_clicks"]
79
- @global_hash = @response["data"]["clicks"].first["global_hash"]
80
- @user_hash = @response["data"]["clicks"].first["user_hash"]
81
- @status_code = @response["status_code"]
82
- @status_txt = @response["status_txt"]
17
+ bitly.hash_path = response["data"]["hash"] if response["status_code"] == 200
18
+ bitly.status_code = response["status_code"]
19
+ bitly.status_txt = response["status_txt"]
83
20
 
84
- read_only_now!
85
- end
21
+ bitly
86
22
  end
87
23
 
88
- def Bitly.request
89
- Bitly.load_personal_data
24
+ def Bitly.expand(new_short_url, login, key)
25
+ response = JSON.parse RestClient.post(REST_API_URL + ACTION_PATH[:expand], { :shortURL => new_short_url, :login => login, :apiKey => key })
90
26
 
91
- begin
92
- response = yield
93
- JSON.parse(response)
94
- rescue
95
- response[:error] = "error"
96
- end
97
- end
98
-
99
- def Bitly.post_shorten(new_long_url)
100
- Bitly.request do
101
- RestClient.post(REST_API_URL + ACTION_PATH[:shorten], { :longURL => new_long_url, :login => @@login, :apiKey => @@key })
102
- end
103
- end
104
-
105
- def Bitly.post_expand(new_short_url)
106
- Bitly.request do
107
- RestClient.post(REST_API_URL + ACTION_PATH[:expand], { :shortURL => new_short_url, :login => @@login, :apiKey => @@key })
108
- end
109
- end
110
-
111
- def Bitly.get_clicks(new_short_url)
112
- Bitly.request do
113
- RestClient.get("#{REST_API_URL}#{ACTION_PATH[:clicks]}?login=#{@@login}&apiKey=#{@@key}&shortUrl=#{new_short_url}")
114
- # RestClient.get(REST_API_URL + ACTION_PATH[:clicks], { :login => @@login, :apiKey => @@key, :shortUrl => new_short_url })
115
- end
116
- end
27
+ bitly = Bitly.new(response["data"]["expand"].first)
28
+ bitly.status_code = response["status_code"]
29
+ bitly.status_txt = response["status_txt"]
30
+ bitly.long_url = bitly.error if bitly.error
117
31
 
118
- def Bitly.shorten(new_long_url)
119
- bitly = Bitly.new
120
- bitly.long_url = new_long_url
121
- bitly.shorten
122
32
  bitly
123
33
  end
124
34
 
125
- def Bitly.expand(new_short_url)
126
- bitly = Bitly.new
127
- bitly.short_url = new_short_url
128
- bitly.expand
129
- bitly
130
- end
131
-
132
- def Bitly.clicks(new_short_url)
133
- bitly = Bitly.new
134
- bitly.short_url = new_short_url
135
- bitly.clicks
35
+ def Bitly.get_clicks(new_short_url, login, key)
36
+ response = JSON.parse RestClient.get("#{REST_API_URL}#{ACTION_PATH[:clicks]}?login=#{login}&apiKey=#{key}&shortUrl=#{new_short_url}")
37
+ # response = JSON.parse RestClient.get(REST_API_URL + ACTION_PATH[:clicks], { :login => login, :apiKey => key, :shortUrl => new_short_url })
38
+
39
+ bitly = Bitly.new(response["data"]["clicks"].first)
40
+ bitly.status_code = response["status_code"]
41
+ bitly.status_txt = response["status_txt"]
42
+
136
43
  bitly
137
44
  end
138
45
  end
data/ruby-bitly.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ruby-bitly}
8
- s.version = "0.0.9"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["rafaeldx7"]
12
- s.date = %q{2010-08-04}
12
+ s.date = %q{2010-08-10}
13
13
  s.default_executable = %q{bitly}
14
14
  s.description = %q{This is a simple bit.ly ruby client}
15
15
  s.email = %q{rafaeldx7@gmail.com}
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.files = [
22
22
  ".document",
23
23
  ".gitignore",
24
+ "CHANGELOG",
24
25
  "LICENSE",
25
26
  "README.rdoc",
26
27
  "Rakefile",
@@ -2,188 +2,57 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe "RubyBitly" do
4
4
 
5
- it "Load personal data from ~/.bitly" do
6
- file_data = Bitly.load_personal_data
7
- file_data["key"].should_not be_empty
8
- file_data["login"].should_not be_empty
5
+ before(:all) do
6
+ @login = 'rafaeldx7'
7
+ @key = 'R_59c1b174b21d92b2beeb4787a6d7ebaf'
9
8
  end
10
-
11
- it "Shorten log url staticaly and return a hash" do
12
- response = Bitly.post_shorten "http://google.com"
13
-
14
- response["status_code"].should == 200
15
- response["status_txt"].should == "OK"
16
- response["data"]["new_hash"].should == 0
17
- response["data"]["global_hash"].should == "zzzzzzz"
18
- response["data"]["hash"].length.should_not == 0
19
- response["data"]["url"].should match /^http:\/\/bit\.ly\/[A-Za-z0-9]*/
20
- end
21
-
22
- it "Shorten log url with an object" do
23
- url = Bitly.new
24
- url.long_url = "http://google.com"
25
- url.shorten
26
-
27
- url.status_code.should == 200
28
- url.status_txt.should == "OK"
29
- url.new_hash.should == 0
30
- url.global_hash == "zzzzzzz"
31
- url.hash.length.should_not == 0
32
- url.short_url.should match /^http:\/\/bit\.ly\/[A-Za-z0-9]*/
33
- end
34
-
35
- it "Expand short url to long url staticaly and return a hash" do
36
- Bitly.post_expand("http://bit.ly/bcvNe5").should == { "data"=>
37
- { "expand" => [
38
- { "long_url" => "http://google.com",
39
- "short_url" => "http://bit.ly/bcvNe5",
40
- "global_hash" => "zzzzzzz",
41
- "user_hash" => "bcvNe5"}]
42
- },
43
- "status_txt" => "OK",
44
- "status_code" => 200
45
- }
46
- end
47
-
48
- it "Expand short url to long url with an object" do
49
- url = Bitly.new
50
- url.short_url = "http://bit.ly/bcvNe5"
51
- url.expand
52
-
53
- url.long_url.should == "http://google.com"
54
- url.short_url.should == "http://bit.ly/bcvNe5"
55
- url.global_hash.should == "zzzzzzz"
56
- url.user_hash.should == "bcvNe5"
57
- url.status_code.should == 200
58
- url.status_txt.should == "OK"
59
- end
60
-
61
- it "Update object as read only" do
62
- url = Bitly.new
63
- url.read_only?.should be false
64
- url.read_only_now!
65
- url.read_only?.should be true
66
- end
67
-
68
- it "Shorten url and return an object" do
69
- url = Bitly.shorten("http://google.com")
70
- url.should be_an_instance_of(Bitly)
71
-
72
- url.status_code.should == 200
73
- url.status_txt.should == "OK"
74
- url.long_url.should == "http://google.com"
75
- url.new_hash.should == 0
76
- url.global_hash.should == "zzzzzzz"
77
- url.hash.should match /^[A-Za-z0-9]*$/
78
- url.short_url.should match /^http:\/\/bit\.ly\/[A-Za-z0-9]*/
79
- end
80
-
81
- it "New bitly object should be not read only" do
82
- url = Bitly.new
83
- url.read_only?.should be false
84
- end
85
-
86
- it "Shortened object should be read only" do
87
- url = Bitly.shorten "http://google.com"
88
- url.read_only?.should be true
89
- end
90
-
91
- it "Expanded object should be read only" do
92
- url = Bitly.expand "http://bit.ly/bcvNe5"
93
- url.read_only?.should be true
94
- end
95
-
96
- it "Stats object should be read only" do
97
- url = Bitly.clicks "http://bit.ly/bcvNe5"
98
- url.read_only?.should be true
99
- end
100
-
101
- it "Attribute long_url should be updatable when object is not read only" do
102
- url = Bitly.new
103
- url.long_url = "http://google.com"
104
- url.long_url.should == "http://google.com"
9
+
10
+ it "Shorten long url" do
11
+ response = Bitly.shorten("http://google.com", @login, @key)
105
12
 
106
- url.long_url = "http://xlii.com.br"
107
- url.long_url.should == "http://xlii.com.br"
13
+ response.status_code.should == 200
14
+ response.status_txt.should == "OK"
15
+ response.new_hash.should == 0
16
+ response.global_hash.should == "zzzzzzz"
17
+ response.hash_path.length.should_not == 0
18
+ response.url.should match /^http:\/\/bit\.ly\/[A-Za-z0-9]*/
108
19
  end
109
20
 
110
- it "Attribute long_url should not be updatable when object is read only" do
111
- url = Bitly.new
112
- url.long_url = "http://google.com"
113
- url.long_url.should == "http://google.com"
114
- url.read_only_now!
21
+ it "Shorten bitly url" do
22
+ response = Bitly.shorten("http://bit.ly/bcvNe5", @login, @key)
115
23
 
116
- url.long_url = "http://xlii.com.br"
117
- url.long_url.should == "http://google.com"
118
- end
119
-
120
- it "Expand url and return an object" do
121
- url = Bitly.expand "http://bit.ly/bcvNe5"
122
- url.should be_an_instance_of(Bitly)
123
-
124
- url.long_url.should == "http://google.com"
125
- url.short_url.should == "http://bit.ly/bcvNe5"
126
- url.global_hash.should == "zzzzzzz"
127
- url.user_hash.should == "bcvNe5"
128
- url.status_code.should == 200
129
- url.status_txt.should == "OK"
130
- end
131
-
132
- it "Get clicks and return an object" do
133
- url = Bitly.clicks "http://bit.ly/xlii42"
134
- url.should be_an_instance_of(Bitly)
135
-
136
- url.status_code.should == 200
137
- url.status_txt.should == "OK"
138
- url.global_clicks.should be_an_instance_of Fixnum
139
- url.user_clicks.should be_an_instance_of Fixnum
140
- url.short_url.should == "http://bit.ly/xlii42"
141
- url.global_hash == "cunZEP"
142
- url.user_hash.should == "cT1Izu"
24
+ response.status_code.should == 500
143
25
  end
144
-
145
- it "Attribute short_url should be updated when object is not read only" do
146
- url = Bitly.new
147
- url.short_url = "http://bit.ly/bcvNe5"
148
- url.short_url.should == "http://bit.ly/bcvNe5"
26
+
27
+ it "Expand a short url to it long url" do
28
+ response = Bitly.expand("http://bit.ly/bcvNe5", @login, @key)
149
29
 
150
- url.short_url = "http://bit.ly/xlii42"
151
- url.short_url.should == "http://bit.ly/xlii42"
30
+ response.status_code.should == 200
31
+ response.status_txt.should == "OK"
32
+ response.long_url.should == "http://google.com"
33
+ response.short_url.should == "http://bit.ly/bcvNe5"
34
+ response.user_hash.should == "bcvNe5"
152
35
  end
153
-
154
- it "Attribute short_url should not be updated when object is read only" do
155
- url = Bitly.new
156
- url.short_url = "http://bit.ly/xlii42"
157
- url.short_url.should == "http://bit.ly/xlii42"
158
- url.read_only_now!
36
+
37
+ it "Expand a long url should result an error" do
38
+ response = Bitly.expand("http://google.com", @login, @key)
159
39
 
160
- url.short_url = "http://bit.ly/bcvNe5"
161
- url.short_url.should == "http://bit.ly/xlii42"
40
+ response.status_code.should == 200
41
+ response.status_txt.should == "OK"
42
+ response.long_url.should == "NOT_FOUND"
43
+ response.short_url.should == "http://google.com"
162
44
  end
45
+
163
46
 
164
47
  it "Get clicks by short_url" do
165
- bitly = Bitly.get_clicks("http://bit.ly/xlii42")
166
-
167
- bitly["status_txt"].should == "OK"
168
- bitly["status_code"].should == 200
169
- bitly["data"]["clicks"].first["global_clicks"].should be_an_instance_of Fixnum
170
- bitly["data"]["clicks"].first["user_clicks"].should be_an_instance_of Fixnum
171
- bitly["data"]["clicks"].first["short_url"].should == "http://bit.ly/xlii42"
172
- bitly["data"]["clicks"].first["global_hash"].should == "cunZEP"
173
- bitly["data"]["clicks"].first["user_hash"].should == "cT1Izu"
174
- end
175
-
176
- it "Clicks with an object" do
177
- url = Bitly.new
178
- url.short_url = "http://bit.ly/xlii42"
179
- url.clicks
48
+ bitly = Bitly.get_clicks("http://bit.ly/xlii42", @login, @key)
180
49
 
181
- url.status_code.should == 200
182
- url.status_txt.should == "OK"
183
- url.global_clicks.should be_an_instance_of Fixnum
184
- url.user_clicks.should be_an_instance_of Fixnum
185
- url.short_url.should == "http://bit.ly/xlii42"
186
- url.global_hash == "cunZEP"
187
- url.user_hash.should == "cT1Izu"
50
+ bitly.status_txt.should == "OK"
51
+ bitly.status_code.should == 200
52
+ bitly.global_clicks.should be_an_instance_of Fixnum
53
+ bitly.user_clicks.should be_an_instance_of Fixnum
54
+ bitly.short_url.should == "http://bit.ly/xlii42"
55
+ bitly.global_hash.should == "cunZEP"
56
+ bitly.user_hash.should == "cT1Izu"
188
57
  end
189
58
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-bitly
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 9
10
- version: 0.0.9
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - rafaeldx7
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-04 00:00:00 -03:00
18
+ date: 2010-08-10 00:00:00 -03:00
19
19
  default_executable: bitly
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -94,6 +94,7 @@ extra_rdoc_files:
94
94
  files:
95
95
  - .document
96
96
  - .gitignore
97
+ - CHANGELOG
97
98
  - LICENSE
98
99
  - README.rdoc
99
100
  - Rakefile