Sha256: 8c994d7ecc142026df5865b24cb08fea8d013293fb27529cd59c12a6ff58a2da

Contents?: true

Size: 744 Bytes

Versions: 6

Compression:

Stored size: 744 Bytes

Contents

module {{namespace_module}}
  module {{resource_module}}
    module Update
      class Denormalizer
        include Shogun::Denormalizer
        include {{resource_module}}

        MAPPING = {
          "id" => "id",
          "created_at" => "created_at",
          "destroyed_at" => "destroyed_at",
          "updated_at" => "updated_at",
          "href" => "href"
        }

        def initialize(object:)
          @object = object
          @meta = object.meta
          @links = object.links
          @linked = object.linked
        end

        private def document
          mapping.inject({}) do |hash, (field, name)|
            hash.merge(field => @object.public_send(name))
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
shogun-6.4.2 scaffold/generate/resource/update/denormalizer.rb
shogun-6.4.1 scaffold/generate/resource/update/denormalizer.rb
shogun-6.4.0 scaffold/generate/resource/update/denormalizer.rb
shogun-6.3.0 scaffold/generate/resource/update/denormalizer.rb
shogun-6.2.3 scaffold/generate/resource/update/denormalizer.rb
shogun-6.2.2 scaffold/generate/resource/update/denormalizer.rb