dato 0.3.13 → 0.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 68262bf2094e79d5611f2be293c6c88f290dd6c3
4
- data.tar.gz: d6c792b7c72fd835353c955450ecf74acab21ead
3
+ metadata.gz: f19eda1a40bf5684baf782e3f0067631145cb9b1
4
+ data.tar.gz: a6343cac11fa2ae523030ddd137e881a0062645d
5
5
  SHA512:
6
- metadata.gz: 3dbdedf89e2e58495cbd417dfbcbef8016d72a483680f0a3fdee411635f5317f139dec6128060b45237c55b290006d8fbb6f99b1afadc51250df94789fa2eedf
7
- data.tar.gz: c253056e51b85ea111a5fbd77ba67809609528e5dd688420d7e9a0883343f0322741aa7340da56d573477ae817ba0208491737c9c2c5aea559baa325d61225d8
6
+ metadata.gz: 888a3a62b58796beb47447348a9d294aeceaa5af2c6b8fcf36779b3c0ae1f9b42220b7d0ebc062d39880f3bc1845cefe242ea837d9aed571f4cd327264767fec
7
+ data.tar.gz: bc5257b829dd8457c2ef2ec3d245ac5892eb655e8f556214a081c21ce9027ea344ce2e7b9bcc6b6ebf3755703e32f6659a3a149bfdbc931be3cf032d22cd9951
@@ -7,23 +7,25 @@ module Dato
7
7
  class File
8
8
  attr_reader :path, :format, :size
9
9
 
10
- def self.parse(value, _repo)
10
+ def self.parse(value, repo)
11
11
  value && new(
12
12
  value[:path],
13
13
  value[:format],
14
- value[:size]
14
+ value[:size],
15
+ repo.site.entity.imgix_host
15
16
  )
16
17
  end
17
18
 
18
- def initialize(path, format, size)
19
+ def initialize(path, format, size, imgix_host)
19
20
  @path = path
20
21
  @format = format
21
22
  @size = size
23
+ @imgix_host = imgix_host
22
24
  end
23
25
 
24
26
  def file
25
27
  Imgix::Client.new(
26
- host: 'www.datocms-assets.com',
28
+ host: @imgix_host,
27
29
  secure: true,
28
30
  include_library_param: false
29
31
  ).path(path)
@@ -10,13 +10,14 @@ module Dato
10
10
  attr_reader :twitter_account
11
11
  attr_reader :facebook_page_url
12
12
 
13
- def self.parse(value, _repo)
13
+ def self.parse(value, repo)
14
14
  value && new(
15
15
  value[:site_name],
16
16
  value[:title_suffix],
17
17
  value[:twitter_account],
18
18
  value[:facebook_page_url],
19
- value[:fallback_seo]
19
+ value[:fallback_seo],
20
+ repo
20
21
  )
21
22
  end
22
23
 
@@ -25,17 +26,19 @@ module Dato
25
26
  title_suffix,
26
27
  twitter_account,
27
28
  facebook_page_url,
28
- fallback_seo
29
+ fallback_seo,
30
+ repo
29
31
  )
30
32
  @site_name = site_name
31
33
  @title_suffix = title_suffix
32
34
  @twitter_account = twitter_account
33
35
  @facebook_page_url = facebook_page_url
34
36
  @fallback_seo = fallback_seo
37
+ @repo = repo
35
38
  end
36
39
 
37
40
  def fallback_seo
38
- @fallback_seo && Seo.parse(@fallback_seo, nil)
41
+ @fallback_seo && Seo.parse(@fallback_seo, @repo)
39
42
  end
40
43
 
41
44
  def to_hash(*args)
@@ -7,7 +7,7 @@ module Dato
7
7
  class Image < Dato::Local::FieldType::File
8
8
  attr_reader :width, :height, :title, :alt
9
9
 
10
- def self.parse(value, _repo)
10
+ def self.parse(value, repo)
11
11
  value && new(
12
12
  value[:path],
13
13
  value[:format],
@@ -15,12 +15,22 @@ module Dato
15
15
  value[:width],
16
16
  value[:height],
17
17
  value[:alt],
18
- value[:title]
18
+ value[:title],
19
+ repo.site.entity.imgix_host
19
20
  )
20
21
  end
21
22
 
22
- def initialize(path, format, size, width, height, alt, title)
23
- super(path, format, size)
23
+ def initialize(
24
+ path,
25
+ format,
26
+ size,
27
+ width,
28
+ height,
29
+ alt,
30
+ title,
31
+ imgix_host
32
+ )
33
+ super(path, format, size, imgix_host)
24
34
  @width = width
25
35
  @height = height
26
36
  @alt = alt
@@ -5,18 +5,19 @@ module Dato
5
5
  class Seo
6
6
  attr_reader :title, :description
7
7
 
8
- def self.parse(value, _repo)
9
- value && new(value[:title], value[:description], value[:image])
8
+ def self.parse(value, repo)
9
+ value && new(value[:title], value[:description], value[:image], repo)
10
10
  end
11
11
 
12
- def initialize(title, description, image)
12
+ def initialize(title, description, image, repo)
13
13
  @title = title
14
14
  @description = description
15
15
  @image = image
16
+ @repo = repo
16
17
  end
17
18
 
18
19
  def image
19
- @image && Image.parse(@image, nil)
20
+ @image && Image.parse(@image, @repo)
20
21
  end
21
22
 
22
23
  def to_hash(*args)
@@ -30,7 +30,10 @@ module Dato
30
30
  end
31
31
 
32
32
  def site
33
- Site.new(entities_repo.find_entities_of_type('site').first)
33
+ Site.new(
34
+ entities_repo.find_entities_of_type('site').first,
35
+ self
36
+ )
34
37
  end
35
38
 
36
39
  def available_locales
@@ -12,8 +12,9 @@ module Dato
12
12
  def_delegators :entity, :id, :name, :locales, :theme_hue, :domain,
13
13
  :internal_domain, :no_index, :frontend_url
14
14
 
15
- def initialize(entity)
15
+ def initialize(entity, items_repo)
16
16
  @entity = entity
17
+ @items_repo = items_repo
17
18
  end
18
19
 
19
20
  def global_seo
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Dato
3
- VERSION = '0.3.13'
3
+ VERSION = '0.3.14'
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.3.13
4
+ version: 0.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Verna
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-03 00:00:00.000000000 Z
11
+ date: 2017-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler