dato 0.7.15 → 0.7.16
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/CHANGELOG.md +15 -11
 - data/lib/dato/api_client.rb +3 -4
 - data/lib/dato/json_api_serializer.rb +4 -10
 - data/lib/dato/local/field_type/file.rb +2 -29
 - data/lib/dato/local/loader.rb +1 -1
 - data/lib/dato/upload/create_upload_path.rb +1 -1
 - data/lib/dato/version.rb +1 -1
 - metadata +6 -7
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 5497d73f33b5f38e2f931d32bba7fa6362d5069d0b8fa5cf3b85326f339ab0ba
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: b085c940d24c1f3a2bea211ad0fef22cf0455bbb958c85c0932fa4659c9a362c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: ce46783a3fe8719de2400ea08b94bde2b7c64856c889129cd22580c97e727931c8025f97740dd8c5124997d973178aff3b284f103967bee91ff4a857151afc6f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: dce4329c9bf0a556a0044b7e17c21e4e091a51da35466734fd03987dd59206a5f00d57b7496f0c46451cba4ebaf446628664bac89d0454f824488108825d23e4
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,3 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # 0.7.16
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Fixes bug when launching `dato dump --watch` together with the `environment` option.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
       1 
5 
     | 
    
         
             
            # 0.7.13
         
     | 
| 
       2 
6 
     | 
    
         | 
| 
       3 
7 
     | 
    
         
             
            Add option to pass a project's environment:
         
     | 
| 
         @@ -34,40 +38,40 @@ Find more info [on the documentation](https://www.datocms.com/docs/content-manag 
     | 
|
| 
       34 
38 
     | 
    
         | 
| 
       35 
39 
     | 
    
         
             
            # 0.7.11 (not released)
         
     | 
| 
       36 
40 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
      
 41 
     | 
    
         
            +
            - Updated specs cassettes after `appeareance -> appearance` typo fix
         
     | 
| 
      
 42 
     | 
    
         
            +
            - Some style changes
         
     | 
| 
       39 
43 
     | 
    
         | 
| 
       40 
44 
     | 
    
         
             
            # 0.7.10
         
     | 
| 
       41 
45 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
      
 46 
     | 
    
         
            +
            - Fixed SEO title retrieval. Now it fallbacks to default SEO title is item title is blank
         
     | 
| 
       43 
47 
     | 
    
         | 
| 
       44 
48 
     | 
    
         
             
            # 0.7.9
         
     | 
| 
       45 
49 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
      
 50 
     | 
    
         
            +
            - Added new attributes to uploads
         
     | 
| 
       47 
51 
     | 
    
         | 
| 
       48 
52 
     | 
    
         
             
            # 0.7.0
         
     | 
| 
       49 
53 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
      
 54 
     | 
    
         
            +
            - Real-time events are now much more granular and the gem avoids downloading all the content every time a change occurs
         
     | 
| 
       51 
55 
     | 
    
         | 
| 
       52 
56 
     | 
    
         
             
            # 0.6.18
         
     | 
| 
       53 
57 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
      
 58 
     | 
    
         
            +
            - Fixed regression where you could no longer access items' item type
         
     | 
| 
       55 
59 
     | 
    
         | 
| 
       56 
60 
     | 
    
         
             
            # 0.6.15
         
     | 
| 
       57 
61 
     | 
    
         | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
      
 62 
     | 
    
         
            +
            - Handle `429 Too Many Requests` responses from API
         
     | 
| 
       59 
63 
     | 
    
         | 
| 
       60 
64 
     | 
    
         
             
            # 0.6.12
         
     | 
| 
       61 
65 
     | 
    
         | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
      
 66 
     | 
    
         
            +
            - Allow empty responses from server
         
     | 
| 
       63 
67 
     | 
    
         | 
| 
       64 
68 
     | 
    
         
             
            # 0.6.10
         
     | 
| 
       65 
69 
     | 
    
         | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
      
 70 
     | 
    
         
            +
            - Introduced `.meta` on `Dato::Local::Item` to fetch all meta information about the records
         
     | 
| 
       67 
71 
     | 
    
         | 
| 
       68 
72 
     | 
    
         
             
            # 0.6.5
         
     | 
| 
       69 
73 
     | 
    
         | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
      
 74 
     | 
    
         
            +
            - The `.seo_meta_tags` method now generates fallback titles based on the model field title
         
     | 
| 
       71 
75 
     | 
    
         | 
| 
       72 
76 
     | 
    
         
             
            # v0.6.2
         
     | 
| 
       73 
77 
     | 
    
         | 
| 
         @@ -75,7 +79,7 @@ Moved `json_schema` as runtime dependency 
     | 
|
| 
       75 
79 
     | 
    
         | 
| 
       76 
80 
     | 
    
         
             
            # v0.6.1
         
     | 
| 
       77 
81 
     | 
    
         | 
| 
       78 
     | 
    
         
            -
            The big change is that the methods the client makes available are 
     | 
| 
      
 82 
     | 
    
         
            +
            The big change is that the methods the client makes available are generated at runtime based on the [JSON Schema of our CMA](https://www.datocms.com/content-management-api/). This means any new API endpoint — or changes to existing ones — will instantly be reflected to the client, without the need to upgrade to the latest client version.
         
     | 
| 
       79 
83 
     | 
    
         | 
| 
       80 
84 
     | 
    
         
             
            We also added a new `deserialize_response` option to every call, that you can use if you want to retrieve the exact payload the DatoCMS returns:
         
     | 
| 
       81 
85 
     | 
    
         | 
    
        data/lib/dato/api_client.rb
    CHANGED
    
    | 
         @@ -100,11 +100,10 @@ module Dato 
     | 
|
| 
       100 
100 
     | 
    
         
             
                    sleep(1)
         
     | 
| 
       101 
101 
     | 
    
         
             
                    request(*args)
         
     | 
| 
       102 
102 
     | 
    
         
             
                  else
         
     | 
| 
       103 
     | 
    
         
            -
                    # puts body.inspect
         
     | 
| 
       104 
     | 
    
         
            -
                    # puts '===='
         
     | 
| 
       105 
     | 
    
         
            -
                    # puts error.message
         
     | 
| 
       106 
     | 
    
         
            -
                    # puts '===='
         
     | 
| 
       107 
103 
     | 
    
         
             
                    error = ApiError.new(e.response)
         
     | 
| 
      
 104 
     | 
    
         
            +
                    puts '===='
         
     | 
| 
      
 105 
     | 
    
         
            +
                    puts error.message
         
     | 
| 
      
 106 
     | 
    
         
            +
                    puts '===='
         
     | 
| 
       108 
107 
     | 
    
         
             
                    raise error
         
     | 
| 
       109 
108 
     | 
    
         
             
                  end
         
     | 
| 
       110 
109 
     | 
    
         
             
                end
         
     | 
| 
         @@ -23,10 +23,8 @@ module Dato 
     | 
|
| 
       23 
23 
     | 
    
         
             
                  data[:type] = type
         
     | 
| 
       24 
24 
     | 
    
         
             
                  data[:attributes] = serialized_attributes(resource)
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
                   
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                  if serialized_relationships
         
     | 
| 
       29 
     | 
    
         
            -
                    data[:relationships] = serialized_relationships
         
     | 
| 
      
 26 
     | 
    
         
            +
                  if relationships.any?
         
     | 
| 
      
 27 
     | 
    
         
            +
                    data[:relationships] = serialized_relationships(resource)
         
     | 
| 
       30 
28 
     | 
    
         
             
                  end
         
     | 
| 
       31 
29 
     | 
    
         | 
| 
       32 
30 
     | 
    
         
             
                  { data: data }
         
     | 
| 
         @@ -84,7 +82,7 @@ module Dato 
     | 
|
| 
       84 
82 
     | 
    
         
             
                    end
         
     | 
| 
       85 
83 
     | 
    
         
             
                  end
         
     | 
| 
       86 
84 
     | 
    
         | 
| 
       87 
     | 
    
         
            -
                  result 
     | 
| 
      
 85 
     | 
    
         
            +
                  result
         
     | 
| 
       88 
86 
     | 
    
         
             
                end
         
     | 
| 
       89 
87 
     | 
    
         | 
| 
       90 
88 
     | 
    
         
             
                def attributes(resource)
         
     | 
| 
         @@ -112,11 +110,7 @@ module Dato 
     | 
|
| 
       112 
110 
     | 
    
         
             
                end
         
     | 
| 
       113 
111 
     | 
    
         | 
| 
       114 
112 
     | 
    
         
             
                def required_relationships
         
     | 
| 
       115 
     | 
    
         
            -
                   
     | 
| 
       116 
     | 
    
         
            -
                    (link_relationships.required || []).map(&:to_sym)
         
     | 
| 
       117 
     | 
    
         
            -
                  else
         
     | 
| 
       118 
     | 
    
         
            -
                    []
         
     | 
| 
       119 
     | 
    
         
            -
                  end
         
     | 
| 
      
 113 
     | 
    
         
            +
                  (link_relationships.required || []).map(&:to_sym)
         
     | 
| 
       120 
114 
     | 
    
         
             
                end
         
     | 
| 
       121 
115 
     | 
    
         | 
| 
       122 
116 
     | 
    
         
             
                def link_attributes
         
     | 
| 
         @@ -18,7 +18,6 @@ module Dato 
     | 
|
| 
       18 
18 
     | 
    
         
             
                            v[:alt],
         
     | 
| 
       19 
19 
     | 
    
         
             
                            v[:title],
         
     | 
| 
       20 
20 
     | 
    
         
             
                            v[:custom_data],
         
     | 
| 
       21 
     | 
    
         
            -
                            v[:focal_point],
         
     | 
| 
       22 
21 
     | 
    
         
             
                            repo.site.entity.imgix_host
         
     | 
| 
       23 
22 
     | 
    
         
             
                          )
         
     | 
| 
       24 
23 
     | 
    
         
             
                        end
         
     | 
| 
         @@ -30,14 +29,12 @@ module Dato 
     | 
|
| 
       30 
29 
     | 
    
         
             
                      alt,
         
     | 
| 
       31 
30 
     | 
    
         
             
                      title,
         
     | 
| 
       32 
31 
     | 
    
         
             
                      custom_data,
         
     | 
| 
       33 
     | 
    
         
            -
                      focal_point,
         
     | 
| 
       34 
32 
     | 
    
         
             
                      imgix_host
         
     | 
| 
       35 
33 
     | 
    
         
             
                    )
         
     | 
| 
       36 
34 
     | 
    
         
             
                      @upload = upload
         
     | 
| 
       37 
35 
     | 
    
         
             
                      @alt = alt
         
     | 
| 
       38 
36 
     | 
    
         
             
                      @title = title
         
     | 
| 
       39 
37 
     | 
    
         
             
                      @custom_data = custom_data
         
     | 
| 
       40 
     | 
    
         
            -
                      @focal_point = focal_point
         
     | 
| 
       41 
38 
     | 
    
         
             
                      @imgix_host = imgix_host
         
     | 
| 
       42 
39 
     | 
    
         
             
                    end
         
     | 
| 
       43 
40 
     | 
    
         | 
| 
         @@ -103,12 +100,6 @@ module Dato 
     | 
|
| 
       103 
100 
     | 
    
         
             
                      @custom_data.merge(default_metadata.fetch('custom_data', {}))
         
     | 
| 
       104 
101 
     | 
    
         
             
                    end
         
     | 
| 
       105 
102 
     | 
    
         | 
| 
       106 
     | 
    
         
            -
                    def focal_point
         
     | 
| 
       107 
     | 
    
         
            -
                      default_metadata = @upload.default_field_metadata.deep_stringify_keys
         
     | 
| 
       108 
     | 
    
         
            -
                                                .fetch(I18n.locale.to_s, {})
         
     | 
| 
       109 
     | 
    
         
            -
                      @focal_point || default_metadata['focal_point']
         
     | 
| 
       110 
     | 
    
         
            -
                    end
         
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
103 
     | 
    
         
             
                    def tags
         
     | 
| 
       113 
104 
     | 
    
         
             
                      @upload.tags
         
     | 
| 
       114 
105 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -225,25 +216,8 @@ module Dato 
     | 
|
| 
       225 
216 
     | 
    
         
             
                      ).path(path)
         
     | 
| 
       226 
217 
     | 
    
         
             
                    end
         
     | 
| 
       227 
218 
     | 
    
         | 
| 
       228 
     | 
    
         
            -
                    def url( 
     | 
| 
       229 
     | 
    
         
            -
                       
     | 
| 
       230 
     | 
    
         
            -
             
     | 
| 
       231 
     | 
    
         
            -
                      if focal_point &&
         
     | 
| 
       232 
     | 
    
         
            -
                        query["fit"] == "crop" &&
         
     | 
| 
       233 
     | 
    
         
            -
                        (query["h"] || query["height"]) &&
         
     | 
| 
       234 
     | 
    
         
            -
                        (query["w"] || query["width"]) &&
         
     | 
| 
       235 
     | 
    
         
            -
                        [nil, "focalpoint"].include?(query["crop"]) &&
         
     | 
| 
       236 
     | 
    
         
            -
                        query["fp-x"].nil? &&
         
     | 
| 
       237 
     | 
    
         
            -
                        query["fp-y"].nil?
         
     | 
| 
       238 
     | 
    
         
            -
             
     | 
| 
       239 
     | 
    
         
            -
                        query.merge!(
         
     | 
| 
       240 
     | 
    
         
            -
                          "crop" => "focalpoint",
         
     | 
| 
       241 
     | 
    
         
            -
                          "fp-x" => focal_point[:x],
         
     | 
| 
       242 
     | 
    
         
            -
                          "fp-y" => focal_point[:y],
         
     | 
| 
       243 
     | 
    
         
            -
                        )
         
     | 
| 
       244 
     | 
    
         
            -
                      end
         
     | 
| 
       245 
     | 
    
         
            -
             
     | 
| 
       246 
     | 
    
         
            -
                      file.to_url(query)
         
     | 
| 
      
 219 
     | 
    
         
            +
                    def url(opts = {})
         
     | 
| 
      
 220 
     | 
    
         
            +
                      file.to_url(opts)
         
     | 
| 
       247 
221 
     | 
    
         
             
                    end
         
     | 
| 
       248 
222 
     | 
    
         | 
| 
       249 
223 
     | 
    
         
             
                    def lqip_data_url(opts = {})
         
     | 
| 
         @@ -267,7 +241,6 @@ module Dato 
     | 
|
| 
       267 
241 
     | 
    
         
             
                        alt: alt,
         
     | 
| 
       268 
242 
     | 
    
         
             
                        title: title,
         
     | 
| 
       269 
243 
     | 
    
         
             
                        custom_data: custom_data,
         
     | 
| 
       270 
     | 
    
         
            -
                        focal_point: focal_point,
         
     | 
| 
       271 
244 
     | 
    
         
             
                        url: url,
         
     | 
| 
       272 
245 
     | 
    
         
             
                        copyright: copyright,
         
     | 
| 
       273 
246 
     | 
    
         
             
                        tags: tags,
         
     | 
    
        data/lib/dato/local/loader.rb
    CHANGED
    
    
    
        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.16
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Stefano Verna
         
     | 
| 
       8 
     | 
    
         
            -
            autorequire:
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2020-09- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2020-09-30 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -464,7 +464,7 @@ homepage: https://github.com/datocms/ruby-datocms-client 
     | 
|
| 
       464 
464 
     | 
    
         
             
            licenses:
         
     | 
| 
       465 
465 
     | 
    
         
             
            - MIT
         
     | 
| 
       466 
466 
     | 
    
         
             
            metadata: {}
         
     | 
| 
       467 
     | 
    
         
            -
            post_install_message:
         
     | 
| 
      
 467 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
       468 
468 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       469 
469 
     | 
    
         
             
            require_paths:
         
     | 
| 
       470 
470 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -479,9 +479,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       479 
479 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       480 
480 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       481 
481 
     | 
    
         
             
            requirements: []
         
     | 
| 
       482 
     | 
    
         
            -
             
     | 
| 
       483 
     | 
    
         
            -
             
     | 
| 
       484 
     | 
    
         
            -
            signing_key:
         
     | 
| 
      
 482 
     | 
    
         
            +
            rubygems_version: 3.0.3
         
     | 
| 
      
 483 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
       485 
484 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       486 
485 
     | 
    
         
             
            summary: Ruby client for DatoCMS API
         
     | 
| 
       487 
486 
     | 
    
         
             
            test_files: []
         
     |