Sha256: 04944eaca7563cba710191d1f109896260fdd43ae71e643e9a06521d02afa3c7

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

module Employ
  class Change

    attr_writer :id,
                :url,
                :title,
                :description,
                :author,
                :merger,
                :copied_team_members,
                :referenced_issues,
                :merged_at

    def self.fetch(id)
      source = Github::PullRequest.get(id)

      url, title  = source.values_at('url', 'title')
      author      = source['user']['login']
      merger      = source['merged_by']['login']
      description = source['body']
      merged_at   = source['merged_at']

      referenced_issues   = body.scan(/((\S*)#(\S*))/).map(&:first)
      copied_team_members = body.scan(/@(\S*)/).map(&:first)

      new.tap do |c|
        c.id    = id
        c.url   = url
        c.title = title

        c.description = description
        c.author      = author
        c.merger      = merger
        c.merged_at   = merged_at

        c.copied_team_members = copied_team_members
        c.referenced_issues   = referenced_issues
      end
    end

    # options:
    # - verbose: overrides all to true
    # - url
    # - description
    def to_s(options = {})

    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
employ-0.0.2 lib/employ/change.rb
employ-0.0.1 lib/employ/change.rb