Sha256: ad148d3e47c29b07682939ebce31eb22556a983ca69d7d210775e2a1442cd953

Contents?: true

Size: 627 Bytes

Versions: 1

Compression:

Stored size: 627 Bytes

Contents

# frozen_string_literal: true

module Crunchbase
  # Get the Organization data from API
  module Models
    # Root
    class Entity
      include ::Crunchbase::Utilities::Response

      def fields
        field_ids.map(&:to_sym)
      end

      def parse_response(response)
        dynamic_attributes(self, field_ids, response.dig('properties'))
      end

      def parse_cards_response(response)
        parse_response(response, response.dig('properties'))
        # response.dig('cards')
      end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
crunchbase4-0.1.0 lib/crunchbase/models/entity.rb