Sha256: e16aa71276bb2361954428ba9cb268401f61bd82d2b016a35985860aaddac134
Contents?: true
Size: 1.53 KB
Versions: 2
Compression:
Stored size: 1.53 KB
Contents
# frozen_string_literal: true require_relative '../utilities/request' require_relative '../utilities/cb_model' module Crunchbase # Whole entities endpoints module Entities # Send request for entities endpoints class Client include ::Crunchbase::Utilities::Request include ::Crunchbase::Utilities::CbModel ROOT_LIST = 'entities' def initialize(entity_id, entity_type) @entity_id = entity_id @entity_type = entity_type end # Will include all attribute from API document def fetch cbobject.parse_response(entity( root_uri, field_ids: cbobject.field_ids.join(',') )) end # Only include a part basis fields of endpoint def fetch_cards(card_names = []) cbobject.parse_cards_response(entity( root_uri, field_ids: cbobject.basis_fields.join(','), cards: (cbobject.full_cards & card_names).join(',') )) end def cards(card_id) cbobject.parse_response(entity( root_uri(name: __method__, id: card_id) )) end private def root_uri(args = {}) [ ROOT_LIST, kclass_name::RESOURCE_LIST, @entity_id, args[:name], args[:id] ].compact.join('/') end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
crunchbase4-0.1.2 | lib/crunchbase/entities/client.rb |
crunchbase4-0.1.1 | lib/crunchbase/entities/client.rb |