Sha256: 95cd6ad8996b935bf6c97e5683f9e3b44610abcbb35ccbcac6ef75e307050429

Contents?: true

Size: 513 Bytes

Versions: 4

Compression:

Stored size: 513 Bytes

Contents

# frozen_string_literal: true

module AppStoreDevApi
  class Request
    class Body
      def self.inherited(klass)
        super

        klass.include(Object::Included)
        klass.include(Object::Data)
      end

      def initialize(**kwargs)
        @included = self.class::Included.new([*kwargs.delete(:included)])
        @data = self.class::Data.new(**kwargs)
      end

      def to_h
        {
          data: data.to_data_type,
          included: included.to_a
        }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
app_store_dev_api-0.1.9 lib/app_store_dev_api/request/body.rb
app_store_dev_api-0.1.8 lib/app_store_dev_api/request/body.rb
app_store_dev_api-0.1.7 lib/app_store_dev_api/request/body.rb
app_store_dev_api-0.1.6 lib/app_store_dev_api/request/body.rb