gitcafeapi 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/Gemfile +4 -0
- data/README.md +33 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/gitcafeapi-0.1.0.gem +0 -0
- data/gitcafeapi.gemspec +31 -0
- data/lib/gitcafeapi/version.rb +3 -0
- data/lib/gitcafeapi.rb +242 -0
- metadata +83 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: d2e6605577127a99ec138a8993702519dff45150
|
|
4
|
+
data.tar.gz: f804d7d7a271d932222867198a15c50a584e56dd
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 2a5743a11a69dd223a7426ef439335f147904cec7a2630cdf9fd7213d2ed5caa520576e069dec5ede46e5cdd7edf7977497c736dd5afd5561d722b6c8768eca1
|
|
7
|
+
data.tar.gz: b275b707680daa444f4b7890e8b83b8f3f40aa81965ce5edd8e65a8fb34e201d094730af117aeb2fd48a6165d6255b656ec1dc6bc8116f955d59d8665c62167a
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# GitCafe API Gem
|
|
2
|
+
|
|
3
|
+
This Gem is use fot calling GitCafe's API , You can check it out on [GitCafe's API Documents](api.gitcafe.com)
|
|
4
|
+
|
|
5
|
+
Tips: Checkout Your API Version Before you use it.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'gitcafeapi'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle
|
|
16
|
+
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
|
|
19
|
+
$ gem install gitcafeapi
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
Checkout Your API Version Before you use it.
|
|
24
|
+
|
|
25
|
+
## Development
|
|
26
|
+
|
|
27
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
28
|
+
|
|
29
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
30
|
+
|
|
31
|
+
## Contributing
|
|
32
|
+
|
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gitcafeapi.
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "gitcafeapi"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
|
Binary file
|
data/gitcafeapi.gemspec
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'gitcafeapi/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "gitcafeapi"
|
|
8
|
+
spec.version = Gitcafeapi::VERSION
|
|
9
|
+
spec.authors = ["Tex Wang"]
|
|
10
|
+
spec.email = ["990210wyx@gmail.com"]
|
|
11
|
+
spec.licenses = ['MIT']
|
|
12
|
+
spec.summary = "GitCafe Api Gem"
|
|
13
|
+
spec.description = "This is a Gem for calling GitCafe's API, It helps you to use the APIs easier. And if you get confused with it, email me and I'll help you out."
|
|
14
|
+
spec.homepage = "http://null.nil"
|
|
15
|
+
|
|
16
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
|
17
|
+
# delete this section to allow pushing this gem to any host.
|
|
18
|
+
# if spec.respond_to?(:metadata)
|
|
19
|
+
# spec.metadata['allowed_push_host'] = "none"
|
|
20
|
+
# else
|
|
21
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
|
22
|
+
# end
|
|
23
|
+
|
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
25
|
+
spec.bindir = "exe"
|
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
27
|
+
spec.require_paths = ["lib"]
|
|
28
|
+
|
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
31
|
+
end
|
data/lib/gitcafeapi.rb
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
require "gitcafeapi/version"
|
|
2
|
+
require "net/http"
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
module Gitcafeapi
|
|
7
|
+
|
|
8
|
+
# Def GitCafe API Version
|
|
9
|
+
$api_ersion = "v1"
|
|
10
|
+
|
|
11
|
+
# Def Basic GitCafe API URI
|
|
12
|
+
$basic_url = "https://api.gitcafe.com/api/#{$api_version}"
|
|
13
|
+
|
|
14
|
+
# GitCafe Api Class:Account
|
|
15
|
+
class Account
|
|
16
|
+
|
|
17
|
+
def self.get_user(account_username)
|
|
18
|
+
@info = Net::HTTP.get(URI("#{$basic_url}/account/#{@account_username}"))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# GitCafe Api Class:Orgs
|
|
25
|
+
class Orgs
|
|
26
|
+
|
|
27
|
+
protected
|
|
28
|
+
|
|
29
|
+
def get_org(org)
|
|
30
|
+
info = Net::HTTP.get(URI("#{$basic_url}/orgs/#{@org}"))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# GitCafe Api Class:Projects
|
|
38
|
+
class Projects
|
|
39
|
+
|
|
40
|
+
@@project_url = "#{$basic_url}/projects/"
|
|
41
|
+
|
|
42
|
+
def self.get_project (owner,project)
|
|
43
|
+
info = Net::HTTP.get (URI("#{@@project_url}/#{@owner}/#{@project}"))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def get_assignees (owner,project)
|
|
49
|
+
info = Net::HTTP.get (URI("#{@@project_url}/#{@owner}/#{@project}/assignees"))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def get_collaborators (owner,project)
|
|
55
|
+
info = Net::HTTP.get (URI("#{@@project_url}/#{@owner}/#{@project}/collaborators"))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def delete_comment (owner,project,id)
|
|
61
|
+
# No need, Not Coding Yet
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def get_commits (owner,project,sha)
|
|
65
|
+
info = Net::HTTP.get (URI("#{@@project_url}/#{@owner}/#{@project}/commits/#{sha}"))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def get_commits_treeish (owner,project,treeish)
|
|
71
|
+
info = Net::HTTP.get (URI("#{@@project_url}/#{@owner}/#{@project}/commits/#{treeish}"))
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def post_commit_treeish_comments (owner,project,treeish)
|
|
77
|
+
info = Net::HTTP.post (URI("#{@@project_url}/#{@owner}/#{@project}/commits/#{treeish}/comments", "post"))
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def get_commit_treeish_comments(owner,project,treeish)
|
|
83
|
+
info = Net::HTTP.get (URI("#{@@project_url}/#{@owner}/#{@project}/commits/#{treeish}/comments"))
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def get_deploy_keys (owner,project)
|
|
89
|
+
# Useless for now
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def get_deploy_keys (owner,project)
|
|
93
|
+
# Useless for now
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def get_diff (owner,project,base_commit,head_commit)
|
|
97
|
+
info = Net::HTTP.get (URI("#{@@project_url}/#{@owner}/#{@project}/#{base_commit}/#{head_commit}"))
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def get_pulls (owner,project)
|
|
103
|
+
info = Net::HTTP.get (URI("#{@@project_url}/#{@owner}/#{@project}/pulls"))
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def get_pulls_number (owner,project,number)
|
|
109
|
+
info = Net::HTTP.get (URI("#{@@project_url}/#{@owner}/#{@project}/pulls/#{number}"))
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def get_pulls_number_comments (owner,project,number)
|
|
115
|
+
# Useless for now
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def post_pulls_number_comments (owner,project,number)
|
|
119
|
+
# Useless for now
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def get_raw_treeish (owner,project,treeish)
|
|
123
|
+
# Useless for now
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def get_show_treeish (owner,project,treeish)
|
|
127
|
+
# Useless for now
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Tickets Control, Useless for now
|
|
131
|
+
|
|
132
|
+
# Webhooks Control, Useless for now
|
|
133
|
+
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# GitCafe Api Class:User
|
|
137
|
+
class User
|
|
138
|
+
|
|
139
|
+
public
|
|
140
|
+
|
|
141
|
+
@@user_url = "#{$basic_url}/user"
|
|
142
|
+
|
|
143
|
+
protected
|
|
144
|
+
|
|
145
|
+
def get_user
|
|
146
|
+
info = Net::HTTP.get (URI("#{@@user_url}"))
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def get_folllowers
|
|
152
|
+
info = Net::HTTP.get (URI("#{@@user_url}/followers"))
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def get_followings
|
|
158
|
+
info = Net::HTTP.get (URI("#{@@user_url}/followings"))
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def get_orgs
|
|
164
|
+
info = Net::HTTP.get (URI("#{@@user_url}/orgs"))
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def get_projects
|
|
170
|
+
info = Net::HTTP.get (URI("#{@@user_url}/projects"))
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def get_pulls
|
|
176
|
+
info = Net::HTTP.get (URI("#{@@user_url}/pulls"))
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def get_tickets
|
|
182
|
+
info = Net::HTTP.get (URI("#{@@user_url}/tickets"))
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
def get_watching_projects
|
|
188
|
+
info = Net::HTTP.get (URI("#{@@user_url}/watching_projects"))
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# GitCafe Api Class:Users
|
|
196
|
+
class Users
|
|
197
|
+
|
|
198
|
+
public
|
|
199
|
+
|
|
200
|
+
@@users_url = "#{$basic_url}/users"
|
|
201
|
+
|
|
202
|
+
protected
|
|
203
|
+
|
|
204
|
+
def get_username (username)
|
|
205
|
+
info = Net::HTTP.get (URI("#{@@users_url}/#{@username}"))
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
def get_followers (username)
|
|
211
|
+
info = Net::HTTP.get (URI("#{@@users_url}/#{@username}/followers"))
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def get_followings (username)
|
|
217
|
+
info = Net::HTTP.get (URI("#{@@users_url}/#{@username}/followings"))
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
def get_orgs (username)
|
|
223
|
+
info = Net::HTTP.get (URI("#{@@users_url}/#{@username}/orgs"))
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
def get_projects (username)
|
|
229
|
+
info = Net::HTTP.get (URI("#{@@users_url}/#{username}/projects"))
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
def get_watching_projects (username)
|
|
235
|
+
info = Net::HTTP.get (URI("#{@@users_url}/#{username}/watching_projects"))
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: gitcafeapi
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Tex Wang
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-08-11 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.10'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.10'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
description: This is a Gem for calling GitCafe's API, It helps you to use the APIs
|
|
42
|
+
easier. And if you get confused with it, email me and I'll help you out.
|
|
43
|
+
email:
|
|
44
|
+
- 990210wyx@gmail.com
|
|
45
|
+
executables: []
|
|
46
|
+
extensions: []
|
|
47
|
+
extra_rdoc_files: []
|
|
48
|
+
files:
|
|
49
|
+
- ".gitignore"
|
|
50
|
+
- Gemfile
|
|
51
|
+
- README.md
|
|
52
|
+
- Rakefile
|
|
53
|
+
- bin/console
|
|
54
|
+
- bin/setup
|
|
55
|
+
- gitcafeapi-0.1.0.gem
|
|
56
|
+
- gitcafeapi.gemspec
|
|
57
|
+
- lib/gitcafeapi.rb
|
|
58
|
+
- lib/gitcafeapi/version.rb
|
|
59
|
+
homepage: http://null.nil
|
|
60
|
+
licenses:
|
|
61
|
+
- MIT
|
|
62
|
+
metadata: {}
|
|
63
|
+
post_install_message:
|
|
64
|
+
rdoc_options: []
|
|
65
|
+
require_paths:
|
|
66
|
+
- lib
|
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
|
+
requirements:
|
|
69
|
+
- - ">="
|
|
70
|
+
- !ruby/object:Gem::Version
|
|
71
|
+
version: '0'
|
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
|
+
requirements:
|
|
74
|
+
- - ">="
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: '0'
|
|
77
|
+
requirements: []
|
|
78
|
+
rubyforge_project:
|
|
79
|
+
rubygems_version: 2.4.8
|
|
80
|
+
signing_key:
|
|
81
|
+
specification_version: 4
|
|
82
|
+
summary: GitCafe Api Gem
|
|
83
|
+
test_files: []
|