Sha256: 11d4bdb015c2e7db2282acc0e7fd50c12e69b41a9ad57825faa76b6a14f42307

Contents?: true

Size: 448 Bytes

Versions: 6

Compression:

Stored size: 448 Bytes

Contents

module Troo
  class CommentRetrieval
    class << self
      def all
        Troo::Comment.all
      end

      def retrieve(id)
        new(id).retrieve
      end
    end

    def initialize(id)
      @id = id
    end

    def retrieve
      by_id || by_external_id
    end

    private
    attr_reader :id

    def by_id
      Troo::Comment[id]
    end

    def by_external_id
      Troo::Comment.first(external_comment_id: id)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
troo-0.0.7 lib/troo/models/comment_retrieval.rb
troo-0.0.6 lib/troo/models/comment_retrieval.rb
troo-0.0.5 lib/troo/models/comment_retrieval.rb
troo-0.0.4 lib/troo/models/comment_retrieval.rb
troo-0.0.3 lib/troo/models/comment_retrieval.rb
troo-0.0.2 lib/troo/models/comment_retrieval.rb