module Shifter 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