Sha256: 7979095e68f31762fb7a9b86ecc607dc12f472b8c7cd731480b56726d45fac87

Contents?: true

Size: 671 Bytes

Versions: 3

Compression:

Stored size: 671 Bytes

Contents

module GitHubRecordsArchiver
  class Comment
    attr_reader :repository
    attr_reader :id

    include DataHelper

    def initialize(repo, id)
      repo = Repository.new(repo) if repo.is_a? String
      @repository = repo
      @id = id
    end

    def self.from_hash(repo, hash)
      comment = Comment.new(repo, hash[:number])
      comment.instance_variable_set '@data', hash.to_h
      comment
    end

    def data
      @data ||= begin
        GitHubRecordsArchiver.client.issue_comment(repository.full_name, id)
      end
    end

    def to_s
      output = "@#{user[:login]} at #{created_at} wrote:\n\n"
      output << body
      output
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
github_records_archiver-0.3.1 lib/github_records_archiver/comment.rb
github_records_archiver-0.2.0 lib/github_records_archiver/comment.rb
github_records_archiver-0.1.0 lib/github_records_archiver/comment.rb