swift_client 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f508dc3170899b3d306bf359c0d2df09edf0a694
4
- data.tar.gz: a2ec9c73c26ca3ba8d7eb4b374d3d6c92acfb7d2
3
+ metadata.gz: fccb39365e39660b890e410ee46cf56f7b7bcbe5
4
+ data.tar.gz: d2aad7789aed1011afcdea3f986c30499254bf06
5
5
  SHA512:
6
- metadata.gz: 79cdf304996ef393d92c032d0da81ed9cb57c0cb8c17b3262f6854b722140293075202a3b7b6bc1b8d4049d137ab52d1a6dc9ac51504447b1ed44bca7d47d81f
7
- data.tar.gz: ad166b66f8aa123e6a8ceda6d5acab0125a50034f20347af008cded08b00e4f0b5e35bf660110ae694bb46364f51bdeddc357b481494f21cad76b548d6307b1d
6
+ metadata.gz: d7b6aaf0e442f0a1f594333e86c6850d94c3e934746c98e588d5714fdbedaa72e92eae795e0df4389d7d8c5a739830f9be71272e9e73dff562c399f9f575383d
7
+ data.tar.gz: 27c8cbceabbb49bf1a000f80af014e0b22117e2813829d26dc22ef30cd3a63c4280fd7516cb0f1111ff75f36a80f4f402cd65c112385440c3e5b97ed99bf66e9
data/.travis.yml CHANGED
@@ -1,9 +1,8 @@
1
1
 
2
2
  rvm:
3
- - 1.9.3
4
- - 2.0.0
5
- - 2.1.7
6
- - 2.2.3
3
+ - 2.1.10
4
+ - 2.2.5
5
+ - 2.3.1
7
6
 
8
7
  install:
9
8
  - "travis_retry bundle install"
data/README.md CHANGED
@@ -126,28 +126,28 @@ access the response body and JSON response. Checkout the
126
126
 
127
127
  SwiftClient offers the following requests:
128
128
 
129
- * head_account -> HTTParty::Response
130
- * post_account(headers = {}) -> HTTParty::Response
131
- * head_containers -> HTTParty::Response
132
- * get_containers(query = {}) -> HTTParty::Response
133
- * paginate_containers(query = {}) -> Enumerator
134
- * get_container(container_name, query = {}) -> HTTParty::Response
135
- * paginate_container(container_name, query = {}) -> Enumerator
136
- * head_container(container_name) -> HTTParty::Response
137
- * put_container(container_name, headers = {}) -> HTTParty::Response
138
- * post_container(container_name, headers = {}) -> HTTParty::Response
139
- * delete_container(container_name) -> HTTParty::Response
140
- * put_object(object_name, data_or_io, container_name, headers = {}) -> HTTParty::Response
141
- * post_object(object_name, container_name, headers = {}) -> HTTParty::Response
142
- * get_object(object_name, container_name) -> HTTParty::Response
143
- * get_object(object_name, container_name){|chunk| save chunk } -> HTTParty::Response
144
- * head_object(object_name, container_name) -> HTTParty::Response
145
- * delete_object(object_name, container_name) -> HTTParty::Response
146
- * get_objects(container_name, query = {}) -> HTTParty::Response
147
- * paginate_objects(container_name, query = {}) -> Enumerator
129
+ * head_account(options = {}) -> HTTParty::Response
130
+ * post_account(headers = {}, options = {}) -> HTTParty::Response
131
+ * head_containers(options = {}) -> HTTParty::Response
132
+ * get_containers(query = {}, options = {}) -> HTTParty::Response
133
+ * paginate_containers(query = {}, options = {}) -> Enumerator
134
+ * get_container(container_name, query = {}, options = {}) -> HTTParty::Response
135
+ * paginate_container(container_name, query = {}, options = {}) -> Enumerator
136
+ * head_container(container_name, options = {}) -> HTTParty::Response
137
+ * put_container(container_name, headers = {}, options = {}) -> HTTParty::Response
138
+ * post_container(container_name, headers = {}, options = {}) -> HTTParty::Response
139
+ * delete_container(container_name, options = {}) -> HTTParty::Response
140
+ * put_object(object_name, data_or_io, container_name, headers = {}, options = {}) -> HTTParty::Response
141
+ * post_object(object_name, container_name, headers = {}, options = {}) -> HTTParty::Response
142
+ * get_object(object_name, container_name, options = {}) -> HTTParty::Response
143
+ * get_object(object_name, container_name, options = {}) { |chunk| save chunk } -> HTTParty::Response
144
+ * head_object(object_name, container_name, options = {}) -> HTTParty::Response
145
+ * delete_object(object_name, container_name, options = {}) -> HTTParty::Response
146
+ * get_objects(container_name, query = {}, options = {}) -> HTTParty::Response
147
+ * paginate_objects(container_name, query = {}, options = {}) -> Enumerator
148
148
  * public_url(object_name, container_name) -> HTTParty::Response
149
149
  * temp_url(object_name, container_name, options = {}) -> HTTParty::Response
150
- * bulk_delete(entries) -> entries
150
+ * bulk_delete(entries, options = {}) -> entries
151
151
 
152
152
  ### Getting large objects
153
153
  The `get_object` method with out a block is suitable for small objects that easily fit in memory. For larger objects, specify a block to process chunked data as it comes in.
data/lib/swift_client.rb CHANGED
@@ -37,61 +37,61 @@ class SwiftClient
37
37
  authenticate
38
38
  end
39
39
 
40
- def head_account
41
- request :head, "/"
40
+ def head_account(options = {})
41
+ request :head, "/", options
42
42
  end
43
43
 
44
- def post_account(headers = {})
45
- request :post, "/", :headers => headers
44
+ def post_account(headers = {}, options = {})
45
+ request :post, "/", options.merge(:headers => headers)
46
46
  end
47
47
 
48
- def head_containers
49
- request :head, "/"
48
+ def head_containers(options = {})
49
+ request :head, "/", options
50
50
  end
51
51
 
52
- def get_containers(query = {})
53
- request :get, "/", :query => query
52
+ def get_containers(query = {}, options = {})
53
+ request :get, "/", options.merge(:query => query)
54
54
  end
55
55
 
56
- def paginate_containers(query = {}, &block)
57
- paginate :get_containers, query, &block
56
+ def paginate_containers(query = {}, options = {}, &block)
57
+ paginate(:get_containers, query, options, &block)
58
58
  end
59
59
 
60
- def get_container(container_name, query = {})
60
+ def get_container(container_name, query = {}, options = {})
61
61
  raise(EmptyNameError) if container_name.empty?
62
62
 
63
- request :get, "/#{container_name}", :query => query
63
+ request :get, "/#{container_name}", options.merge(:query => query)
64
64
  end
65
65
 
66
- def paginate_container(container_name, query = {}, &block)
67
- paginate :get_container, container_name, query, &block
66
+ def paginate_container(container_name, query = {}, options = {}, &block)
67
+ paginate(:get_container, container_name, query, options, &block)
68
68
  end
69
69
 
70
- def head_container(container_name)
70
+ def head_container(container_name, options = {})
71
71
  raise(EmptyNameError) if container_name.empty?
72
72
 
73
- request :head, "/#{container_name}"
73
+ request :head, "/#{container_name}", options
74
74
  end
75
75
 
76
- def put_container(container_name, headers = {})
76
+ def put_container(container_name, headers = {}, options = {})
77
77
  raise(EmptyNameError) if container_name.empty?
78
78
 
79
- request :put, "/#{container_name}", :headers => headers
79
+ request :put, "/#{container_name}", options.merge(:headers => headers)
80
80
  end
81
81
 
82
- def post_container(container_name, headers = {})
82
+ def post_container(container_name, headers = {}, options = {})
83
83
  raise(EmptyNameError) if container_name.empty?
84
84
 
85
- request :post, "/#{container_name}", :headers => headers
85
+ request :post, "/#{container_name}", options.merge(:headers => headers)
86
86
  end
87
87
 
88
- def delete_container(container_name)
88
+ def delete_container(container_name, options = {})
89
89
  raise(EmptyNameError) if container_name.empty?
90
90
 
91
- request :delete, "/#{container_name}"
91
+ request :delete, "/#{container_name}", options
92
92
  end
93
93
 
94
- def put_object(object_name, data_or_io, container_name, headers = {})
94
+ def put_object(object_name, data_or_io, container_name, headers = {}, options = {})
95
95
  raise(EmptyNameError) if object_name.empty? || container_name.empty?
96
96
 
97
97
  mime_type = MIME::Types.of(object_name).first
@@ -105,41 +105,41 @@ class SwiftClient
105
105
 
