Sha256: 1018c369a9263389b476c0516f70327515a50c3b0712a9cd615b370d517adfc3

Contents?: true

Size: 507 Bytes

Versions: 12

Compression:

Stored size: 507 Bytes

Contents

# frozen_string_literal: true

require_relative './../../utils/response'

module Sourcescrub
  # Get the data from API
  module Models
    # Entity
    class Entity
      include ::Sourcescrub::Utils::Response

      def fields
        field_ids.map(&:to_sym)
      end

      def parse_response(response)
        dynamic_attributes(self, field_ids, response)
        self
      end

      def as_json
        fields.each_with_object({}) { |item, hash| hash[item] = send(item) }
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sourcescrub-0.1.3 lib/sourcescrub/models/concerns/entity.rb
sourcescrub-0.1.2 lib/sourcescrub/models/concerns/entity.rb
sourcescrub-0.1.1 lib/sourcescrub/models/concerns/entity.rb
sourcescrub-0.1.0 lib/sourcescrub/models/concerns/entity.rb
sourcescrub-0.0.9 lib/sourcescrub/models/concerns/entity.rb
sourcescrub-0.0.8 lib/sourcescrub/models/concerns/entity.rb
sourcescrub-0.0.7 lib/sourcescrub/models/concerns/entity.rb
sourcescrub-0.0.6 lib/sourcescrub/models/concerns/entity.rb
sourcescrub-0.0.5 lib/sourcescrub/models/concerns/entity.rb
sourcescrub-0.0.4 lib/sourcescrub/models/concerns/entity.rb
sourcescrub-0.0.3 lib/sourcescrub/models/concerns/entity.rb
sourcescrub-0.0.2 lib/sourcescrub/models/concerns/entity.rb