swift_client 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+
2
+ rvm:
3
+ - 2.0.0
4
+ - 2.1.7
5
+ - 2.2.3
6
+
7
+ install:
8
+ - "travis_retry bundle install"
9
+
10
+ script: "bundle exec rake test"
11
+
12
+ sudo: false
13
+
data/README.md CHANGED
@@ -1,3 +1,8 @@
1
+ [![Build Status](https://secure.travis-ci.org/mrkamel/swift_client.png?branch=master)](http://travis-ci.org/mrkamel/swift_client)
2
+ [![Code Climate](https://codeclimate.com/github/mrkamel/swift_client.png)](https://codeclimate.com/github/mrkamel/swift_client)
3
+ [![Dependency Status](https://gemnasium.com/mrkamel/swift_client.png?travis)](https://gemnasium.com/mrkamel/swift_client)
4
+ [![Gem Version](https://badge.fury.io/rb/swift_client.svg)](http://badge.fury.io/rb/swift_client)
5
+
1
6
  # SwiftClient
2
7
 
3
8
  Small but powerful client to interact with OpenStack Swift.
@@ -66,7 +71,7 @@ SwiftClient offers the following requests:
66
71
  * head_object(object_name, container_name) -> HTTParty::Response
67
72
  * delete_object(object_name, container_name) -> HTTParty::Response
68
73
  * get_objects(container_name, query = {}) -> HTTParty::Response
69
- * paginate_objetcs(container_name, query = {}) -> Enumerator
74
+ * paginate_objects(container_name, query = {}) -> Enumerator
70
75
  * public_url(object_name, container_name) -> HTTParty::Response
71
76
  * temp_url(object_name, container_name) -> HTTParty::Response
72
77
 
data/lib/swift_client.rb CHANGED
@@ -172,6 +172,8 @@ class SwiftClient
172
172
  if response.code == 401
173
173
  authenticate
174
174
 
175
+ opts[:body_stream].rewind if opts[:body_stream].respond_to?(:rewind)
176
+
175
177
  return request(method, path, opts)
176
178
  end
177
179
 
@@ -1,5 +1,5 @@
1
1
 
2
2
  class SwiftClient
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
 
@@ -136,6 +136,12 @@ class SwiftClientTest < MiniTest::Test
136
136
  assert_equal 201, @swift_client.put_object("object", "data", "container", "X-Object-Meta-Test" => "Test").code
137
137
  end
138
138
 
139
+ def test_put_object_with_renewed_authorization
140
+ stub_request(:put, "https://example.com/v1/AUTH_account/container/object").with(:body => "data", :headers => { "Transfer-Encoding" => "chunked", "Content-Type" => "application/octet-stream", "Accept" => "application/json", "X-Auth-Token" => "Token" }).to_return({ :status => 401, :body => "", :headers => {}}, { :status => 201, :body => "", :headers => {}})
141
+
142
+ assert_equal 201, @swift_client.put_object("object", "data", "container").code
143
+ end
144
+
139
145
  def test_put_object_without_mime_type
140
146
  stub_request(:put, "https://example.com/v1/AUTH_account/container/object.jpg").with(:body => "data", :headers => { "Transfer-Encoding" => "chunked", "Accept" => "application/json", "Content-Type" => "image/jpeg", "X-Auth-Token" => "Token", "X-Object-Meta-Test" => "Test" }).to_return(:status => 201, :body => "", :headers => {})
141
147
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swift_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
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: 2015-04-28 00:00:00.000000000 Z
12
+ date: 2015-12-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -115,6 +115,7 @@ extensions: []
115
115
  extra_rdoc_files: []
116
116
  files:
117
117
  - .gitignore
118
+ - .travis.yml
118
119
  - Gemfile
119
120
  - LICENSE.txt
120
121
  - README.md