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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07c444535368e4be022b752521e3f719f8931bf6
4
- data.tar.gz: b0db704983287ac4708f7e7fb5d9517ae4dde0de
3
+ metadata.gz: e04d9c076ba20ec7b69abfbdd9e12dfe1fb9bdbb
4
+ data.tar.gz: f0316bd255df069ec3d28bab88ec5c669ef0d14e
5
5
  SHA512:
6
- metadata.gz: aa23ca377ea692d7b13acb8c1cff296f679e503595da164c7bfe5a37dda84462e64406631fb3fb6280c2086715d7a5cf5ddbda1e09437bae74aeeabaf07bfbb9
7
- data.tar.gz: 08887d4a0f6b4cf079f35b43e0a054a968e9a72fd59c8fa65230523048f73024f83f268f51386710998d6957a443dce2701764e74fadc883f8b39b92160c556d
6
+ metadata.gz: 736a0dcc2f1262453ddc33fdc3094525743e2d38e0f57fff3797e6748590cc963950d7445ead3999a62de12502c3ef1b3096ab43e77df8b60e629d120bff6932
7
+ data.tar.gz: a21e6d537c5baf9373a276cb2e6cfa81941ef4d22e3aa2671ccd1ba7aa34b14efa03258f3022dafda821b2dae63a614472b80802f08f56b00ec9424ca5d382b5
data/.gitignore CHANGED
@@ -1,3 +1 @@
1
- .DS_Store
2
- pkg
3
- coverage
1
+ *.gem
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.0
4
+
5
+ - Added support for custom headers
6
+
3
7
  ## 0.9.0
4
8
 
5
9
  - Added support for content-encoding option
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nightcrawler_swift (0.8.1)
4
+ nightcrawler_swift (0.10.0)
5
5
  concurrent-ruby (~> 0.8.0)
6
6
  multi_mime (>= 1.0.1)
7
7
  rest-client
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
@@ -1,3 +1,3 @@
1
1
  module NightcrawlerSwift
2
- VERSION = "0.9.0"
2
+ VERSION = "0.10.0"
3
3
  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.9.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-10-28 00:00:00.000000000 Z
12
+ date: 2015-11-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client