octokit 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +3 -0
- data/Rakefile +3 -10
- data/changelog.markdown +3 -0
- data/lib/octokit/client.rb +1 -2
- data/lib/octokit/client/authentication.rb +4 -0
- data/lib/octokit/client/commits.rb +1 -1
- data/lib/octokit/client/connection.rb +4 -2
- data/lib/octokit/client/issues.rb +8 -8
- data/lib/octokit/client/network.rb +3 -3
- data/lib/octokit/client/objects.rb +1 -1
- data/lib/octokit/client/organizations.rb +3 -2
- data/lib/octokit/client/pulls.rb +9 -3
- data/lib/octokit/client/repositories.rb +23 -10
- data/lib/octokit/client/request.rb +10 -10
- data/lib/octokit/client/timelines.rb +11 -9
- data/lib/octokit/configuration.rb +21 -19
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +4 -6
- data/spec/faraday/response_spec.rb +33 -0
- data/spec/fixtures/blob.json +1 -0
- data/spec/fixtures/blob_metadata.json +1 -0
- data/spec/fixtures/blobs.json +1 -0
- data/spec/fixtures/branches.json +1 -0
- data/spec/fixtures/collaborators.json +1 -0
- data/spec/fixtures/comment.json +1 -0
- data/spec/fixtures/comments.json +1 -0
- data/spec/fixtures/commit.json +1 -0
- data/spec/fixtures/commits.json +1 -0
- data/spec/fixtures/contributors.json +1 -0
- data/spec/fixtures/delete_token.json +1 -0
- data/spec/fixtures/emails.json +1 -0
- data/spec/fixtures/followers.json +1 -0
- data/spec/fixtures/following.json +1 -0
- data/spec/fixtures/issue.json +1 -0
- data/spec/fixtures/issues.json +1 -0
- data/spec/fixtures/labels.json +1 -0
- data/spec/fixtures/languages.json +1 -0
- data/spec/fixtures/network.json +1 -0
- data/spec/fixtures/network_data.json +1 -0
- data/spec/fixtures/network_meta.json +1 -0
- data/spec/fixtures/organization.json +1 -0
- data/spec/fixtures/organizations.json +1 -0
- data/spec/fixtures/public_keys.json +1 -0
- data/spec/fixtures/pull.json +1 -0
- data/spec/fixtures/pulls.json +1 -0
- data/spec/fixtures/raw.txt +7 -0
- data/spec/fixtures/repositories.json +1 -0
- data/spec/fixtures/repository.json +1 -0
- data/spec/fixtures/tags.json +1 -0
- data/spec/fixtures/team.json +1 -0
- data/spec/fixtures/teams.json +1 -0
- data/spec/fixtures/timeline.json +1237 -0
- data/spec/fixtures/tree.json +1 -0
- data/spec/fixtures/tree_metadata.json +1 -0
- data/spec/fixtures/user.json +1 -0
- data/spec/fixtures/users.json +1 -0
- data/spec/fixtures/watchers.json +1 -0
- data/spec/helper.rb +66 -0
- data/spec/octokit/client/commits_spec.rb +31 -0
- data/spec/octokit/client/issues_spec.rb +155 -0
- data/spec/octokit/client/network_spec.rb +31 -0
- data/spec/octokit/client/objects_spec.rb +75 -0
- data/spec/octokit/client/organizations_spec.rb +233 -0
- data/spec/octokit/client/pulls_spec.rb +43 -0
- data/spec/octokit/client/repositories_spec.rb +330 -0
- data/spec/octokit/client/timelines_spec.rb +41 -0
- data/spec/octokit/client/users_spec.rb +273 -0
- data/spec/octokit/client_spec.rb +12 -0
- data/spec/octokit_spec.rb +14 -0
- data/spec/repository_spec.rb +53 -0
- data/test/helper.rb +2 -0
- data/test/octokit_test.rb +14 -2
- metadata +147 -89
- data/lib/octokit/event.rb +0 -76
data/lib/octokit/event.rb
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
module Octokit
|
2
|
-
class Event
|
3
|
-
|
4
|
-
def self.load_from_atom(entry)
|
5
|
-
entry = entry.to_mash if entry.is_a?(Hash)
|
6
|
-
|
7
|
-
event = Hashie::Mash.new({:user => entry.author, :title => entry.title})
|
8
|
-
event.published = (entry.published.is_a?(String) ? DateTime.parse(entry.published) : entry.published)
|
9
|
-
event.id = entry.id.split("/").pop.to_i
|
10
|
-
|
11
|
-
event.links = entry.links
|
12
|
-
event.content = entry.content
|
13
|
-
|
14
|
-
case entry.id
|
15
|
-
when /CreateEvent/
|
16
|
-
case entry.title
|
17
|
-
when /created tag/
|
18
|
-
event.event_type = 'tag'
|
19
|
-
event.tag = entry.links.first.split('/').pop
|
20
|
-
when /created branch/
|
21
|
-
event.event_type = 'branch'
|
22
|
-
event.branch = entry.links.first.split('/').pop
|
23
|
-
when /created repository/
|
24
|
-
event.event_type = 'repo'
|
25
|
-
end
|
26
|
-
when /MemberEvent/
|
27
|
-
event.event_type = 'member'
|
28
|
-
event.target_user = entry.title.split(" ")[2]
|
29
|
-
when /PushEvent/
|
30
|
-
event.event_type = 'push'
|
31
|
-
event.branch = entry.links.first.split('/').pop
|
32
|
-
when /ForkApplyEvent/
|
33
|
-
event.event_type = 'fork_apply'
|
34
|
-
event.branch = entry.links.first.split('/').pop
|
35
|
-
when /ForkEvent/
|
36
|
-
event.event_type = 'fork'
|
37
|
-
segments = entry.title.split(" ")
|
38
|
-
event.forked_from = Repository.new(segments.last)
|
39
|
-
when /WatchEvent/
|
40
|
-
event.event_type = 'watch'
|
41
|
-
when /FollowEvent/
|
42
|
-
event.event_type = 'follow'
|
43
|
-
event.target_user = entry.links.first.split("/").pop
|
44
|
-
when /IssuesEvent/
|
45
|
-
event.event_type = 'issue'
|
46
|
-
event.action = entry.title[/closed|opened|reopened/]
|
47
|
-
event.issue_number = entry.title[/\s\d+\s/].strip.to_i
|
48
|
-
when /GistEvent/
|
49
|
-
event.event_type = 'gist'
|
50
|
-
event.gist_number = entry.links.first.split('/').pop.to_i
|
51
|
-
when /WikiEvent/
|
52
|
-
event.event_type = 'wiki'
|
53
|
-
event.page = entry.links.first.split('/').pop
|
54
|
-
when /CommitCommentEvent/
|
55
|
-
event.event_type = 'comment'
|
56
|
-
when /DeleteEvent/
|
57
|
-
event.event_type = 'delete'
|
58
|
-
segments = entry.title.split(' ')
|
59
|
-
event.branch = segments[3]
|
60
|
-
event.repo = Repository.new(segments[5])
|
61
|
-
when /PublicEvent/
|
62
|
-
event.event_type = 'public'
|
63
|
-
segments = entry.title.split(' ')
|
64
|
-
event.repo = Repository.new([segments[0], segments[3]].join('/'))
|
65
|
-
when /DownloadEvent/
|
66
|
-
event.event_type = 'download'
|
67
|
-
segments = entry.title.split(' ')
|
68
|
-
event.repo = Repository.new(segments[5])
|
69
|
-
else
|
70
|
-
puts "Unknown event type: #{entry.id}"
|
71
|
-
end
|
72
|
-
event.repo = Repository.from_url(entry.links.first) unless %w(follow gist delete public download).include?(event.event_type)
|
73
|
-
event
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|