dato 0.7.4 → 0.7.5

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
  SHA256:
3
- metadata.gz: a2b7d95f00890cd03b1a560ac5f6d6a1c8d4ed89affad3a43a46cb4d9d7517a7
4
- data.tar.gz: f0e4149f20b068b80fda0ada2d78f5d776862ad2bb64f0d3273848455f3b297a
3
+ metadata.gz: 7b83ae27c74e6a173bdde5b26ce31b9d71a70969f7630d0ffee199ed5a7f45ff
4
+ data.tar.gz: eadb0a8bf60f1364345e57cfc1c8ffc314f84310482157129b37e2c73fe67ddf
5
5
  SHA512:
6
- metadata.gz: 8bcce6ad9866c9c8f74516dafb9b7f8a561e539c9dc32996cd35a2cd7c9d779bacbeb639c4a8cb9eacb24d4a46c33ec6d51f407524989af5813f87560429877d
7
- data.tar.gz: 94011511faf89f6dbce24b3cc07df27626e2067d66301ed866d88d21483852a06def5c305abdd3af6e1ea2d4d08d824810f25ce02415808ec808bda81d1788af
6
+ metadata.gz: 57ae67081408c41489e5f9d44cc4548f89decb247db797223f2e6582f615fed19acab7ced73e62006f1d5e50df2a6c47f61717f3ee866f9e184b51952c247f92
7
+ data.tar.gz: 65996e97224be9504d239166b40a0f363e758236f31347a9b2f6acc39556935725ec73d1b1b2edad1fee1a109d0299ab040ffca6ff53b618a87c09c586e83800
@@ -44,4 +44,5 @@ Gem::Specification.new do |spec|
44
44
  spec.add_runtime_dependency 'pusher-client'
45
45
  spec.add_runtime_dependency 'listen'
46
46
  spec.add_runtime_dependency 'json_schema'
47
+ spec.add_runtime_dependency 'mime-types'
47
48
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'mime/types'
3
4
  require 'tempfile'
4
5
  require 'addressable'
5
6
  require 'net/http'
@@ -49,7 +50,12 @@ module Dato
49
50
  upload_request = client.upload_request.create(filename: filename)
50
51
  uri = URI.parse(upload_request[:url])
51
52
 
53
+ mime_type = MIME::Types.of(filename).first
54
+
52
55
  request = Net::HTTP::Put.new(uri)
56
+ if mime_type
57
+ request.add_field("Content-Type", mime_type.to_s)
58
+ end
53
59
  request.body = file.read
54
60
 
55
61
  http = Net::HTTP.new(uri.host, uri.port)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dato
4
- VERSION = '0.7.4'
4
+ VERSION = '0.7.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Verna
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-03 00:00:00.000000000 Z
11
+ date: 2019-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -332,6 +332,20 @@ dependencies:
332
332
  - - ">="
333
333
  - !ruby/object:Gem::Version
334
334
  version: '0'
335
+ - !ruby/object:Gem::Dependency
336
+ name: mime-types
337
+ requirement: !ruby/object:Gem::Requirement
338
+ requirements:
339
+ - - ">="
340
+ - !ruby/object:Gem::Version
341
+ version: '0'
342
+ type: :runtime
343
+ prerelease: false
344
+ version_requirements: !ruby/object:Gem::Requirement
345
+ requirements:
346
+ - - ">="
347
+ - !ruby/object:Gem::Version
348
+ version: '0'
335
349
  description: Ruby client for DatoCMS API
336
350
  email:
337
351
  - s.verna@cantierecreativo.net