nightcrawler_swift 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -3
- data/Changelog.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +10 -0
- data/lib/nightcrawler_swift/commands/upload.rb +3 -0
- data/lib/nightcrawler_swift/version.rb +1 -1
- data/spec/lib/nightcrawler_swift/commands/upload_spec.rb +17 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e04d9c076ba20ec7b69abfbdd9e12dfe1fb9bdbb
|
4
|
+
data.tar.gz: f0316bd255df069ec3d28bab88ec5c669ef0d14e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 736a0dcc2f1262453ddc33fdc3094525743e2d38e0f57fff3797e6748590cc963950d7445ead3999a62de12502c3ef1b3096ab43e77df8b60e629d120bff6932
|
7
|
+
data.tar.gz: a21e6d537c5baf9373a276cb2e6cfa81941ef4d22e3aa2671ccd1ba7aa34b14efa03258f3022dafda821b2dae63a614472b80802f08f56b00ec9424ca5d382b5
|
data/.gitignore
CHANGED
data/Changelog.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -77,6 +77,9 @@ config.nightcrawler_swift.ssl_ca_file = "ca_certificate.pem"
|
|
77
77
|
|
78
78
|
#default: nil
|
79
79
|
config.nightcrawler_swift.ssl_version = "SSLv23"
|
80
|
+
|
81
|
+
#default: {}
|
82
|
+
config.nightcrawler_swift.custom_headers = {custom_header: 'custom_value'}
|
80
83
|
```
|
81
84
|
|
82
85
|
By default it will use ```Rails.logger``` as logger, to change that use a different logger in configurations, like:
|
@@ -103,6 +106,10 @@ The number of times to retry the request before failing. To disable this feature
|
|
103
106
|
|
104
107
|
Maximum delay in seconds between each retry. The delay will start with 1s and will double for each retry until this value.
|
105
108
|
|
109
|
+
> custom_headers
|
110
|
+
|
111
|
+
Optional hash with header fields to be uploaded with the object.
|
112
|
+
|
106
113
|
#### 2) Profit!
|
107
114
|
|
108
115
|
```sh
|
@@ -159,6 +166,9 @@ ssl_client_key:
|
|
159
166
|
|
160
167
|
# default: nil
|
161
168
|
ssl_ca_file: "ca_certificate.pem"
|
169
|
+
|
170
|
+
# default: {}
|
171
|
+
custom_headers: {custom_header: 'custom_value'}
|
162
172
|
```
|
163
173
|
|
164
174
|
By default it will use ```Logger.new(STDOUT)``` as logger, to change that use:
|
@@ -11,6 +11,9 @@ module NightcrawlerSwift
|
|
11
11
|
content_encoding = opts[:content_encoding] || options.content_encoding
|
12
12
|
headers.merge!(content_encoding: content_encoding.to_s) if content_encoding
|
13
13
|
|
14
|
+
custom_headers = opts[:custom_headers]
|
15
|
+
headers.merge!(custom_headers) if custom_headers
|
16
|
+
|
14
17
|
response = put "#{connection.upload_url}/#{path}", body: body, headers: headers
|
15
18
|
[200, 201].include?(response.code)
|
16
19
|
end
|
@@ -111,6 +111,23 @@ describe NightcrawlerSwift::Upload do
|
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
|
+
context "custom_headers" do
|
115
|
+
let :default_headers do
|
116
|
+
{content_type: "text/css", etag: etag}
|
117
|
+
end
|
118
|
+
|
119
|
+
it "allows custom headers" do
|
120
|
+
NightcrawlerSwift.configure
|
121
|
+
subject.execute path, file, custom_headers: {custom_key: 'custom_value'}
|
122
|
+
expect(subject).to have_received(:put).with(
|
123
|
+
anything,
|
124
|
+
hash_including(
|
125
|
+
headers: hash_including(default_headers.merge(custom_key: 'custom_value'))
|
126
|
+
)
|
127
|
+
)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
114
131
|
context "content_encoding" do
|
115
132
|
let :default_headers do
|
116
133
|
{content_type: "text/css", etag: etag}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nightcrawler_swift
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tulios
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-11-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|