mapping 1.1.0 → 1.1.2
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 +5 -5
- checksums.yaml.gz.sig +0 -0
- data/lib/mapping/descendants.rb +5 -20
- data/lib/mapping/model.rb +8 -23
- data/lib/mapping/object_model.rb +6 -20
- data/lib/mapping/version.rb +5 -20
- data/lib/mapping.rb +6 -21
- data/license.md +21 -0
- data/{README.md → readme.md} +35 -89
- data/releases.md +6 -0
- data.tar.gz.sig +0 -0
- metadata +44 -68
- metadata.gz.sig +0 -0
- data/.gitignore +0 -9
- data/.rspec +0 -2
- data/.simplecov +0 -9
- data/.travis.yml +0 -5
- data/Gemfile +0 -9
- data/Rakefile +0 -8
- data/mapping.gemspec +0 -24
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 2 | 
            +
            SHA256:
         | 
| 3 | 
            +
              metadata.gz: '05882acbdcabe2b584a88dfd2fb3aea33722d65fc40d57d9b91786bfc902bd04'
         | 
| 4 | 
            +
              data.tar.gz: 9b41b4868e2735ca3f493e6da1b175fcbb07efc7d5e1c6db838bade0496457cf
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4d2b42bbdd56e611df9469b69395a95bdb6e6b50b80417555b0df29ca9a6267674cbb3fe875234422c1d84acbf2f7190988fbf41e2dffa8c839c3ffc0ecc97f9
         | 
| 7 | 
            +
              data.tar.gz: 2f9541df2f2a51906deadd50fc85dcce264bff33f1bc4b5023056793107ea24c6c95c4b98575f569476b855ff655c869458d2c3b719ebe8b9a949ab09709c4b0
         | 
    
        checksums.yaml.gz.sig
    ADDED
    
    | Binary file | 
    
        data/lib/mapping/descendants.rb
    CHANGED
    
    | @@ -1,25 +1,10 @@ | |
| 1 | 
            -
            #  | 
| 2 | 
            -
             | 
| 3 | 
            -
            #  | 
| 4 | 
            -
            #  | 
| 5 | 
            -
            # in the Software without restriction, including without limitation the rights
         | 
| 6 | 
            -
            # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         | 
| 7 | 
            -
            # copies of the Software, and to permit persons to whom the Software is
         | 
| 8 | 
            -
            # furnished to do so, subject to the following conditions:
         | 
| 9 | 
            -
            # 
         | 
| 10 | 
            -
            # The above copyright notice and this permission notice shall be included in
         | 
| 11 | 
            -
            # all copies or substantial portions of the Software.
         | 
| 12 | 
            -
            # 
         | 
| 13 | 
            -
            # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 14 | 
            -
            # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         | 
| 15 | 
            -
            # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         | 
| 16 | 
            -
            # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         | 
| 17 | 
            -
            # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         | 
| 18 | 
            -
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 19 | 
            -
            # THE SOFTWARE.
         | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # Released under the MIT License.
         | 
| 4 | 
            +
            # Copyright, 2017-2025, by Samuel Williams.
         | 
| 20 5 |  | 
| 21 6 | 
             
            module Mapping
         | 
| 22 7 | 
             
            	def self.lookup_descendants(klass)
         | 
| 23 8 | 
             
            		ObjectSpace.each_object(Class).select{|other| other < klass}
         | 
| 24 9 | 
             
            	end
         | 
| 25 | 
            -
            end
         | 
| 10 | 
            +
            end
         | 
    
        data/lib/mapping/model.rb
    CHANGED
    
    | @@ -1,30 +1,15 @@ | |
| 1 | 
            -
            #  | 
| 2 | 
            -
             | 
| 3 | 
            -
            #  | 
| 4 | 
            -
            #  | 
| 5 | 
            -
            # in the Software without restriction, including without limitation the rights
         | 
| 6 | 
            -
            # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         | 
| 7 | 
            -
            # copies of the Software, and to permit persons to whom the Software is
         | 
