dato 0.1.30 → 0.1.31

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: ac4f82010e5c4236d2beb18e212c367e98559107
4
- data.tar.gz: 6329ebc7fe6eb9cdfbf6ad4f1f9930350648e3c9
3
+ metadata.gz: 3e6ffeb74c86a321901eeaf73084308fa26e0181
4
+ data.tar.gz: 6fd4ca5ad2a9f8fdb846970ac065603740c19436
5
5
  SHA512:
6
- metadata.gz: 5d9ba0e42b34cad0ffa9ec41bfd62b63bb81568f1fdaa7cf67c6ef3efd637bb417fe6715b72d851150ccfc83a6b641d142739d6ddc091992bd03d6f457a6bbfd
7
- data.tar.gz: 7eee59d8926ab267704cafb704b0a968c80b52f1a5061cd802879e839240fd7e0a5dd28f0e76c5d9c48f81289b7d9783870f1fbf3bee95f1d5085cf7696c5e04
6
+ metadata.gz: 1870915a900d2e7877acba29fbb74cf4a578bda4a21b2566959f1d5189431514b43dd61e2d5d601d5e42f95cc0caf76410660a908120cb23fcda6a9815a4f88b
7
+ data.tar.gz: ff7093aeeb4cbadb4bec71fae0066bedbeb6e5fa37fe11e1e867eefaff58d06354063c2a69e33d468c77e7a22e7cccc3132753e840f5e0b9dcfab0903e16f025
@@ -22,14 +22,10 @@ module Dato
22
22
 
23
23
  attr_reader :token, :base_url, :schema, :extra_headers
24
24
 
25
- def initialize(
26
- token,
27
- base_url: 'https://account-api.datocms.com',
28
- extra_headers: {}
29
- )
30
- @base_url = base_url
25
+ def initialize(token, options = {})
31
26
  @token = token
32
- @extra_headers = extra_headers
27
+ @base_url = options[:base_url] || 'https://account-api.datocms.com'
28
+ @extra_headers = options[:extra_headers] || {}
33
29
  end
34
30
 
35
31
  REPOS.each do |method_name, repo_klass|
@@ -35,14 +35,10 @@ module Dato
35
35
 
36
36
  attr_reader :token, :base_url, :schema, :extra_headers
37
37
 
38
- def initialize(
39
- token,
40
- base_url: 'https://site-api.datocms.com',
41
- extra_headers: {}
42
- )
43
- @base_url = base_url
38
+ def initialize(token, options = {})
44
39
  @token = token
45
- @extra_headers = extra_headers
40
+ @base_url = options[:base_url] || 'https://site-api.datocms.com'
41
+ @extra_headers = options[:extra_headers] || {}
46
42
  end
47
43
 
48
44
  def upload_file(path_or_url)
@@ -16,7 +16,9 @@ module Dato
16
16
 
17
17
  def file
18
18
  @file ||= if http_source?
19
- Tempfile.new('file').tap do |file|
19
+ uri = Addressable::URI.parse(source)
20
+ ext = ::File.extname(uri.path)
21
+ Tempfile.new(['file', ext]).tap do |file|
20
22
  Downloadr::HTTP.new(source, file).download
21
23
  end
22
24
  else
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Dato
3
- VERSION = '0.1.30'
3
+ VERSION = '0.1.31'
4
4
  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.1.30
4
+ version: 0.1.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Verna
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-16 00:00:00.000000000 Z
11
+ date: 2016-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler