Class: Citrus::Core::GithubAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/citrus/core/github_adapter.rb

Instance Method Summary collapse

Instance Method Details

#create_changeset_from_push_data(push_data) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/citrus/core/github_adapter.rb', line 8

def create_changeset_from_push_data(push_data)
  data    = JSON.parse(push_data)
  commits = data['commits'].map do |commit|
    changes = CommitChanges.new(commit['added'], commit['removed'], commit['modified'])
    Commit.new(commit['id'], commit['author']['name'], commit['message'],
               Time.parse(commit['timestamp']), changes, commit['url'])
  end
  repository = Repository.new(data['repository']['url'])
  return Changeset.new(repository, commits)
end