| 8 | 
            -
            # furnished to do so, subject to the following conditions:
         | 
| 9 | 
            -
            # 
         | 
| 10 | 
            -
            # The above copyright notice and this permission notice shall be included in
         | 
| 11 | 
            -
            # all copies or substantial portions of the Software.
         | 
| 12 | 
            -
            # 
         | 
| 13 | 
            -
            # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 14 | 
            -
            # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         | 
| 15 | 
            -
            # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         | 
| 16 | 
            -
            # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         | 
| 17 | 
            -
            # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         | 
| 18 | 
            -
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 19 | 
            -
            # THE SOFTWARE.
         | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # Released under the MIT License.
         | 
| 4 | 
            +
            # Copyright, 2016-2025, by Samuel Williams.
         | 
| 20 5 |  | 
| 21 6 | 
             
            module Mapping
         | 
| 22 7 | 
             
            	class Model
         | 
| 23 | 
            -
            		PREFIX =  | 
| 8 | 
            +
            		PREFIX = "map_".freeze
         | 
| 24 9 |  | 
| 25 10 | 
             
            		# This function generates mapping names like `map_Array` and `map_Hash` which while a bit non-standard are perfectly fine for our purposes and this never really needs to leak.
         | 
| 26 11 | 
             
            		def self.method_for_mapping(klass)
         | 
| 27 | 
            -
            			PREFIX + klass.name.gsub(/::/,  | 
| 12 | 
            +
            			PREFIX + klass.name.gsub(/::/, "_")
         | 
| 28 13 | 
             
            		end
         | 
| 29 14 |  | 
| 30 15 | 
             
            		# Get the name of the method for mapping the given object.
         | 
| @@ -54,10 +39,10 @@ module Mapping | |
| 54 39 | 
             
            		end
         | 
| 55 40 |  | 
| 56 41 | 
             
            		# The primary function, which maps an input object to an output object.
         | 
| 57 | 
            -
            		def map(root, * | 
| 42 | 
            +
            		def map(root, *arguments, **options)
         | 
| 58 43 | 
             
            			method_name = self.method_for_mapping(root)
         | 
| 59 44 |  | 
| 60 | 
            -
            			self.send(method_name, root, * | 
| 45 | 
            +
            			self.send(method_name, root, *arguments, **options)
         | 
| 61 46 | 
             
            		end
         | 
| 62 47 | 
             
            	end
         | 
| 63 48 | 
             
            end
         | 
    
        data/lib/mapping/object_model.rb
    CHANGED
    
    | @@ -1,24 +1,10 @@ | |
| 1 | 
            -
            #  | 
| 2 | 
            -
            # 
         | 
| 3 | 
            -
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 4 | 
            -
            # of this software and associated documentation files (the "Software"), to deal
         | 
| 5 | 
            -
            # in the Software without restriction, including without limitation the rights
         | 
| 6 | 
            -
            # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         | 
| 7 | 
            -
            # copies of the Software, and to permit persons to whom the Software is
         | 
| 8 | 
            -
            # furnished to do so, subject to the following conditions:
         | 
| 9 | 
            -
            # 
         | 
| 10 | 
            -
            # The above copyright notice and this permission notice shall be included in
         | 
| 11 | 
            -
            # all copies or substantial portions of the Software.
         | 
| 12 | 
            -
            # 
         | 
| 13 | 
            -
            # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 14 | 
            -
            # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         | 
| 15 | 
            -
            # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         | 
| 16 | 
            -
            # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         | 
| 17 | 
            -
            # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         | 
| 18 | 
            -
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 19 | 
            -
            # THE SOFTWARE.
         | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 20 2 |  | 
| 21 | 
            -
             | 
| 3 | 
            +
            # Released under the MIT License.
         | 
| 4 | 
            +
            # Copyright, 2016-2025, by Samuel Williams.
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            require_relative "model"
         | 
| 7 | 
            +
            require_relative "descendants"
         | 
| 22 8 |  | 
| 23 9 | 
             
            module Mapping
         | 
| 24 10 | 
             
            	# Provides a useful starting point for object based mappings. Handles, true, false, nil, Array and Hash by default, simply by passing through.
         | 
    
        data/lib/mapping/version.rb
    CHANGED
    
    | @@ -1,23 +1,8 @@ | |
| 1 | 
            -
            #  | 
| 2 | 
            -
             | 
| 3 | 
            -
            #  | 
| 4 | 
            -
            #  | 
| 5 | 
            -
            # in the Software without restriction, including without limitation the rights
         | 
| 6 | 
            -
            # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         | 
| 7 | 
            -
            # copies of the Software, and to permit persons to whom the Software is
         | 
| 8 | 
            -
            # furnished to do so, subject to the following conditions:
         | 
| 9 | 
            -
            # 
         | 
| 10 | 
            -
            # The above copyright notice and this permission notice shall be included in
         | 
| 11 | 
            -
            # all copies or substantial portions of the Software.
         | 
| 12 | 
            -
            # 
         | 
| 13 | 
            -
            # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 14 | 
            -
            # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         | 
| 15 | 
            -
            # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         | 
| 16 | 
            -
            # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         | 
| 17 | 
            -
            # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         | 
| 18 | 
            -
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 19 | 
            -
            # THE SOFTWARE.
         | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # Released under the MIT License.
         | 
| 4 | 
            +
            # Copyright, 2016-2025, by Samuel Williams.
         | 
| 20 5 |  | 
| 21 6 | 
             
            module Mapping
         | 
| 22 | 
            -
            	VERSION = "1.1. | 
| 7 | 
            +
            	VERSION = "1.1.2"
         | 
| 23 8 | 
             
            end
         | 
    
        data/lib/mapping.rb
    CHANGED
    
    | @@ -1,23 +1,8 @@ | |
| 1 | 
            -
            #  | 
| 2 | 
            -
            # 
         | 
| 3 | 
            -
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 4 | 
            -
            # of this software and associated documentation files (the "Software"), to deal
         | 
| 5 | 
            -
            # in the Software without restriction, including without limitation the rights
         | 
| 6 | 
            -
            # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         | 
| 7 | 
            -
            # copies of the Software, and to permit persons to whom the Software is
         | 
| 8 | 
            -
            # furnished to do so, subject to the following conditions:
         | 
| 9 | 
            -
            # 
         | 
| 10 | 
            -
            # The above copyright notice and this permission notice shall be included in
         | 
| 11 | 
            -
            # all copies or substantial portions of the Software.
         | 
| 12 | 
            -
            # 
         | 
| 13 | 
            -
            # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 14 | 
            -
            # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         | 
| 15 | 
            -
            # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         | 
| 16 | 
            -
            # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         | 
| 17 | 
            -
            # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         | 
| 18 | 
            -
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 19 | 
            -
            # THE SOFTWARE.
         | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 20 2 |  | 
| 21 | 
            -
             | 
| 3 | 
            +
            # Released under the MIT License.
         | 
| 4 | 
            +
            # Copyright, 2016-2025, by Samuel Williams.
         | 
| 22 5 |  | 
| 23 | 
            -
            require_relative  | 
| 6 | 
            +
            require_relative "mapping/version"
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            require_relative "mapping/model"
         | 
    
        data/license.md
    ADDED
    
    | @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            # MIT License
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Copyright, 2016-2025, by Samuel Williams.  
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 6 | 
            +
            of this software and associated documentation files (the "Software"), to deal
         | 
| 7 | 
            +
            in the Software without restriction, including without limitation the rights
         | 
| 8 | 
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         | 
| 9 | 
            +
            copies of the Software, and to permit persons to whom the Software is
         | 
| 10 | 
            +
            furnished to do so, subject to the following conditions:
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            The above copyright notice and this permission notice shall be included in all
         | 
| 13 | 
            +
            copies or substantial portions of the Software.
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 16 | 
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         | 
| 17 | 
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         | 
| 18 | 
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         | 
| 19 | 
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         | 
| 20 | 
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         | 
| 21 | 
            +
            SOFTWARE.
         | 
    
        data/{README.md → readme.md}
    RENAMED
    
    | @@ -2,30 +2,28 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            The mapping gem is a structured system for mapping one model to another, using an intermediate model which represents the transformation to apply.
         | 
| 4 4 |  | 
| 5 | 
            -
            [](https://codeclimate.com/github/ioquatix/mapping)
         | 
| 7 | 
            -
            [](https://coveralls.io/r/ioquatix/mapping)
         | 
| 5 | 
            +
            [](https://github.com/ioquatix/mapping/actions?workflow=Test)
         | 
| 8 6 |  | 
| 9 7 | 
             
            ## Motivation
         | 
| 10 8 |  | 
| 11 | 
            -
            I've been thinking (and designing) versioned APIs which serve their data primarily from `ActiveRecord` models. Initially we have been using `as_json/serializable_hash/to_json` where it made sense. | 
| 9 | 
            +
            I've been thinking (and designing) versioned APIs which serve their data primarily from `ActiveRecord` models. Initially we have been using `as_json/serializable_hash/to_json` where it made sense.
         | 
| 12 10 |  | 
| 13 | 
            -
             | 
| 11 | 
            +
                records.as_json
         | 
| 14 12 |  | 
| 15 13 | 
             
            This was fine for really simple models and APIs. However, as things get more complex, this approach gets cumbersome:
         | 
| 16 14 |  | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 15 | 
            +
                records.as_json(
         | 
| 16 | 
            +
                	only: [:id, :name, :image, :longitude, :latitude],
         | 
| 17 | 
            +
                	include: [:major_category, :categories],
         | 
| 18 | 
            +
                )
         | 
| 21 19 |  | 
| 22 20 | 
             
            We need versioned, internationalized APIs which don't always directly match up to the underlying database models, or in some cases the underlying models change but the API should remain stable (e.g. column renamed, tables changed).
         | 
| 23 21 |  | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 22 | 
            +
                # image attribute was renamed to image_url, how do we version the response?
         | 
| 23 | 
            +
                records.as_json(
         | 
| 24 | 
            +
                	only: [:id, :name, :image_url, :longitude, :latitude],
         | 
| 25 | 
            +
                	include: [:major_category, :categories],
         | 
| 26 | 
            +
                )
         | 
| 29 27 |  | 
| 30 28 | 
             
            It's also not obvious how to inject methods that take arguments, or even handle per-request state (e.g. `Accept-Language`). Even if it is possible (e.g. using a lambda) I'm not sure that this approach is really desirable - the argument list is becoming impossibly complex: Possibly buggy, hard to reuse, test and difficult to document.
         | 
| 31 29 |  | 
| @@ -39,99 +37,47 @@ The design of this library is centered around being explicit where being explici | |
| 39 37 |  | 
| 40 38 | 
             
            Add this line to your application's Gemfile:
         | 
| 41 39 |  | 
| 42 | 
            -
             | 
| 40 | 
            +
                gem 'mapping'
         | 
| 43 41 |  | 
| 44 42 | 
             
            And then execute:
         | 
| 45 43 |  | 
| 46 | 
            -
             | 
| 44 | 
            +
                $ bundle
         | 
| 47 45 |  | 
| 48 46 | 
             
            Or install it yourself as:
         | 
| 49 47 |  | 
| 50 | 
            -
             | 
| 48 | 
            +
                $ gem install mapping
         | 
| 51 49 |  | 
| 52 50 | 
             
            ## Usage
         | 
| 53 51 |  | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
            ```ruby
         | 
| 57 | 
            -
            # Your database model:
         | 
| 58 | 
            -
            module Human
         | 
| 59 | 
            -
            	Person = Struct.new(:name, :age, :posessions)
         | 
| 60 | 
            -
            	Possession = Struct.new(:name, :value)
         | 
| 61 | 
            -
            end
         | 
| 62 | 
            -
             | 
| 63 | 
            -
            # Your mapping model:
         | 
| 64 | 
            -
            class APIv1 < Mapping::ObjectModel
         | 
| 65 | 
            -
            	map(Human::Person) do |object|
         | 
| 66 | 
            -
            		{
         | 
| 67 | 
            -
            			name: object.name,
         | 
| 68 | 
            -
            			age: object.age,
         | 
| 69 | 
            -
            		}
         | 
| 70 | 
            -
            	end
         | 
| 71 | 
            -
            end
         | 
| 72 | 
            -
             | 
| 73 | 
            -
            class APIv2 < APIv1
         | 
| 74 | 
            -
            	map(Human::Person) do |object|
         | 
| 75 | 
            -
            		super.merge(
         | 
| 76 | 
            -
            			posessions: self.map(object.posessions)
         | 
| 77 | 
            -
            		)
         | 
| 78 | 
            -
            	end
         | 
| 79 | 
            -
            	
         | 
| 80 | 
            -
            	map(Human::Possession) do |object|
         | 
| 81 | 
            -
            		{
         | 
| 82 | 
            -
            			name: object.name,
         | 
| 83 | 
            -
            			value: object.value,
         | 
| 84 | 
            -
            		}
         | 
| 85 | 
            -
            	end
         | 
| 86 | 
            -
            end
         | 
| 87 | 
            -
            ```
         | 
| 88 | 
            -
             | 
| 89 | 
            -
            A simple use case would be something like the following:
         | 
| 90 | 
            -
             | 
| 91 | 
            -
            ```ruby
         | 
| 92 | 
            -
            model = APIv1.new
         | 
| 93 | 
            -
             | 
| 94 | 
            -
            person = Human::Person.new('Bob Jones', 200, [])
         | 
| 95 | 
            -
            person.posessions << Human::Possession.new('Vase', '$20')
         | 
| 96 | 
            -
             | 
| 97 | 
            -
            expect(model.map(person)).to be == {
         | 
| 98 | 
            -
            	name: 'Bob Jones',
         | 
| 99 | 
            -
            	age: 200
         | 
| 100 | 
            -
            }
         | 
| 101 | 
            -
            ```
         | 
| 52 | 
            +
            Please see the [project documentation](https://github.com/ioquatix/mapping) for more details.
         | 
| 102 53 |  | 
| 103 54 | 
             
            ### Model vs ObjectModel
         | 
| 104 55 |  | 
| 105 56 | 
             
            The base `Mapping::Model` class provides only the basic structure required to create and invoke mapping methods. The `Mapping::ObjectModel` provides a few default mappings for `true`, `false`, `nil`, `Array` and `Hash`.
         | 
| 106 57 |  | 
| 107 | 
            -
            ##  | 
| 58 | 
            +
            ## Releases
         | 
| 59 | 
            +
             | 
| 60 | 
            +
            Please see the [project releases](https://github.com/ioquatix/mappingreleases/index) for all releases.
         | 
| 61 | 
            +
             | 
| 62 | 
            +
            ### v1.1.2
         | 
| 108 63 |  | 
| 109 | 
            -
             | 
| 110 | 
            -
             | 
| 111 | 
            -
             | 
| 112 | 
            -
             | 
| 113 | 
            -
            5. Create new Pull Request
         | 
| 64 | 
            +
              - Improve compatibility issues with Ruby 3+.
         | 
| 65 | 
            +
              - Migrate test suite to sus and add continuous integration tests.
         | 
| 66 | 
            +
             | 
| 67 | 
            +
            ## Contributing
         | 
| 114 68 |  | 
| 115 | 
            -
             | 
| 69 | 
            +
            We welcome contributions to this project.
         | 
| 116 70 |  | 
| 117 | 
            -
             | 
| 71 | 
            +
            1.  Fork it.
         | 
| 72 | 
            +
            2.  Create your feature branch (`git checkout -b my-new-feature`).
         | 
| 73 | 
            +
            3.  Commit your changes (`git commit -am 'Add some feature'`).
         | 
| 74 | 
            +
            4.  Push to the branch (`git push origin my-new-feature`).
         | 
| 75 | 
            +
            5.  Create new Pull Request.
         | 
| 118 76 |  | 
| 119 | 
            -
             | 
| 77 | 
            +
            ### Developer Certificate of Origin
         | 
| 120 78 |  | 
| 121 | 
            -
             | 
| 122 | 
            -
            of this software and associated documentation files (the "Software"), to deal
         | 
| 123 | 
            -
            in the Software without restriction, including without limitation the rights
         | 
| 124 | 
            -
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         | 
| 125 | 
            -
            copies of the Software, and to permit persons to whom the Software is
         | 
| 126 | 
            -
            furnished to do so, subject to the following conditions:
         | 
| 79 | 
            +
            In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
         | 
| 127 80 |  | 
| 128 | 
            -
             | 
| 129 | 
            -
            all copies or substantial portions of the Software.
         | 
| 81 | 
            +
            ### Community Guidelines
         | 
| 130 82 |  | 
| 131 | 
            -
             | 
| 132 | 
            -
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         | 
| 133 | 
            -
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         | 
| 134 | 
            -
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         | 
| 135 | 
            -
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         | 
| 136 | 
            -
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 137 | 
            -
            THE SOFTWARE.
         | 
| 83 | 
            +
            This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
         | 
    
        data/releases.md
    ADDED
    
    
    
        data.tar.gz.sig
    ADDED
    
    | Binary file | 
    
        metadata
    CHANGED
    
    | @@ -1,83 +1,61 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: mapping
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.1. | 
| 4 | 
            +
              version: 1.1.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Samuel Williams
         | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
               | 
| 15 | 
            -
               | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
               | 
| 21 | 
            -
               | 
| 22 | 
            -
               | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
               | 
| 29 | 
            -
               | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
               | 
| 35 | 
            -
               | 
| 36 | 
            -
               | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            -
              name: rspec
         | 
| 43 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 | 
            -
                requirements:
         | 
| 45 | 
            -
                - - "~>"
         | 
| 46 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            -
                    version: '3.0'
         | 
| 48 | 
            -
              type: :development
         | 
| 49 | 
            -
              prerelease: false
         | 
| 50 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 | 
            -
                requirements:
         | 
| 52 | 
            -
                - - "~>"
         | 
| 53 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            -
                    version: '3.0'
         | 
| 55 | 
            -
            description: Map model objects based on their class to a given output model. Useful
         | 
| 56 | 
            -
              for versioning external interfaces (e.g. JSON APIs) or processing structured data
         | 
| 57 | 
            -
              from one format to another.
         | 
| 58 | 
            -
            email:
         | 
| 59 | 
            -
            - samuel.williams@oriontransfer.co.nz
         | 
| 8 | 
            +
            bindir: bin
         | 
| 9 | 
            +
            cert_chain:
         | 
| 10 | 
            +
            - |
         | 
| 11 | 
            +
              -----BEGIN CERTIFICATE-----
         | 
| 12 | 
            +
              MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
         | 
| 13 | 
            +
              ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
         | 
| 14 | 
            +
              CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
         | 
| 15 | 
            +
              MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
         | 
| 16 | 
            +
              MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
         | 
| 17 | 
            +
              bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
         | 
| 18 | 
            +
              igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
         | 
| 19 | 
            +
              9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
         | 
| 20 | 
            +
              sGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo1YqoE
         | 
| 21 | 
            +
              e5AUKRwUuvaUaumAKgPH+4E4oiLXI4T1Ff5Q7xxv6yXvHuYtlMHhYfgNn8iiW8WN
         | 
| 22 | 
            +
              XibYXPNP7NtieSQqwR/xM6IRSoyXKuS+ZNGDPUUGk8RoiV/xvVN4LrVm9upSc0ss
         | 
| 23 | 
            +
              RZ6qwOQmXCo/lLcDUxJAgG95cPw//sI00tZan75VgsGzSWAOdjQpFM0l4dxvKwHn
         | 
| 24 | 
            +
              tUeT3ZsAgt0JnGqNm2Bkz81kG4A2hSyFZTFA8vZGhp+hz+8Q573tAR89y9YJBdYM
         | 
| 25 | 
            +
              zp0FM4zwMNEUwgfRzv1tEVVUEXmoFCyhzonUUw4nE4CFu/sE3ffhjKcXcY//qiSW
         | 
| 26 | 
            +
              xm4erY3XAgMBAAGjgZowgZcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
         | 
| 27 | 
            +
              BBYEFO9t7XWuFf2SKLmuijgqR4sGDlRsMC4GA1UdEQQnMCWBI3NhbXVlbC53aWxs
         | 
| 28 | 
            +
              aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWBI3NhbXVlbC53aWxs
         | 
| 29 | 
            +
              aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEBCwUAA4IBgQB5sxkE
         | 
| 30 | 
            +
              cBsSYwK6fYpM+hA5B5yZY2+L0Z+27jF1pWGgbhPH8/FjjBLVn+VFok3CDpRqwXCl
         | 
| 31 | 
            +
              xCO40JEkKdznNy2avOMra6PFiQyOE74kCtv7P+Fdc+FhgqI5lMon6tt9rNeXmnW/
         | 
| 32 | 
            +
              c1NaMRdxy999hmRGzUSFjozcCwxpy/LwabxtdXwXgSay4mQ32EDjqR1TixS1+smp
         | 
| 33 | 
            +
              8C/NCWgpIfzpHGJsjvmH2wAfKtTTqB9CVKLCWEnCHyCaRVuKkrKjqhYCdmMBqCws
         | 
| 34 | 
            +
              JkxfQWC+jBVeG9ZtPhQgZpfhvh+6hMhraUYRQ6XGyvBqEUe+yo6DKIT3MtGE2+CP
         | 
| 35 | 
            +
              eX9i9ZWBydWb8/rvmwmX2kkcBbX0hZS1rcR593hGc61JR6lvkGYQ2MYskBveyaxt
         | 
| 36 | 
            +
              Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
         | 
| 37 | 
            +
              voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
         | 
| 38 | 
            +
              -----END CERTIFICATE-----
         | 
| 39 | 
            +
            date: 2025-03-29 00:00:00.000000000 Z
         | 
| 40 | 
            +
            dependencies: []
         | 
| 60 41 | 
             
            executables: []
         | 
| 61 42 | 
             
            extensions: []
         | 
| 62 43 | 
             
            extra_rdoc_files: []
         | 
| 63 44 | 
             
            files:
         | 
| 64 | 
            -
            - ".gitignore"
         | 
| 65 | 
            -
            - ".rspec"
         | 
| 66 | 
            -
            - ".simplecov"
         | 
| 67 | 
            -
            - ".travis.yml"
         | 
| 68 | 
            -
            - Gemfile
         | 
| 69 | 
            -
            - README.md
         | 
| 70 | 
            -
            - Rakefile
         | 
| 71 45 | 
             
            - lib/mapping.rb
         | 
| 72 46 | 
             
            - lib/mapping/descendants.rb
         | 
| 73 47 | 
             
            - lib/mapping/model.rb
         | 
| 74 48 | 
             
            - lib/mapping/object_model.rb
         | 
| 75 49 | 
             
            - lib/mapping/version.rb
         | 
| 76 | 
            -
            -  | 
| 50 | 
            +
            - license.md
         | 
| 51 | 
            +
            - readme.md
         | 
| 52 | 
            +
            - releases.md
         | 
| 77 53 | 
             
            homepage: https://github.com/ioquatix/mapping
         | 
| 78 | 
            -
            licenses: | 
| 79 | 
            -
             | 
| 80 | 
            -
             | 
| 54 | 
            +
            licenses:
         | 
| 55 | 
            +
            - MIT
         | 
| 56 | 
            +
            metadata:
         | 
| 57 | 
            +
              funding_uri: https://github.com/sponsors/ioquatix/
         | 
| 58 | 
            +
              source_code_uri: https://github.com/ioquatix/mapping.git
         | 
| 81 59 | 
             
            rdoc_options: []
         | 
| 82 60 | 
             
            require_paths:
         | 
| 83 61 | 
             
            - lib
         | 
| @@ -85,16 +63,14 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 85 63 | 
             
              requirements:
         | 
| 86 64 | 
             
              - - ">="
         | 
| 87 65 | 
             
                - !ruby/object:Gem::Version
         | 
| 88 | 
            -
                  version: ' | 
| 66 | 
            +
                  version: '3.1'
         | 
| 89 67 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 90 68 | 
             
              requirements:
         | 
| 91 69 | 
             
              - - ">="
         | 
| 92 70 | 
             
                - !ruby/object:Gem::Version
         | 
| 93 71 | 
             
                  version: '0'
         | 
| 94 72 | 
             
            requirements: []
         | 
| 95 | 
            -
             | 
| 96 | 
            -
            rubygems_version: 2.6.10
         | 
| 97 | 
            -
            signing_key: 
         | 
| 73 | 
            +
            rubygems_version: 3.6.2
         | 
| 98 74 | 
             
            specification_version: 4
         | 
| 99 75 | 
             
            summary: Map an input model to an output model using a mapping model.
         | 
| 100 76 | 
             
            test_files: []
         | 
    
        metadata.gz.sig
    ADDED
    
    | Binary file | 
    
        data/.gitignore
    DELETED
    
    
    
        data/.rspec
    DELETED
    
    
    
        data/.simplecov
    DELETED
    
    
    
        data/.travis.yml
    DELETED
    
    
    
        data/Gemfile
    DELETED
    
    
    
        data/Rakefile
    DELETED
    
    
    
        data/mapping.gemspec
    DELETED
    
    | @@ -1,24 +0,0 @@ | |
| 1 | 
            -
            # coding: utf-8
         | 
| 2 | 
            -
            lib = File.expand_path('../lib', __FILE__)
         | 
| 3 | 
            -
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         | 
| 4 | 
            -
            require 'mapping/version'
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            Gem::Specification.new do |spec|
         | 
| 7 | 
            -
            	spec.name          = "mapping"
         | 
| 8 | 
            -
            	spec.version       = Mapping::VERSION
         | 
| 9 | 
            -
            	spec.authors       = ["Samuel Williams"]
         | 
| 10 | 
            -
            	spec.email         = ["samuel.williams@oriontransfer.co.nz"]
         | 
| 11 | 
            -
             | 
| 12 | 
            -
            	spec.summary       = %q{Map an input model to an output model using a mapping model.}
         | 
| 13 | 
            -
            	spec.description   = %q{Map model objects based on their class to a given output model. Useful for versioning external interfaces (e.g. JSON APIs) or processing structured data from one format to another.}
         | 
| 14 | 
            -
            	spec.homepage      = "https://github.com/ioquatix/mapping"
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            	spec.files         = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
         | 
| 17 | 
            -
            	spec.bindir        = "exe"
         | 
| 18 | 
            -
            	spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         | 
| 19 | 
            -
            	spec.require_paths = ["lib"]
         | 
| 20 | 
            -
             | 
| 21 | 
            -
            	spec.add_development_dependency "bundler", "~> 1.11"
         | 
| 22 | 
            -
            	spec.add_development_dependency "rake", "~> 10.0"
         | 
| 23 | 
            -
            	spec.add_development_dependency "rspec", "~> 3.0"
         | 
| 24 | 
            -
            end
         |