lhs 11.2.2 → 11.3.0
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 +9 -0
- data/lib/lhs/errors/base.rb +2 -1
- data/lib/lhs/version.rb +1 -1
- data/spec/item/errors_spec.rb +5 -0
- 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: 8307d10c28c26b8729eda6306f597fdb1b133e56
         | 
| 4 | 
            +
              data.tar.gz: 778c8d4b05f16cbbae4947d8088f58a021b36219
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 7afd36265f9a8d867107b0085bc17b5daaa8b97cb203a2ca9ffc58d6bdcbda8b4ec82e15628a4cda447c23a192ed45f2ce12fc09cd14918a1f114e5885918250
         | 
| 7 | 
            +
              data.tar.gz: dfba64d011e51cd084d0de36ac99e90f2f2696e8f2eb22faf2f356b5cb7fdb2122bb6409793df17b7a3b24c6205287b19ce6ef82dbdbc214ca34285f08366e80
         | 
    
        data/README.md
    CHANGED
    
    | @@ -723,6 +723,15 @@ The parameters passed to the `validates` endpoint option are used to perform the | |
| 723 723 | 
             
              endpoint ':service/v2/users', validates: { path: 'validate' }            # will perform a validation via :service/v2/users/validate
         | 
| 724 724 | 
             
            ```
         | 
| 725 725 |  | 
| 726 | 
            +
            ### HTTP Status Codes for validation errors
         | 
| 727 | 
            +
             | 
| 728 | 
            +
            LHS provides the http status code received when performing validations on a record, through the errors object:
         | 
| 729 | 
            +
             | 
| 730 | 
            +
            ```ruby
         | 
| 731 | 
            +
            record.save
         | 
| 732 | 
            +
            record.errors.status_code #400
         | 
| 733 | 
            +
            ```
         | 
| 734 | 
            +
             | 
| 726 735 | 
             
            ### Reset validation errors
         | 
| 727 736 |  | 
| 728 737 | 
             
            Clear the error messages. Compatible with [ActiveRecord](https://github.com/rails/rails/blob/6c8cf21584ced73ade45529d11463c74b5a0c58f/activemodel/lib/active_model/errors.rb#L85).
         | 
    
        data/lib/lhs/errors/base.rb
    CHANGED
    
    | @@ -3,13 +3,14 @@ module LHS::Errors | |
| 3 3 | 
             
              class Base
         | 
| 4 4 | 
             
                include Enumerable
         | 
| 5 5 |  | 
| 6 | 
            -
                attr_reader :messages, :message, :raw, :record
         | 
| 6 | 
            +
                attr_reader :messages, :message, :raw, :record, :status_code
         | 
| 7 7 |  | 
| 8 8 | 
             
                def initialize(response = nil, record = nil)
         | 
| 9 9 | 
             
                  @raw = response.body if response
         | 
| 10 10 | 
             
                  @record = record
         | 
| 11 11 | 
             
                  @messages = messages_from_response(response)
         | 
| 12 12 | 
             
                  @message = message_from_response(response)
         | 
| 13 | 
            +
                  @status_code = response.code if response
         | 
| 13 14 | 
             
                rescue JSON::ParserError
         | 
| 14 15 | 
             
                  @messages = messages || {}
         | 
| 15 16 | 
             
                  @message = 'parse error'
         | 
    
        data/lib/lhs/version.rb
    CHANGED
    
    
    
        data/spec/item/errors_spec.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: lhs
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 11. | 
| 4 | 
            +
              version: 11.3.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - https://github.com/local-ch/lhs/graphs/contributors
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2017-06- | 
| 11 | 
            +
            date: 2017-06-20 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: lhc
         |