dato 0.1.29 → 0.1.30

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: 86a27c46667e000081867531524a46f6e2b6b28b
4
- data.tar.gz: 0a63b2fcac1ae423fabd6067c5a73d38ab91a3e4
3
+ metadata.gz: ac4f82010e5c4236d2beb18e212c367e98559107
4
+ data.tar.gz: 6329ebc7fe6eb9cdfbf6ad4f1f9930350648e3c9
5
5
  SHA512:
6
- metadata.gz: 89889b15de5316ab503b5d4ad66641d3ebfd9e0c693ef54c8a993f8e84a7720c0edcb4fa6f5ba8b143c71468d1118820fcd86986792f554832fbdc495178eb45
7
- data.tar.gz: ee9966b4828cbba44e7757186018b66813889648f9653881e1181d9f952bb0dc1c9a4e03657cebea4b60cda403c7c035a96f0c8aa86203f389028fb2d8a3f348
6
+ metadata.gz: 5d9ba0e42b34cad0ffa9ec41bfd62b63bb81568f1fdaa7cf67c6ef3efd637bb417fe6715b72d851150ccfc83a6b641d142739d6ddc091992bd03d6f457a6bbfd
7
+ data.tar.gz: 7eee59d8926ab267704cafb704b0a968c80b52f1a5061cd802879e839240fd7e0a5dd28f0e76c5d9c48f81289b7d9783870f1fbf3bee95f1d5085cf7696c5e04
@@ -0,0 +1 @@
1
+ 2.1.0
@@ -1,5 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.2
3
+ - 2.1.0
4
+ - 2.2.2
4
5
  - 2.3.0
5
- before_install: gem install bundler -v 1.11.2
6
+ before_install:
7
+ - gem install bundler -v 1.13.5
8
+ - echo 'puts "ruby \"#{RUBY_VERSION}\""' | ruby >> Gemfile
9
+ - cat Gemfile
@@ -20,8 +20,6 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.required_ruby_version = '>= 2.1.2'
24
-
25
23
  spec.add_development_dependency 'bundler', '~> 1.11'
26
24
  spec.add_development_dependency 'rake', '~> 10.0'
27
25
  spec.add_development_dependency 'rspec', '~> 3.0'
@@ -36,7 +34,7 @@ Gem::Specification.new do |spec|
36
34
 
37
35
  spec.add_runtime_dependency 'faraday', ['>= 0.9.0']
38
36
  spec.add_runtime_dependency 'faraday_middleware', ['>= 0.9.0']
39
- spec.add_runtime_dependency 'activesupport'
37
+ spec.add_runtime_dependency 'activesupport', ['>= 4.2.7']
40
38
  spec.add_runtime_dependency 'fastimage'
41
39
  spec.add_runtime_dependency 'downloadr'
42
40
  spec.add_runtime_dependency 'addressable'
@@ -21,15 +21,15 @@ module Dato
21
21
  @size = size
22
22
  end
23
23
 
24
- def file
24
+ def file(host = default_host)
25
25
  Imgix::Client.new(
26
- host: 'dato-images.imgix.net',
26
+ host: host,
27
27
  secure: true
28
28
  ).path(path)
29
29
  end
30
30
 
31
- def url(*args)
32
- file.to_url(*args)
31
+ def url(host: default_host, **opts)
32
+ file(host).to_url(opts)
33
33
  end
34
34
 
35
35
  def to_hash
@@ -39,6 +39,13 @@ module Dato
39
39
  url: url
40
40
  }
41
41
  end
42
+
43
+ private
44
+
45
+ def default_host
46
+ 'dato-images.imgix.net'
47
+ end
48
+
42
49
  end
43
50
  end
44
51
  end
@@ -23,7 +23,7 @@ module Dato
23
23
  @height = height
24
24
  end
25
25
 
26
- def file
26
+ def file(host = default_host)
27
27
  super.ch('DPR', 'Width').auto('compress', 'format')
28
28
  end
29
29
 
@@ -32,16 +32,15 @@ module Dato
32
32
 
33
33
  def all_items
34
34
  items_per_page = 500
35
- base_response = client.request(:get, '/items', 'page[limit]' => 1)
35
+ base_response = client.request(:get, '/items', 'page[limit]' => 500)
36
36
 
37
- pages = (base_response[:meta][:total_count] / items_per_page.to_f).ceil
38
- base_response[:data] = []
37
+ extra_pages = (base_response[:meta][:total_count] / items_per_page.to_f).ceil - 1
39
38
 
40
- pages.times do |page|
39
+ extra_pages.times do |page|
41
40
  base_response[:data] += client.request(
42
41
  :get,
43
42
  '/items',
44
- 'page[offset]' => items_per_page * page,
43
+ 'page[offset]' => items_per_page * (page + 1),
45
44
  'page[limit]' => items_per_page
46
45
  )[:data]
47
46
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Dato
3
- VERSION = '0.1.29'
3
+ VERSION = '0.1.30'
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.29
4
+ version: 0.1.30
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-09-27 00:00:00.000000000 Z
11
+ date: 2016-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -198,14 +198,14 @@ dependencies:
198
198
  requirements:
199
199
  - - ">="
200
200
  - !ruby/object:Gem::Version
201
- version: '0'
201
+ version: 4.2.7
202
202
  type: :runtime
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - ">="
207
207
  - !ruby/object:Gem::Version
208
- version: '0'
208
+ version: 4.2.7
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: fastimage
211
211
  requirement: !ruby/object:Gem::Requirement
@@ -329,6 +329,7 @@ files:
329
329
  - ".gitignore"
330
330
  - ".rspec"
331
331
  - ".rubocop.yml"
332
+ - ".ruby-version"
332
333
  - ".travis.yml"
333
334
  - CODE_OF_CONDUCT.md
334
335
  - Gemfile
@@ -412,7 +413,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
412
413
  requirements:
413
414
  - - ">="
414
415
  - !ruby/object:Gem::Version
415
- version: 2.1.2
416
+ version: '0'
416
417
  required_rubygems_version: !ruby/object:Gem::Requirement
417
418
  requirements:
418
419
  - - ">="
@@ -420,9 +421,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
420
421
  version: '0'
421
422
  requirements: []
422
423
  rubyforge_project:
423
- rubygems_version: 2.5.1
424
+ rubygems_version: 2.2.0
424
425
  signing_key:
425
426
  specification_version: 4
426
427
  summary: Ruby client for DatoCMS API
427
428
  test_files: []
428
- has_rdoc: