cloudpt-api 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,8 +9,8 @@ module Cloudpt
9
9
  response = yield
10
10
  raise Cloudpt::API::Error::ConnectionFailed if !response
11
11
  status = response.code.to_i
12
- #puts "STATUS:#{status}"
13
- #puts "PAYLOAD:\n#{response.body}"
12
+ puts "STATUS:#{status}"
13
+ puts "PAYLOAD:\n#{response.body}"
14
14
  case status
15
15
  when 401
16
16
  raise Cloudpt::API::Error::Unauthorized
@@ -35,7 +35,7 @@ module Cloudpt
35
35
 
36
36
  def get_raw(endpoint, path, data = {}, headers = {})
37
37
  query = Cloudpt::API::Util.query(data)
38
- #puts "GET #{Cloudpt::API::Config.prefix}#{path}?#{URI.parse(URI.encode(query))}"
38
+ puts "GET #{Cloudpt::API::Config.prefix}#{path}?#{URI.parse(URI.encode(query))}"
39
39
  request(:raw => true) do
40
40
  token(endpoint).get "#{Cloudpt::API::Config.prefix}#{path}?#{URI.parse(URI.encode(query))}", headers
41
41
  end
@@ -44,23 +44,23 @@ module Cloudpt
44
44
  def get(endpoint, path, data = {}, headers = {})
45
45
  query = Cloudpt::API::Util.query(data)
46
46
  query = "?#{URI.parse(URI.encode(query))}" unless query.empty?
47
- #puts "GET #{Cloudpt::API::Config.prefix}#{path}#{query}"
47
+ puts "GET #{Cloudpt::API::Config.prefix}#{path}#{query}"
48
48
  request do
49
49
  token(endpoint).get "#{Cloudpt::API::Config.prefix}#{path}#{query}", headers
50
50
  end
51
51
  end
52
52
 
53
53
  def post(endpoint, path, data = {}, headers = {})
54
- #puts "POST #{Cloudpt::API::Config.prefix}#{path}"
55
- #puts "BODY:\n#{data}"
54
+ puts "POST #{Cloudpt::API::Config.prefix}#{path}"
55
+ puts "BODY:\n#{data}"
56
56
  request do
57
57
  token(endpoint).post "#{Cloudpt::API::Config.prefix}#{path}", data, headers
58
58
  end
59
59
  end
60
60
 
61
61
  def put(endpoint, path, data = {}, headers = {})
62
- #puts "PUT #{Cloudpt::API::Config.prefix}#{path}"
63
- #puts "BODY:\n#{data}"
62
+ puts "PUT #{Cloudpt::API::Config.prefix}#{path}"
63
+ puts "BODY:\n#{data}"
64
64
  request do
65
65
  token(endpoint).put "#{Cloudpt::API::Config.prefix}#{path}", data, headers
66
66
  end
@@ -1,5 +1,5 @@
1
1
  module Cloudpt
2
2
  module API
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -170,12 +170,12 @@ describe Cloudpt::API::Client do
170
170
  response = @client.search "searchable-test-copy-#{Cloudpt::Spec.namespace}", :path => "#{Cloudpt::Spec.test_dir}"
171
171
  ref = response.first.copy_ref
172
172
  ref.should_not == nil
173
- the_copy_ref = ref['copy-ref']
173
+ the_copy_ref = ref['copy_ref']
174
174
  the_copy_ref.should_not == nil
175
- @client.copy_from_copy_ref the_copy_ref, "#{filename}.copied"
175
+ @client.copy_from_copy_ref the_copy_ref, "/#{filename}.copied", {:from_path => "/#{filename}"}
176
176
  sleep(2)
177
- response = @client.search "searchable-test-copy-#{Cloudpt::Spec.namespace}.txt.copied", :path => "#{Cloudpt::Spec.test_dir}"
178
- response.size.should == 1
177
+ response = @client.search "searchable-test-copy-#{Cloudpt::Spec.namespace}", :path => "#{Cloudpt::Spec.test_dir}"
178
+ response.size.should == 2
179
179
  response.first.class.should == Cloudpt::API::File
180
180
  end
181
181
 
@@ -47,7 +47,7 @@ describe Cloudpt::API::File do
47
47
 
48
48
  it "retrieves all revisions as an Array of File objects" do
49
49
  sleep(2)
50
- @client.upload @file.path, "Updated content", {'overwrite' => true, :method => :post}
50
+ @client.upload @file.path, "Updated content", {'overwrite' => true, :method => :post, 'parent_rev' => @file.rev}
51
51
  #FAIL AT SERVER ?
52
52
  revisions = @file.revisions
53
53
  revisions.size.should == 2
@@ -61,10 +61,11 @@ describe Cloudpt::API::File do
61
61
  it "restores the file to a specific revision" do
62
62
  old_rev = @file.rev
63
63
 
64
- @client.upload @file.path, "Updated content"
64
+ @client.upload @file.path, "Updated content", {'overwrite' => true, :method => :post, 'parent_rev' => old_rev}
65
65
 
66
66
  file = @filename.split('/').last
67
-
67
+
68
+ sleep(2)
68
69
  found = @client.find(@file.path)
69
70
 
70
71
  found.rev.should_not == old_rev
@@ -73,6 +74,7 @@ describe Cloudpt::API::File do
73
74
 
74
75
  @file.restore(old_rev)
75
76
 
77
+ sleep(2)
76
78
  found = @client.find(@file.path)
77
79
 
78
80
  found.rev.should_not == old_rev
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudpt-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-27 00:00:00.000000000 Z
12
+ date: 2013-03-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json