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 +4 -4
- data/dato.gemspec +1 -0
- data/lib/dato/upload/file.rb +6 -0
- data/lib/dato/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b83ae27c74e6a173bdde5b26ce31b9d71a70969f7630d0ffee199ed5a7f45ff
|
4
|
+
data.tar.gz: eadb0a8bf60f1364345e57cfc1c8ffc314f84310482157129b37e2c73fe67ddf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57ae67081408c41489e5f9d44cc4548f89decb247db797223f2e6582f615fed19acab7ced73e62006f1d5e50df2a6c47f61717f3ee866f9e184b51952c247f92
|
7
|
+
data.tar.gz: 65996e97224be9504d239166b40a0f363e758236f31347a9b2f6acc39556935725ec73d1b1b2edad1fee1a109d0299ab040ffca6ff53b618a87c09c586e83800
|
data/dato.gemspec
CHANGED
data/lib/dato/upload/file.rb
CHANGED
@@ -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)
|
data/lib/dato/version.rb
CHANGED
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
|
+
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-
|
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
|