bitly-oauth 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -2
- data/lib/bitly_oauth/client.rb +1 -1
- data/lib/bitly_oauth/lib/core_ext/hash.rb +15 -13
- data/lib/bitly_oauth/version.rb +1 -1
- data/test/unit/core_ext/test_hash.rb +12 -9
- metadata +20 -14
data/Gemfile.lock
CHANGED
data/lib/bitly_oauth/client.rb
CHANGED
@@ -1,17 +1,4 @@
|
|
1
1
|
class Hash
|
2
|
-
def to_query
|
3
|
-
map do |key, value|
|
4
|
-
case value
|
5
|
-
when Array
|
6
|
-
value.map do |v|
|
7
|
-
"#{key}=#{CGI.escape(v.to_s)}"
|
8
|
-
end.join('&')
|
9
|
-
else
|
10
|
-
"#{key}=#{CGI.escape(value.to_s)}"
|
11
|
-
end
|
12
|
-
end.sort * '&'
|
13
|
-
end
|
14
|
-
|
15
2
|
def stringify_keys!
|
16
3
|
keys.each do |key|
|
17
4
|
self[key.to_s] = delete(key)
|
@@ -34,3 +21,18 @@ class Hash
|
|
34
21
|
dup.symbolize_keys!
|
35
22
|
end
|
36
23
|
end
|
24
|
+
|
25
|
+
class ParamsHash < Hash
|
26
|
+
def to_query
|
27
|
+
map do |key, value|
|
28
|
+
case value
|
29
|
+
when Array
|
30
|
+
value.map do |v|
|
31
|
+
"#{key}=#{CGI.escape(v.to_s)}"
|
32
|
+
end.join('&')
|
33
|
+
else
|
34
|
+
"#{key}=#{CGI.escape(value.to_s)}"
|
35
|
+
end
|
36
|
+
end.sort * '&'
|
37
|
+
end
|
38
|
+
end
|
data/lib/bitly_oauth/version.rb
CHANGED
@@ -1,15 +1,6 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class TestHash < Test::Unit::TestCase
|
4
|
-
context "calling #to_params" do
|
5
|
-
setup do
|
6
|
-
@hash = { :one => 1, :two => 2 }
|
7
|
-
end
|
8
|
-
should "return a string of key=value&" do
|
9
|
-
assert_equal @hash.to_query, "one=1&two=2"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
4
|
context "calling #stringify_keys!" do
|
14
5
|
setup do
|
15
6
|
@hash = { :one => 1, :two => 2 }
|
@@ -67,3 +58,15 @@ class TestHash < Test::Unit::TestCase
|
|
67
58
|
end
|
68
59
|
end
|
69
60
|
end
|
61
|
+
|
62
|
+
|
63
|
+
class TestParamsHash < Test::Unit::TestCase
|
64
|
+
context "calling #to_params" do
|
65
|
+
setup do
|
66
|
+
@hash = ParamsHash[ { :one => 1, :two => 2 } ]
|
67
|
+
end
|
68
|
+
should "return a string of key=value&" do
|
69
|
+
assert_equal @hash.to_query, "one=1&two=2"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bitly-oauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
16
|
-
requirement: &
|
16
|
+
requirement: &70096900223680 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70096900223680
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: oauth2
|
27
|
-
requirement: &
|
27
|
+
requirement: &70096900223020 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70096900223020
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: shoulda
|
38
|
-
requirement: &
|
38
|
+
requirement: &70096900222160 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70096900222160
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
|
-
requirement: &
|
49
|
+
requirement: &70096900221720 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70096900221720
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: mocha
|
60
|
-
requirement: &
|
60
|
+
requirement: &70096900221300 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70096900221300
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: fakeweb
|
71
|
-
requirement: &
|
71
|
+
requirement: &70096900220800 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70096900220800
|
80
80
|
description: ! 'A ruby wrapper for version 3 of the bit.ly API
|
81
81
|
|
82
82
|
Supports OAuth authentication
|
@@ -193,12 +193,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
193
193
|
- - ! '>='
|
194
194
|
- !ruby/object:Gem::Version
|
195
195
|
version: '0'
|
196
|
+
segments:
|
197
|
+
- 0
|
198
|
+
hash: -2262144850303091368
|
196
199
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
200
|
none: false
|
198
201
|
requirements:
|
199
202
|
- - ! '>='
|
200
203
|
- !ruby/object:Gem::Version
|
201
204
|
version: '0'
|
205
|
+
segments:
|
206
|
+
- 0
|
207
|
+
hash: -2262144850303091368
|
202
208
|
requirements: []
|
203
209
|
rubyforge_project:
|
204
210
|
rubygems_version: 1.8.10
|