panda 1.2.2 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -19,19 +19,12 @@ Panda gem provides an interface to access the [Panda](http://pandastream.com) AP
19
19
  config.access_key = "panda_access_key"
20
20
  config.secret_key = "panda_secret_key"
21
21
  config.cloud_id = "panda_cloud_id"
22
+ # config.api_host = "api.eu.pandastream.com" ## for EU accounts
23
+ # config.api_port = 80 ## to use http (default 443)
22
24
  end
23
25
 
24
26
  or Panda.configure({:access_key => ....})
25
27
 
26
- ### Creating an instance of the client for EU
27
-
28
- Panda.configure do |config|
29
- config.access_key = "panda_access_key"
30
- config.secret_key = "panda_secret_key"
31
- config.cloud_id = "panda_cloud_id"
32
- config.api_host = "api.eu.pandastream.com"
33
- end
34
-
35
28
  ### Creating an instance using Heroku
36
29
 
37
30
  Panda.configure(ENV['PANDASTREAM_URL'])
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.2
1
+ 1.3.0
@@ -2,7 +2,7 @@ module Panda
2
2
  class Connection
3
3
  attr_accessor :api_host, :api_port, :access_key, :secret_key, :api_version, :cloud_id, :format
4
4
 
5
- API_PORT=80
5
+ API_PORT=443
6
6
  US_API_HOST="api.pandastream.com"
7
7
  EU_API_HOST="api.eu.pandastream.com"
8
8
 
@@ -88,19 +88,23 @@ module Panda
88
88
 
89
89
  def signed_params(verb, request_uri, params = {}, timestamp_str = nil)
90
90
  auth_params = stringify_keys(params)
91
- auth_params['cloud_id'] = @cloud_id
92
- auth_params['access_key'] = @access_key
91
+ auth_params['cloud_id'] = cloud_id
92
+ auth_params['access_key'] = access_key
93
93
  auth_params['timestamp'] = timestamp_str || Time.now.iso8601(6)
94
94
 
95
95
  params_to_sign = auth_params.reject{|k,v| ['file'].include?(k.to_s)}
96
- auth_params['signature'] = ApiAuthentication.generate_signature(verb, request_uri, @api_host, @secret_key, params_to_sign)
96
+ auth_params['signature'] = ApiAuthentication.generate_signature(verb, request_uri, api_host, secret_key, params_to_sign)
97
97
  auth_params
98
98
  end
99
99
 
100
100
  def api_url
101
- "http://#{@api_host}:#{@api_port}/#{@prefix}"
101
+ "#{api_protocol}://#{api_host}:#{api_port}/#{@prefix}"
102
102
  end
103
103
 
104
+ def api_protocol
105
+ api_port == 443 ? 'https' : 'http'
106
+ end
107
+
104
108
  # Shortcut to setup your bucket
105
109
  def setup_bucket(params={})
106
110
  granting_params = {
@@ -171,7 +175,7 @@ module Panda
171
175
  @cloud_id = heroku_uri.path[1..-1]
172
176
  @api_host = heroku_uri.host
173
177
  @api_port = heroku_uri.port
174
- @prefix = "v#{@api_version}"
178
+ @prefix = "v#{api_version}"
175
179
  end
176
180
 
177
181
  def init_from_hash(hash_params)
@@ -182,7 +186,7 @@ module Panda
182
186
  @secret_key = params["secret_key"] || params[:secret_key]
183
187
  @api_host = params["api_host"] || params[:api_host]
184
188
  @api_port = params["api_port"] || params[:api_port]
185
- @prefix = params["prefix_url"] || "v#{@api_version}"
189
+ @prefix = params["prefix_url"] || "v#{api_version}"
186
190
  end
187
191
  end
188
192
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{panda}
8
- s.version = "1.2.2"
8
+ s.version = "1.3.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-08}
12
+ s.date = %q{2011-01-10}
13
13
  s.description = %q{Panda Client}
14
14
  s.email = %q{info@pandastream.com}
15
15
  s.extra_rdoc_files = [
@@ -116,7 +116,7 @@ describe Panda::Video do
116
116
  c.region = "eu"
117
117
  end
118
118
 
119
- stub_http_request(:get, /api.eu.pandastream.com:80/).
119
+ stub_http_request(:get, /api.eu.pandastream.com:443/).
120
120
  to_return(:body => "{\"id\":\"123\"}")
121
121
  Panda::Video.find "123"
122
122
  end
@@ -133,7 +133,7 @@ describe Panda::Video do
133
133
  c.region = "eu"
134
134
  end
135
135
 
136
- stub_http_request(:get, /api.eu.pandastream.com:80/).
136
+ stub_http_request(:get, /api.eu.pandastream.com:443/).
137
137
  to_return(:body => "{\"id\":\"123\"}")
138
138
  Panda::Video.find "123"
139
139
  end
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
- - 2
9
- - 2
10
- version: 1.2.2
8
+ - 3
9
+ - 0
10
+ version: 1.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - New Bamboo
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-08 00:00:00 +00:00
18
+ date: 2011-01-10 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency