deep_unrest 0.1.29 → 0.1.30
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:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 3395eda13825d0ecdfe337b515741edc5b5e25a6
         | 
| 4 | 
            +
              data.tar.gz: 0fec2b4c1003af2d6ed883fc1d0398bd457eb875
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 441ebd1c53d3717286b4b30ef2ac201f5470d3d9f718a5757e3dae79b4152c1232b7c1d919f0ea9b554272137eea75c7d5454a7fc1dd2c01db355415c184f318
         | 
| 7 | 
            +
              data.tar.gz: 8b4066e6233a7dd6922e5e9aa55bd2f753d9ceae53714b31b0c3fcf87c1087cc26e95d787d52ced89e3be1c86622fee7ee0304d4c157c8fc4c6c1051b36ba1b4
         | 
    
        data/lib/deep_unrest.rb
    CHANGED
    
    | @@ -250,7 +250,6 @@ module DeepUnrest | |
| 250 250 | 
             
                case action
         | 
| 251 251 | 
             
                when :destroy
         | 
| 252 252 | 
             
                  cursor[:_destroy] = true
         | 
| 253 | 
            -
                  scope[:destroyed] = true
         | 
| 254 253 | 
             
                when :update, :create, :update_all
         | 
| 255 254 | 
             
                  cursor.merge! parse_attributes(type,
         | 
| 256 255 | 
             
                                                 operation[:action],
         | 
| @@ -543,15 +542,13 @@ module DeepUnrest | |
| 543 542 | 
             
                                .compact
         | 
| 544 543 |  | 
| 545 544 | 
             
                if errors.empty?
         | 
| 545 | 
            +
                  destroyed = DeepUnrest::ApplicationController.class_variable_get(
         | 
| 546 | 
            +
                    '@@destroyed_entities'
         | 
| 547 | 
            +
                  )
         | 
| 546 548 | 
             
                  return {
         | 
| 547 549 | 
             
                    redirect_regex: build_redirect_regex(temp_id_map[ctx]),
         | 
| 548 550 | 
             
                    temp_ids: temp_id_map[ctx],
         | 
| 549 | 
            -
                    destroyed:  | 
| 550 | 
            -
                                     .map do |item|
         | 
| 551 | 
            -
                                       { type: item[:type],
         | 
| 552 | 
            -
                                         id: parse_id(item[:id]),
         | 
| 553 | 
            -
                                         destroyed: true }
         | 
| 554 | 
            -
                                     end
         | 
| 551 | 
            +
                    destroyed: destroyed
         | 
| 555 552 | 
             
                  }
         | 
| 556 553 | 
             
                end
         | 
| 557 554 |  | 
| @@ -7,16 +7,30 @@ module DeepUnrest | |
| 7 7 | 
             
                    attr_accessor :deep_unrest_context
         | 
| 8 8 | 
             
                    attr_accessor :deep_unrest_temp_id
         | 
| 9 9 | 
             
                    after_create :map_temp_id
         | 
| 10 | 
            +
                    after_destroy :track_destruction
         | 
| 10 11 | 
             
                  end
         | 
| 11 12 |  | 
| 12 13 | 
             
                  def map_temp_id
         | 
| 13 | 
            -
                    # return unless @deep_unrest_temp_id
         | 
| 14 14 | 
             
                    temp_id_map = DeepUnrest::ApplicationController.class_variable_get(
         | 
| 15 15 | 
             
                      '@@temp_ids'
         | 
| 16 16 | 
             
                    )
         | 
| 17 17 | 
             
                    return unless temp_id_map && @deep_unrest_temp_id
         | 
| 18 18 | 
             
                    temp_id_map[@deep_unrest_context][@deep_unrest_temp_id] = id
         | 
| 19 19 | 
             
                  end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                  # the client needs to know which items were destroyed so it can clean up
         | 
| 22 | 
            +
                  # the dead entities from its local store
         | 
| 23 | 
            +
                  def track_destruction
         | 
| 24 | 
            +
                    destroyed = DeepUnrest::ApplicationController.class_variable_get(
         | 
| 25 | 
            +
                      '@@destroyed_entities'
         | 
| 26 | 
            +
                    )
         | 
| 27 | 
            +
                    return unless destroyed
         | 
| 28 | 
            +
                    destroyed << {
         | 
| 29 | 
            +
                      type: self.class.to_s.pluralize.camelize(:lower),
         | 
| 30 | 
            +
                      id: id,
         | 
| 31 | 
            +
                      destroyed: true
         | 
| 32 | 
            +
                    }
         | 
| 33 | 
            +
                  end
         | 
| 20 34 | 
             
                end
         | 
| 21 35 | 
             
              end
         | 
| 22 36 | 
             
            end
         | 
    
        data/lib/deep_unrest/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: deep_unrest
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.30
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Lynn Hurley
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2018- | 
| 11 | 
            +
            date: 2018-12-11 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rails
         |