dato 0.3.6 → 0.3.7
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 +4 -4
- data/README.md +1 -1
- data/docs/dato-cli.md +1 -1
- data/docs/site-api-client.md +1 -1
- data/lib/dato/cli.rb +1 -1
- data/lib/dato/local/field_type/file.rb +5 -11
- data/lib/dato/local/field_type/gallery.rb +2 -2
- data/lib/dato/local/field_type/global_seo.rb +2 -2
- data/lib/dato/local/field_type/image.rb +2 -2
- data/lib/dato/local/field_type/lat_lon.rb +1 -1
- data/lib/dato/local/field_type/links.rb +2 -2
- data/lib/dato/local/field_type/rich_text.rb +2 -2
- data/lib/dato/local/field_type/seo.rb +2 -2
- data/lib/dato/local/field_type/video.rb +1 -1
- data/lib/dato/local/item.rb +10 -3
- data/lib/dato/local/items_repo.rb +1 -1
- data/lib/dato/local/site.rb +2 -2
- data/lib/dato/utils/meta_tags/og_site_name.rb +1 -1
- data/lib/dato/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b565e0c69439a1ff651c792a9f667afdeed71d12
|
4
|
+
data.tar.gz: a545f329291e9778ff30d97c9489449df39804b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8183e81004df27ca2a3c373a32bb472b7851d4a9307891d3a10826a48031e3b36578b2d237455262bbef086b40f45e08e4a0ab3d99245fecba044b915275ae13
|
7
|
+
data.tar.gz: 8f72ca7d25556fa52e4c5cacc890144a2f7756b71ed401975bfb74cfb1213d3a55c71d25276fb403c3c9a41c803e61afbd0a16222b8fee66483a4703c431b36d
|
data/README.md
CHANGED
@@ -16,7 +16,7 @@ Ruby client for the DatoCMS API.
|
|
16
16
|
This gem can be used in different ways, so the documentation is split up in different files:
|
17
17
|
|
18
18
|
* [I want to use the content of a DatoCMS site in my static website (Hugo, Jekyll, etc.)](https://github.com/datocms/ruby-datocms-client/blob/master/docs/dato-cli.md);
|
19
|
-
* [I want to edit the
|
19
|
+
* [I want to edit the content of an existing DatoCMS site programmatically](https://github.com/datocms/ruby-datocms-client/blob/master/docs/site-api-client.md);
|
20
20
|
* [I want to create new DatoCMS sites programmatically](https://github.com/datocms/ruby-datocms-client/blob/master/docs/account-api-client.md).
|
21
21
|
|
22
22
|
## Development
|
data/docs/dato-cli.md
CHANGED
@@ -41,7 +41,7 @@ If everything worked correctly, you should now run `bundle exec dato` and see so
|
|
41
41
|
```
|
42
42
|
$ bundle exec dato
|
43
43
|
DatoCMS commands:
|
44
|
-
dato dump --token=TOKEN # dumps DatoCMS
|
44
|
+
dato dump --token=TOKEN # dumps DatoCMS content into local files
|
45
45
|
dato help [COMMAND] # Describe available commands or one specific command
|
46
46
|
```
|
47
47
|
|
data/docs/site-api-client.md
CHANGED
data/lib/dato/cli.rb
CHANGED
@@ -8,7 +8,7 @@ module Dato
|
|
8
8
|
class Cli < Thor
|
9
9
|
package_name 'DatoCMS'
|
10
10
|
|
11
|
-
desc 'dump', 'dumps DatoCMS
|
11
|
+
desc 'dump', 'dumps DatoCMS content into local files'
|
12
12
|
option :config, default: 'dato.config.rb'
|
13
13
|
option :token, default: ENV['DATO_API_TOKEN'], required: true
|
14
14
|
def dump
|
@@ -21,31 +21,25 @@ module Dato
|
|
21
21
|
@size = size
|
22
22
|
end
|
23
23
|
|
24
|
-
def file
|
24
|
+
def file
|
25
25
|
Imgix::Client.new(
|
26
|
-
host:
|
26
|
+
host: 'dato-images.imgix.net',
|
27
27
|
secure: true,
|
28
28
|
include_library_param: false
|
29
29
|
).path(path)
|
30
30
|
end
|
31
31
|
|
32
|
-
def url(
|
33
|
-
file
|
32
|
+
def url(opts)
|
33
|
+
file.to_url(opts)
|
34
34
|
end
|
35
35
|
|
36
|
-
def to_hash
|
36
|
+
def to_hash(*args)
|
37
37
|
{
|
38
38
|
format: format,
|
39
39
|
size: size,
|
40
40
|
url: url
|
41
41
|
}
|
42
42
|
end
|
43
|
-
|
44
|
-
private
|
45
|
-
|
46
|
-
def default_host
|
47
|
-
'dato-images.imgix.net'
|
48
|
-
end
|
49
43
|
end
|
50
44
|
end
|
51
45
|
end
|
@@ -38,13 +38,13 @@ module Dato
|
|
38
38
|
@fallback_seo && Seo.parse(@fallback_seo, nil)
|
39
39
|
end
|
40
40
|
|
41
|
-
def to_hash
|
41
|
+
def to_hash(*args)
|
42
42
|
{
|
43
43
|
site_name: site_name,
|
44
44
|
title_suffix: title_suffix,
|
45
45
|
twitter_account: twitter_account,
|
46
46
|
facebook_page_url: facebook_page_url,
|
47
|
-
fallback_seo: fallback_seo && fallback_seo.to_hash
|
47
|
+
fallback_seo: fallback_seo && fallback_seo.to_hash(*args)
|
48
48
|
}
|
49
49
|
end
|
50
50
|
end
|
data/lib/dato/local/item.rb
CHANGED
@@ -59,11 +59,11 @@ module Dato
|
|
59
59
|
def singleton?
|
60
60
|
item_type.singleton
|
61
61
|
end
|
62
|
+
alias single_instance? singleton?
|
62
63
|
|
63
64
|
def item_type
|
64
65
|
@item_type ||= entity.item_type
|
65
66
|
end
|
66
|
-
alias content_type item_type
|
67
67
|
|
68
68
|
def fields
|
69
69
|
@fields ||= item_type.fields.sort_by(&:position)
|
@@ -91,7 +91,11 @@ module Dato
|
|
91
91
|
end
|
92
92
|
alias inspect to_s
|
93
93
|
|
94
|
-
def to_hash
|
94
|
+
def to_hash(max_depth = 3, current_depth = 0)
|
95
|
+
if current_depth >= max_depth
|
96
|
+
return id
|
97
|
+
end
|
98
|
+
|
95
99
|
base = {
|
96
100
|
id: id,
|
97
101
|
item_type: item_type.api_key,
|
@@ -104,7 +108,10 @@ module Dato
|
|
104
108
|
value = send(field.api_key)
|
105
109
|
|
106
110
|
result[field.api_key.to_sym] = if value.respond_to?(:to_hash)
|
107
|
-
value.to_hash
|
111
|
+
value.to_hash(
|
112
|
+
max_depth,
|
113
|
+
current_depth + 1
|
114
|
+
)
|
108
115
|
else
|
109
116
|
value
|
110
117
|
end
|
data/lib/dato/local/site.rb
CHANGED
@@ -10,7 +10,7 @@ module Dato
|
|
10
10
|
|
11
11
|
attr_reader :entity
|
12
12
|
def_delegators :entity, :id, :name, :locales, :theme_hue, :domain,
|
13
|
-
:internal_domain, :no_index
|
13
|
+
:internal_domain, :no_index, :frontend_url
|
14
14
|
|
15
15
|
def initialize(entity)
|
16
16
|
@entity = entity
|
@@ -36,7 +36,7 @@ module Dato
|
|
36
36
|
def to_hash
|
37
37
|
attributes = [
|
38
38
|
:id, :name, :locales, :theme_hue, :domain, :internal_domain,
|
39
|
-
:no_index, :global_seo, :favicon
|
39
|
+
:no_index, :global_seo, :favicon, :frontend_url
|
40
40
|
]
|
41
41
|
|
42
42
|
attributes.each_with_object({}) do |attribute, result|
|
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.3.
|
4
|
+
version: 0.3.7
|
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-
|
11
|
+
date: 2017-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|