106
106
  extended_headers["Transfer-Encoding"] = "chunked"
107
107
 
108
- request :put, "/#{container_name}/#{object_name}", :body_stream => data_or_io.respond_to?(:read) ? data_or_io : StringIO.new(data_or_io), :headers => extended_headers
108
+ request :put, "/#{container_name}/#{object_name}", options.merge(:body_stream => data_or_io.respond_to?(:read) ? data_or_io : StringIO.new(data_or_io), :headers => extended_headers)
109
109
  end
110
110
 
111
- def post_object(object_name, container_name, headers = {})
111
+ def post_object(object_name, container_name, headers = {}, options = {})
112
112
  raise(EmptyNameError) if object_name.empty? || container_name.empty?
113
113
 
114
- request :post, "/#{container_name}/#{object_name}", :headers => headers
114
+ request :post, "/#{container_name}/#{object_name}", options.merge(:headers => headers)
115
115
  end
116
116
 
117
- def get_object(object_name, container_name, &block)
117
+ def get_object(object_name, container_name, options = {}, &block)
118
118
  raise(EmptyNameError) if object_name.empty? || container_name.empty?
119
119
 
120
- request(:get, "/#{container_name}/#{object_name}", block ? { :stream_body => true } : {}, &block)
120
+ request(:get, "/#{container_name}/#{object_name}", options.merge(block ? { :stream_body => true } : {}), &block)
121
121
  end
122
122
 
123
- def head_object(object_name, container_name)
123
+ def head_object(object_name, container_name, options = {})
124
124
  raise(EmptyNameError) if object_name.empty? || container_name.empty?
125
125
 
126
- request :head, "/#{container_name}/#{object_name}"
126
+ request :head, "/#{container_name}/#{object_name}", options
127
127
  end
128
128
 
129
- def delete_object(object_name, container_name)
129
+ def delete_object(object_name, container_name, options = {})
130
130
  raise(EmptyNameError) if object_name.empty? || container_name.empty?
131
131
 
132
- request :delete, "/#{container_name}/#{object_name}"
132
+ request :delete, "/#{container_name}/#{object_name}", options
133
133
  end
134
134
 
135
- def get_objects(container_name, query = {})
135
+ def get_objects(container_name, query = {}, options = {})
136
136
  raise(EmptyNameError) if container_name.empty?
137
137
 
138
- request :get, "/#{container_name}", :query => query
138
+ request :get, "/#{container_name}", options.merge(:query => query)
139
139
  end
140
140
 
141
- def paginate_objects(container_name, query = {}, &block)
142
- paginate :get_objects, container_name, query, &block
141
+ def paginate_objects(container_name, query = {}, options = {}, &block)
142
+ paginate(:get_objects, container_name, query, options, &block)
143
143
  end
144
144
 
145
145
  def public_url(object_name, container_name)
@@ -160,9 +160,9 @@ class SwiftClient
160
160
  "#{storage_url}/#{container_name}/#{object_name}?temp_url_sig=#{signature}&temp_url_expires=#{expires}"
161
161
  end
162
162
 
163
- def bulk_delete(items)
163
+ def bulk_delete(items, options = {})
164
164
  items.each_slice(1_000) do |slice|
165
- request :delete, "/?bulk-delete", :body => slice.join("\n"), :headers => { "Content-Type" => "text/plain" }
165
+ request :delete, "/?bulk-delete", options.merge(:body => slice.join("\n"), :headers => { "Content-Type" => "text/plain" })
166
166
  end
167
167
 
168
168
  items
@@ -341,13 +341,13 @@ class SwiftClient
341
341
  swift_endpoint["url"]
342
342
  end
343
343
 
344
- def paginate(method, *args, query)
345
- return enum_for(:paginate, method, *args, query) unless block_given?
344
+ def paginate(method, *args, query, options)
345
+ return enum_for(:paginate, method, *args, query, options) unless block_given?
346
346
 
347
347
  marker = nil
348
348
 
349
349
  loop do
350
- response = send(method, *args, marker ? query.merge(:marker => marker) : query)
350
+ response = send(method, *args, marker ? query.merge(:marker => marker) : query, options)
351
351
 
352
352
  return if response.parsed_response.empty?
353
353
 
@@ -1,4 +1,4 @@
1
1
 
2
2
  class SwiftClient
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.6"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swift_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Vetter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-03 00:00:00.000000000 Z
11
+ date: 2017-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty