panda 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +11 -0
- data/lib/panda/base.rb +1 -1
- data/lib/panda/modules/builders.rb +1 -1
- data/lib/panda/modules/updatable.rb +6 -3
- data/lib/panda/resources/resource.rb +6 -0
- data/lib/panda/version.rb +1 -1
- data/spec/cloud_spec.rb +13 -0
- data/spec/video_spec.rb +13 -0
- metadata +4 -4
data/CHANGELOG.md
CHANGED
data/lib/panda/base.rb
CHANGED
@@ -6,18 +6,21 @@ module Panda
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def save!
|
9
|
-
save || raise(
|
9
|
+
save || raise(errors.last)
|
10
10
|
end
|
11
11
|
|
12
12
|
def update_attribute(name, value)
|
13
|
-
|
14
|
-
self.save
|
13
|
+
send("#{name}=".to_sym, value) && save
|
15
14
|
end
|
16
15
|
|
17
16
|
def update_attributes(attributes)
|
18
17
|
load(attributes) && save
|
19
18
|
end
|
20
19
|
|
20
|
+
def update_attributes!(attributes)
|
21
|
+
update_attributes(attributes) || raise(errors.last)
|
22
|
+
end
|
23
|
+
|
21
24
|
def update
|
22
25
|
uri = replace_pattern_with_self_variables(self.class.one_path)
|
23
26
|
response = connection.put(uri, @changed_attributes)
|
data/lib/panda/version.rb
CHANGED
data/spec/cloud_spec.rb
CHANGED
@@ -111,6 +111,19 @@ describe Panda::Cloud do
|
|
111
111
|
@cloud = Panda::Cloud.create(:s3_videos_bucket => 'videobucket', :user_aws_key => 'myaccesskey', :user_aws_secret => 'mysecretkey')
|
112
112
|
@cloud.s3_videos_bucket.should == "videobucket"
|
113
113
|
end
|
114
|
+
|
115
|
+
|
116
|
+
it "should create a cloud and reload" do
|
117
|
+
cloud_json = "{\"s3_videos_bucket\":\"videobucket\",\"id\":\"my_new_cloud_id\"}"
|
118
|
+
stub_http_request(:post, /http:\/\/api.example.com:85\/v2\/clouds.json/).
|
119
|
+
to_return(:body => cloud_json)
|
120
|
+
|
121
|
+
stub_http_request(:get, /api.example.com:85\/v2\/clouds\/my_new_cloud_id.json/).
|
122
|
+
to_return(:body => cloud_json)
|
123
|
+
|
124
|
+
@cloud = Panda::Cloud.create(:s3_videos_bucket => 'videobucket', :user_aws_key => 'myaccesskey', :user_aws_secret => 'mysecretkey')
|
125
|
+
@cloud.reload.should == @cloud
|
126
|
+
end
|
114
127
|
|
115
128
|
end
|
116
129
|
|
data/spec/video_spec.rb
CHANGED
@@ -183,6 +183,19 @@ describe Panda::Video do
|
|
183
183
|
video.id.should == "123"
|
184
184
|
end
|
185
185
|
|
186
|
+
it "should create a video and reload" do
|
187
|
+
video_json = "{\"source_url\":\"url_panda.mp4\",\"id\":\"123\"}"
|
188
|
+
|
189
|
+
stub_http_request(:post, /api.example.com:85\/v2\/videos.json/).
|
190
|
+
with(:body => /source_url=url_panda.mp4/).
|
191
|
+
to_return(:body => video_json)
|
192
|
+
|
193
|
+
stub_http_request(:get, /api.example.com:85\/v2\/videos\/123.json/).to_return(:body => video_json)
|
194
|
+
|
195
|
+
video = Panda::Video.create(:source_url => "url_panda.mp4")
|
196
|
+
video.reload.should == video
|
197
|
+
end
|
198
|
+
|
186
199
|
it "should create a video using class method and a block" do
|
187
200
|
video_json = "{\"source_url\":\"url_panda.mp4\",\"id\":\"123\"}"
|
188
201
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: panda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 1.4.
|
9
|
+
- 2
|
10
|
+
version: 1.4.2
|
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: 2011-02-
|
18
|
+
date: 2011-02-16 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|