github_client 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,16 @@
1
+ require "github_client/version"
2
+ require "api_client_base"
3
+ require "github_client/client"
4
+ require "github_client/requests/get_user_repositories_request"
5
+ require "github_client/requests/get_org_repositories_request"
6
+ require "github_client/responses/get_user_repositories_response"
7
+ require "github_client/responses/get_org_repositories_response"
8
+
9
+ module GithubClient
10
+ include APIClientBase::Base.module
11
+
12
+ with_configuration do
13
+ has :host, classes: String
14
+ has :access_token, classes: String
15
+ end
16
+ end
@@ -0,0 +1,22 @@
1
+ module GithubClient
2
+ class Client
3
+
4
+ include APIClientBase::Client.module(default_opts: :default_opts)
5
+
6
+ attribute :host, String
7
+ attribute :access_token, String
8
+
9
+ api_action :get_user_repositories
10
+ api_action :get_org_repositories
11
+
12
+ private
13
+
14
+ def default_opts
15
+ {
16
+ host: host,
17
+ access_token: access_token,
18
+ }
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,26 @@
1
+ module GithubClient
2
+ class GetOrgRepositoriesRequest
3
+
4
+ include APIClientBase::Request.module
5
+
6
+ attribute :access_token, String
7
+ attribute :org, String
8
+
9
+ private
10
+
11
+ def path
12
+ "/orgs/#{org}/repos"
13
+ end
14
+
15
+ def headers
16
+ {
17
+ "Authorization" => "token #{access_token}"
18
+ }
19
+ end
20
+
21
+ def default_action
22
+ :get
23
+ end
24
+
25
+ end
26
+ end
@@ -0,0 +1,30 @@
1
+ module GithubClient
2
+ class GetUserRepositoriesRequest
3
+
4
+ include APIClientBase::Request.module
5
+
6
+ attribute :access_token, String
7
+ attribute :visibility, String, default: "all"
8
+
9
+ private
10
+
11
+ def path
12
+ "/user/repos"
13
+ end
14
+
15
+ def headers
16
+ {
17
+ "Authorization" => "token #{access_token}"
18
+ }
19
+ end
20
+
21
+ def params
22
+ { visibility: visibility }
23
+ end
24
+
25
+ def default_action
26
+ :get
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,15 @@
1
+ module GithubClient
2
+ class GetOrgRepositoriesResponse
3
+
4
+ include APIClientBase::Response.module
5
+
6
+ attribute :body, Array, lazy: true, default: :default_body
7
+
8
+ private
9
+
10
+ def default_body
11
+ JSON.parse(raw_response.body)
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module GithubClient
2
+ class GetUserRepositoriesResponse
3
+
4
+ include APIClientBase::Response.module
5
+
6
+ attribute :body, Array, lazy: true, default: :default_body
7
+
8
+ private
9
+
10
+ def default_body
11
+ JSON.parse(raw_response.body)
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module GithubClient
2
+ VERSION = "1.0.0"
3
+ end
metadata ADDED
@@ -0,0 +1,183 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: github_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Mark Chavez
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-02-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: api_client_base
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: typhoeus
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: activesupport
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: vcr
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: webmock
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.3'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2.3'
125
+ description: Ruby wrapper for GitHub API
126
+ email:
127
+ - mjfchavez@gmail.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".gitignore"
133
+ - ".rspec"
134
+ - ".travis.yml"
135
+ - CHANGELOG.md
136
+ - CODE_OF_CONDUCT.md
137
+ - Gemfile
138
+ - Gemfile.lock
139
+ - LICENSE.txt
140
+ - README.md
141
+ - Rakefile
142
+ - bin/console
143
+ - bin/setup
144
+ - fixtures/vcr_cassettes/_get_org_repositories/_body/returns_all_org_repositories.yml
145
+ - fixtures/vcr_cassettes/_get_user_repositories/_body/with_visibility_argument/gets_repositories_based_on_visibility.yml
146
+ - fixtures/vcr_cassettes/_get_user_repositories/_body/without_any_arguments/gets_all_repositories.yml
147
+ - github_client.gemspec
148
+ - lib/github_client.rb
149
+ - lib/github_client/client.rb
150
+ - lib/github_client/requests/get_org_repositories_request.rb
151
+ - lib/github_client/requests/get_user_repositories_request.rb
152
+ - lib/github_client/responses/get_org_repositories_response.rb
153
+ - lib/github_client/responses/get_user_repositories_response.rb
154
+ - lib/github_client/version.rb
155
+ homepage: https://github.com/MarkFChavez/github_client-ruby
156
+ licenses:
157
+ - MIT
158
+ metadata:
159
+ allowed_push_host: https://rubygems.org
160
+ homepage_uri: https://github.com/MarkFChavez/github_client-ruby
161
+ source_code_uri: https://github.com/MarkFChavez/github_client-ruby
162
+ changelog_uri: https://github.com/MarkFChavez/github_client-ruby/blob/master/CHANGELOG.md
163
+ post_install_message:
164
+ rdoc_options: []
165
+ require_paths:
166
+ - lib
167
+ required_ruby_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ required_rubygems_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ requirements: []
178
+ rubyforge_project:
179
+ rubygems_version: 2.7.3
180
+ signing_key:
181
+ specification_version: 4
182
+ summary: Ruby wrapper for GitHub API
183
+ test_files: []