shortly 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.markdown +119 -0
  2. data/VERSION +1 -1
  3. data/lib/shortly/helper.rb +7 -1
  4. metadata +32 -49
  5. data/README.textile +0 -118
@@ -0,0 +1,119 @@
1
+ # Shortly
2
+
3
+ A Ruby wrapper for various url shortener services
4
+
5
+ ## Installation
6
+
7
+ create a dependency in your Gemfile
8
+ @gem 'shortly'@ then run
9
+ @bundle install@
10
+ and shortly will be up and running. or @gem install shortly@
11
+
12
+ ## Uses
13
+
14
+ Currently Shortly supports three services (Bit.ly, Goo.gl, is.gd, tinyurl) Please do cross check by running Shortly.active_services. All supported methods have been provided for all services, so you can expect at least one method(shorten) will be available for every service.
15
+
16
+ *Bit.ly*
17
+
18
+ bitly = Shortly::Clients::Bitly
19
+ bitly.shorten('http://justatest.com', {:apiKey => 'R_your_api_key', :login => 'your_login'})
20
+
21
+ Optionally you can set apiKey and login beforehand (it would be more DRY i think if you only gonna use bitly services).
22
+
23
+ bitly = Shortly::Clients::Bitly
24
+ bitly.apiKey = 'your_api_key'
25
+ bitly.login = 'your_login'
26
+ bitly.shorten('http://justatest.com').url
27
+ bitly.expand('http://bit.ly/imshort').long_url
28
+
29
+ *Goo.gl*
30
+
31
+ googl = Shortly::Clients::Googl
32
+ googl.shorten('http://justatest.com').shortUrl
33
+ googl.expand('http://goo.gl/shrt').longUrl
34
+ googl.analytics('http://goo.gl/shrt').analytics
35
+
36
+ *ShortSwitch* (Credit 'Steve Price (steveprice67)'. See Credits section)
37
+
38
+ shortswitch = Shortly::Clients::ShortSwitch
39
+ shortswitch.apiKey = '<api-key>'
40
+ shortswitch.shorten('http://justatest.com').shortUrl
41
+
42
+ *Is.gd*
43
+
44
+ isgd = Shortly::Clients::Isgd
45
+ isgd.shorten('http://justatest.com').shorturl
46
+
47
+ *V.gd*
48
+
49
+ vgd = Shortly::Clients::Vgd
50
+ vgd.shorten('http://justatest.com').shorturl
51
+
52
+ *Tinyurl.com*
53
+
54
+ tinyurl = Shortly::Clients::Tinyurl
55
+ tinyurl.shorten('http://justatest.com').shorturl
56
+
57
+ *Sn.im*
58
+
59
+ snim = Shortly::Clients::Snim
60
+ snim.apiKey = "<apiKey>"
61
+ snim.login = "<login>"
62
+ snim.shorten(long_url).shortUrl
63
+ snim.expand(url_id/shorturl).url
64
+
65
+ #### Command Line Utility
66
+
67
+ Shortly also provides command line utility. See some uses below.
68
+
69
+ shortly 'http://shortme.com/'
70
+
71
+ By default it uses Googl to short urls but you can specify which service to use. Type @shortly -h@ for more info
72
+
73
+ shortly 'http://shortme.com/' -s bitly -l '<your-login>' -p '<your-apiKey>' -m method-to-use
74
+
75
+ here are options and there possible values:
76
+
77
+ | **Options** | **What value do they take** |
78
+ |:----------------|--------------------------------------------------------------------:|
79
+ | -s or --service | Service to use(e.g. bitly, isgd(default googl)) |
80
+ | -m or --method | Method to use(e.g. expand or shorten or analytics(default shorten)) |
81
+ | -l or --login | Login credential(required for bitly) |
82
+ | -p or --apiKey | API Key credentials (for bitly and googl(optional) only) |
83
+
84
+ ##### Some more examples:
85
+
86
+ * Google analytics
87
+
88
+ shortly 'http://averylong.url/that/can/frustate?you=many&times=true' -p my_api_key -m analytics
89
+
90
+ spits formatted json at CLI
91
+
92
+ * Bitly
93
+
94
+ shortly 'http://bit.ly/shrt -s bitly -p my_api_key -l my_login -m expand
95
+
96
+ ## Credits
97
+
98
+ * [Steve Price(steveprice67)](https://github.com/steveprice67) (For implementing Lggd service support)
99
+
100
+ ## More Info
101
+
102
+ For detailed info visit my blog [http://BagwanPankaj.com](http://bagwanpankaj.com)
103
+
104
+ For more info write me at bagwanpankaj[at]gmail.com or me[at]bagwanpankaj.com
105
+
106
+ Copyright (c) 2010 Bagwan Pankaj: http://bagwanpankaj.com, released under the MIT license
107
+
108
+ ## TODO's
109
+
110
+ * Better documentation
111
+ * Example series
112
+
113
+ ## Contributing to shortly
114
+
115
+ * Fork, code, and then send me a pull request.
116
+
117
+ ## Copyright
118
+
119
+ Copyright (c) 2010 [Bagwan Pankaj]. See LICENSE.txt for further details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.3.3
@@ -35,13 +35,19 @@ module Shortly
35
35
  def authenticable?(*args)
36
36
  args.all?{|k| self.key?(k)} && !self.values.any?(&:blank?)
37
37
  end
38
+
39
+ def to_params
40
+ collect do |key, value|
41
+ "#{key}=#{value}"
42
+ end.sort * '&'
43
+ end
38
44
 
39
45
  end
40
46
 
41
47
  module MonkeyObject
42
48
 
43
49
  def blank?
44
- instance_of? Array ? empty? : nil?
50
+ instance_of?(Array) ? empty? : nil?
45
51
  end
46
52
 
47
53
  def present?
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shortly
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease: false
4
+ hash: 21
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 2
10
- version: 0.3.2
9
+ - 3
10
+ version: 0.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bagwan Pankaj
@@ -15,14 +15,12 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-26 00:00:00 +05:30
19
- default_executable: shortly
18
+ date: 2011-01-26 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- type: :runtime
23
- prerelease: false
24
21
  name: httparty
25
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
26
24
  none: false
27
25
  requirements:
28
26
  - - ">="
@@ -31,12 +29,12 @@ dependencies:
31
29
  segments:
32
30
  - 0
33
31
  version: "0"
34
- requirement: *id001
35
- - !ruby/object:Gem::Dependency
36
32
  type: :runtime
37
- prerelease: false
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
38
35
  name: json
39
- version_requirements: &id002 !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
40
38
  none: false
41
39
  requirements:
42
40
  - - ">="
@@ -45,12 +43,12 @@ dependencies:
45
43
  segments:
46
44
  - 0
47
45
  version: "0"
48
- requirement: *id002
46
+ type: :runtime
47
+ version_requirements: *id002
49
48
  - !ruby/object:Gem::Dependency
50
- type: :development
51
- prerelease: false
52
49
  name: rspec
53
- version_requirements: &id003 !ruby/object:Gem::Requirement
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
54
52
  none: false
55
53
  requirements:
56
54
  - - ~>
@@ -61,12 +59,12 @@ dependencies:
61
59
  - 1
62
60
  - 0
63
61
  version: 2.1.0
64
- requirement: *id003
65
- - !ruby/object:Gem::Dependency
66
62
  type: :development
67
- prerelease: false
63
+ version_requirements: *id003
64
+ - !ruby/object:Gem::Dependency
68
65
  name: bundler
69
- version_requirements: &id004 !ruby/object:Gem::Requirement
66
+ prerelease: false
67
+ requirement: &id004 !ruby/object:Gem::Requirement
70
68
  none: false
71
69
  requirements:
72
70
  - - ~>
@@ -77,28 +75,12 @@ dependencies:
77
75
  - 0
78
76
  - 0
79
77
  version: 1.0.0
80
- requirement: *id004
81
- - !ruby/object:Gem::Dependency
82
78
  type: :development
83
- prerelease: false
84
- name: jeweler
85
- version_requirements: &id005 !ruby/object:Gem::Requirement
86
- none: false
87
- requirements:
88
- - - ~>
89
- - !ruby/object:Gem::Version
90
- hash: 1
91
- segments:
92
- - 1
93
- - 5
94
- - 1
95
- version: 1.5.1
96
- requirement: *id005
79
+ version_requirements: *id004
97
80
  - !ruby/object:Gem::Dependency
98
- type: :development
99
- prerelease: false
100
81
  name: rcov
101
- version_requirements: &id006 !ruby/object:Gem::Requirement
82
+ prerelease: false
83
+ requirement: &id005 !ruby/object:Gem::Requirement
102
84
  none: false
103
85
  requirements:
104
86
  - - ">="
@@ -107,12 +89,12 @@ dependencies:
107
89
  segments:
108
90
  - 0
109
91
  version: "0"
110
- requirement: *id006
111
- - !ruby/object:Gem::Dependency
112
92
  type: :development
113
- prerelease: false
93
+ version_requirements: *id005
94
+ - !ruby/object:Gem::Dependency
114
95
  name: fakeweb
115
- version_requirements: &id007 !ruby/object:Gem::Requirement
96
+ prerelease: false
97
+ requirement: &id006 !ruby/object:Gem::Requirement
116
98
  none: false
117
99
  requirements:
118
100
  - - ">="
@@ -121,7 +103,8 @@ dependencies:
121
103
  segments:
122
104
  - 0
123
105
  version: "0"
124
- requirement: *id007
106
+ type: :development
107
+ version_requirements: *id006
125
108
  description: Ruby Wrapper for different Url Shortner Services Ruby Wrapper
126
109
  email: bagwanpankaj@gmail.com
127
110
  executables:
@@ -130,7 +113,7 @@ extensions: []
130
113
 
131
114
  extra_rdoc_files:
132
115
  - LICENSE.txt
133
- - README.textile
116
+ - README.markdown
134
117
  files:
135
118
  - LICENSE.txt
136
119
  - VERSION
@@ -147,11 +130,10 @@ files:
147
130
  - lib/shortly/clients/vgd.rb
148
131
  - lib/shortly/errors.rb
149
132
  - lib/shortly/helper.rb
150
- - README.textile
133
+ - README.markdown
151
134
  - spec/shortly_spec.rb
152
135
  - spec/spec_helper.rb
153
136
  - spec/support/fakeweb_stub.rb
154
- has_rdoc: true
155
137
  homepage: http://github.com/bagwanpankaj/shortly
156
138
  licenses:
157
139
  - MIT
@@ -181,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
163
  requirements: []
182
164
 
183
165
  rubyforge_project:
184
- rubygems_version: 1.3.7
166
+ rubygems_version: 1.8.10
185
167
  signing_key:
186
168
  specification_version: 3
187
169
  summary: Url Shortner Services Ruby Wrapper
@@ -189,3 +171,4 @@ test_files:
189
171
  - spec/shortly_spec.rb
190
172
  - spec/spec_helper.rb
191
173
  - spec/support/fakeweb_stub.rb
174
+ has_rdoc:
@@ -1,118 +0,0 @@
1
- h1. Shortly
2
-
3
- A Ruby wrapper for various url shortener services
4
-
5
- h2. Installation
6
-
7
- create a dependency in your Gemfile
8
- @gem 'shortly'@ then run
9
- @bundle install@
10
- and shortly will be up and running. or @gem install shortly@
11
-
12
- h2. Uses
13
-
14
- Currently Shortly supports three services (Bit.ly, Goo.gl, is.gd, tinyurl) Please do cross check by running Shortly.active_services. All supported methods have been provided for all services, so you can expect at least one method(shorten) will be available for every service.
15
-
16
- *Bit.ly*
17
-
18
- @bitly = Shortly::Clients::Bitly
19
- bitly.shorten('http://justatest.com', {:apiKey => 'R_your_api_key', :login => 'your_login'})@
20
-
21
- Optionally you can set apiKey and login beforehand (it would be more DRY i think if you only gonna use bitly services).
22
-
23
- @bitly = Shortly::Clients::Bitly@
24
- @bitly.apiKey = 'your_api_key'@
25
- @bitly.login = 'your_login'@
26
- @bitly.shorten('http://justatest.com').url@
27
- @bitly.expand('http://bit.ly/imshort').long_url@
28
-
29
- *Goo.gl*
30
-
31
- @googl = Shortly::Clients::Googl@
32
- @googl.shorten('http://justatest.com').shortUrl@
33
- @googl.expand('http://goo.gl/shrt').longUrl@
34
- @googl.analytics('http://goo.gl/shrt').analytics@
35
-
36
- *ShortSwitch* (Credit 'Steve Price (steveprice67)'. See Credits section)
37
-
38
- @shortswitch = Shortly::Clients::ShortSwitch@
39
- @shortswitch.apiKey = '<api-key>'@
40
- @shortswitch.shorten('http://justatest.com').shortUrl@
41
-
42
- *Is.gd*
43
-
44
- @isgd = Shortly::Clients::Isgd@
45
- @isgd.shorten('http://justatest.com').shorturl@
46
-
47
- *V.gd*
48
-
49
- @vgd = Shortly::Clients::Vgd@
50
- @vgd.shorten('http://justatest.com').shorturl@
51
-
52
- *Tinyurl.com*
53
-
54
- @tinyurl = Shortly::Clients::Tinyurl@
55
- @tinyurl.shorten('http://justatest.com').shorturl@
56
-
57
- *Sn.im*
58
- @snim = Shortly::Clients::Snim@
59
- @snim.apiKey = "<apiKey>"@
60
- @snim.login = "<login>"@
61
- @snim.shorten(long_url).shortUrl@
62
- @snim.expand(url_id/shorturl).url@
63
-
64
- h4. Command Line Utility
65
-
66
- Shortly also provides command line utility. See some uses below.
67
- @shortly 'http://shortme.com/'@
68
-
69
- By default it uses Googl to short urls but you can specify which service to use. Type @shortly -h@ for more info
70
- @shortly 'http://shortme.com/' -s bitly -l '<your-login>' -p '<your-apiKey>' -m method-to-use@
71
-
72
- here are options and there possible values:
73
-
74
- | *Options* | *What value do they take* |
75
- | -s or --service | Service to use(e.g. bitly, isgd(default googl)) |
76
- | -m or --method | Method to use(e.g. expand or shorten or analytics(default shorten)) |
77
- | -l or --login | Login credential(required for bitly) |
78
- | -p or --apiKey | API Key credentials (for bitly and googl(optional) only) |
79
-
80
- h5. Some more examples:
81
-
82
- * Google analytics
83
- @shortly 'http://averylong.url/that/can/frustate?you=many&times=true' -p my_api_key -m analytics@
84
- spits formatted json at CLI
85
-
86
- * Bitly
87
- @shortly 'http://bit.ly/shrt -s bitly -p my_api_key -l my_login -m expand@
88
-
89
- h2. Credits
90
-
91
- * "Steve Price(steveprice67)":https://github.com/steveprice67 (For implementing Lggd service support)
92
-
93
- h2. More Info
94
-
95
- For detailed info visit my blog "http://BagwanPankaj.com":http://bagwanpankaj.com
96
-
97
- For more info write me at bagwanpankaj[at]gmail.com or me[at]bagwanpankaj.com
98
-
99
- Copyright (c) 2010 Bagwan Pankaj: http://bagwanpankaj.com, released under the MIT license
100
-
101
- h2. TODO's
102
-
103
- * Better documentation
104
- * Example series
105
-
106
- h2. Contributing to shortly
107
-
108
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
109
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
110
- * Fork the project
111
- * Start a feature/bugfix branch
112
- * Commit and push until you are happy with your contribution
113
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
114
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
115
-
116
- h2. Copyright
117
-
118
- Copyright (c) 2010 [Bagwan Pankaj]. See LICENSE.txt for further details.