panda 0.4.9 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/panda/panda.rb +18 -8
- data/panda.gemspec +5 -5
- data/spec/panda_spec.rb +13 -0
- metadata +6 -6
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ begin
|
|
15
15
|
gem.add_development_dependency "fakeweb-matcher"
|
16
16
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
17
|
gem.add_dependency "ruby-hmac", ">= 0.3.2"
|
18
|
-
gem.add_dependency "rest-client", ">= 1.
|
18
|
+
gem.add_dependency "rest-client", ">= 1.5"
|
19
19
|
end
|
20
20
|
Jeweler::GemcutterTasks.new
|
21
21
|
rescue LoadError
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/lib/panda/panda.rb
CHANGED
@@ -5,24 +5,24 @@ class Panda
|
|
5
5
|
@@connection = Connection.new(auth_params)
|
6
6
|
end
|
7
7
|
|
8
|
-
def self.get(request_uri, params={})
|
9
|
-
|
8
|
+
def self.get(request_uri, params={})
|
9
|
+
connection.get(request_uri, params)
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.post(request_uri, params)
|
13
|
-
|
13
|
+
connection.post(request_uri, params)
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.put(request_uri, params)
|
17
|
-
|
17
|
+
connection.put(request_uri, params)
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.delete(request_uri, params={})
|
21
|
-
|
21
|
+
connection.delete(request_uri, params)
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.setup_bucket(params={})
|
25
|
-
|
25
|
+
connection.setup_bucket(params)
|
26
26
|
end
|
27
27
|
|
28
28
|
def self.authentication_params(*params)
|
@@ -30,7 +30,17 @@ class Panda
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def self.signed_params(verb, request_uri, params = {}, timestamp_str = nil)
|
33
|
-
|
33
|
+
connection.signed_params(verb, request_uri, params, timestamp_str)
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def self.connection
|
39
|
+
if defined?(@@connection)
|
40
|
+
@@connection
|
41
|
+
else
|
42
|
+
raise "Not connected. Please connect! first."
|
43
|
+
end
|
34
44
|
end
|
35
45
|
|
36
46
|
class Connection
|
@@ -87,7 +97,7 @@ class Panda
|
|
87
97
|
auth_params['access_key'] = @access_key
|
88
98
|
auth_params['timestamp'] = timestamp_str || Time.now.iso8601(6)
|
89
99
|
|
90
|
-
params_to_sign = auth_params.reject{|k,v| ['file'].include?(k)}
|
100
|
+
params_to_sign = auth_params.reject{|k,v| ['file'].include?(k.to_s)}
|
91
101
|
auth_params['signature'] = ApiAuthentication.generate_signature(verb, request_uri, @api_host, @secret_key, params_to_sign)
|
92
102
|
auth_params
|
93
103
|
end
|
data/panda.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{panda}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.5.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["New Bamboo"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-05-06}
|
13
13
|
s.description = %q{Panda Client}
|
14
14
|
s.email = %q{info@pandastream.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -50,20 +50,20 @@ Gem::Specification.new do |s|
|
|
50
50
|
s.add_development_dependency(%q<fakeweb>, [">= 0"])
|
51
51
|
s.add_development_dependency(%q<fakeweb-matcher>, [">= 0"])
|
52
52
|
s.add_runtime_dependency(%q<ruby-hmac>, [">= 0.3.2"])
|
53
|
-
s.add_runtime_dependency(%q<rest-client>, [">= 1.
|
53
|
+
s.add_runtime_dependency(%q<rest-client>, [">= 1.5"])
|
54
54
|
else
|
55
55
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
56
56
|
s.add_dependency(%q<fakeweb>, [">= 0"])
|
57
57
|
s.add_dependency(%q<fakeweb-matcher>, [">= 0"])
|
58
58
|
s.add_dependency(%q<ruby-hmac>, [">= 0.3.2"])
|
59
|
-
s.add_dependency(%q<rest-client>, [">= 1.
|
59
|
+
s.add_dependency(%q<rest-client>, [">= 1.5"])
|
60
60
|
end
|
61
61
|
else
|
62
62
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
63
63
|
s.add_dependency(%q<fakeweb>, [">= 0"])
|
64
64
|
s.add_dependency(%q<fakeweb-matcher>, [">= 0"])
|
65
65
|
s.add_dependency(%q<ruby-hmac>, [">= 0.3.2"])
|
66
|
-
s.add_dependency(%q<rest-client>, [">= 1.
|
66
|
+
s.add_dependency(%q<rest-client>, [">= 1.5"])
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
data/spec/panda_spec.rb
CHANGED
@@ -5,6 +5,18 @@ describe Panda do
|
|
5
5
|
FakeWeb.allow_net_connect = false
|
6
6
|
Time.stub!(:now).and_return(mock("time", :iso8601 => "2009-11-04T17:54:11+00:00"))
|
7
7
|
end
|
8
|
+
|
9
|
+
describe "when not connected" do
|
10
|
+
|
11
|
+
["get", "post", "put", "delete"].each do |method|
|
12
|
+
it "should raise error for #{method}" do
|
13
|
+
lambda {
|
14
|
+
Panda.send(method, nil, nil)
|
15
|
+
}.should raise_error("Not connected. Please connect! first.")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
8
20
|
|
9
21
|
describe "Connected", :shared => true do
|
10
22
|
|
@@ -98,6 +110,7 @@ describe Panda do
|
|
98
110
|
end
|
99
111
|
it_should_behave_like "Connected"
|
100
112
|
end
|
113
|
+
|
101
114
|
describe "Panda::Connection.new" do
|
102
115
|
before(:each) do
|
103
116
|
@panda = Panda::Connection.new({"access_key" => "my_access_key", "secret_key" => "my_secret_key", "api_host" => "myapihost", "api_port" => 85, "cloud_id" => 'my_cloud_id' })
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 5
|
8
|
+
- 0
|
9
|
+
version: 0.5.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- New Bamboo
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-05-06 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -78,8 +78,8 @@ dependencies:
|
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
segments:
|
80
80
|
- 1
|
81
|
-
-
|
82
|
-
version: "1.
|
81
|
+
- 5
|
82
|
+
version: "1.5"
|
83
83
|
type: :runtime
|
84
84
|
version_requirements: *id005
|
85
85
|
description: Panda Client
|