Sha256: 97dae0d309d2d18bbef64da6ed91a0c8247cf611154255ff3664324f469a39d1
Contents?: true
Size: 745 Bytes
Versions: 6
Compression:
Stored size: 745 Bytes
Contents
module Troo class CardRetrieval class << self def all Troo::Card.all end def default new.retrieve end def retrieve(id = nil) new(id).retrieve end end def initialize(id = nil) @id = id end def retrieve return default unless id by_short_id || by_id || by_external_id || remote end private attr_reader :id def default Troo::Card.default end def by_id Troo::Card[id] end def by_short_id Troo::Card.first(short_id: id) end def by_external_id Troo::Card.first(external_card_id: id) end def remote External::Card.fetch(id, { mode: :card }).first end end end
Version data entries
6 entries across 6 versions & 1 rubygems