github_client 1.2.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7e4684bdc111aa960d5ece5b6a8398e4a24968869db266bb1270a91839159dc
4
- data.tar.gz: 22e07b70c8faa0023dc2966891cdbab5522902711f732336d7523c7ead9dffab
3
+ metadata.gz: e8b59b107f99872a6f136b4b43808250fd315f6aa0bcbdcd5b63572c32b47f94
4
+ data.tar.gz: 223ae2d78a2855a6918bb28964b5e8443746f24d212d7cdec90cafc72f9b9439
5
5
  SHA512:
6
- metadata.gz: 7ab46e2782ea0b88e79321e060797e1601589036b6ce7b7a56593886602371ab611fbf0205bbacf01a41d67e0fe63a73f0f0ee5d7f0f40fe1b047c23515c7739
7
- data.tar.gz: 50cbe102f3972e1d726c7ebf7d24b677aca8ec21cb5cf9cb7c2244907c65ab0b5ba081f762c50c7df858b43cc49ef955f65930b6caa1f83f50e04dd3748c93d1
6
+ metadata.gz: 7feb24bacc61b5b9b1560a3694360e57d31cd5fa5660e3b93a64c92c278e44ffab626f361dfa0c9e939b3db59d60c20c5b96dbd95f15681fc73b3fc53766d984
7
+ data.tar.gz: 355fa556d9c5d11d365d2048dc8b2bce98f4777e6987287f4f869a8f3dbd06d2f42998a3eeb8f57319656e20154e0a0b390f093ffeecf9b58d4bb9760f22208d
data/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## [2.0.0] - 2019-02-09
8
+ ### Added
9
+ - `#get_repositories_for_user` method that returns the public repositories --
10
+ given a GitHub username.
11
+ - [breaking] Rename method from `#get_user_repositories` to `#get_repositories`.
12
+
7
13
  ## [1.2.0] - 2019-02-03
8
14
  ### Added
9
15
  - Require `uri` and `json` libraries.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- github_client (1.1.0)
4
+ github_client (1.2.0)
5
5
  api_client_base
6
6
  typhoeus
7
7
 
data/README.md CHANGED
@@ -18,8 +18,6 @@ Or install it yourself as:
18
18
 
19
19
  $ gem install github_client
20
20
 
21
- ## Usage
22
-
23
21
  ### Initialize the Client
24
22
 
25
23
  ```ruby
@@ -38,7 +36,7 @@ GithubClient.configure do |config|
38
36
  end
39
37
  ```
40
38
 
41
- ### Fetch your repositories
39
+ ## Usage
42
40
 
43
41
  See `spec/acceptance` for usage.
44
42
 
@@ -50,7 +48,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
50
48
 
51
49
  ## Contributing
52
50
 
53
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/github_client-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
51
+ Bug reports and pull requests are welcome on GitHub at https://github.com/MarkFChavez/github_client-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
54
52
 
55
53
  ## License
56
54
 
@@ -6,7 +6,8 @@ module GithubClient
6
6
  attribute :host, String
7
7
  attribute :access_token, String
8
8
 
9
- api_action :get_user_repositories
9
+ api_action :get_repositories
10
+ api_action :get_repositories_for_user
10
11
  api_action :get_org_repositories
11
12
 
12
13
  private
@@ -2,7 +2,6 @@ module GithubClient
2
2
  class GetOrgRepositoriesRequest
3
3
 
4
4
  include APIClientBase::Request.module
5
-
6
5
  attribute :access_token, String
7
6
  attribute :org, String
8
7
 
@@ -0,0 +1,25 @@
1
+ module GithubClient
2
+ class GetRepositoriesForUserRequest
3
+
4
+ include APIClientBase::Request.module
5
+ attribute :access_token, String
6
+ attribute :username, String
7
+
8
+ private
9
+
10
+ def path
11
+ "/users/#{username}/repos"
12
+ end
13
+
14
+ def headers
15
+ {
16
+ "Authorization" => "token #{access_token}"
17
+ }
18
+ end
19
+
20
+ def default_action
21
+ :get
22
+ end
23
+
24
+ end
25
+ end
@@ -1,8 +1,7 @@
1
1
  module GithubClient
2
- class GetUserRepositoriesRequest
2
+ class GetRepositoriesRequest
3
3
 
4
4
  include APIClientBase::Request.module
5
-
6
5
  attribute :access_token, String
7
6
  attribute :visibility, String, default: "all"
8
7
 
@@ -2,7 +2,6 @@ module GithubClient
2
2
  class GetOrgRepositoriesResponse
3
3
 
4
4
  include APIClientBase::Response.module
5
-
6
5
  attribute :body, Array, lazy: true, default: :default_body
7
6
 
8
7
  private
@@ -0,0 +1,14 @@
1
+ module GithubClient
2
+ class GetRepositoriesForUserResponse
3
+
4
+ include APIClientBase::Response.module
5
+ attribute :body, Array, lazy: true, default: :default_body
6
+
7
+ private
8
+
9
+ def default_body
10
+ JSON.parse(raw_response.body).map(&:with_indifferent_access)
11
+ end
12
+
13
+ end
14
+ end
@@ -1,8 +1,7 @@
1
1
  module GithubClient
2
- class GetUserRepositoriesResponse
2
+ class GetRepositoriesResponse
3
3
 
4
4
  include APIClientBase::Response.module
5
-
6
5
  attribute :body, Array, lazy: true, default: :default_body
7
6
 
8
7
  private
@@ -1,3 +1,3 @@
1
1
  module GithubClient
2
- VERSION = "1.2.0"
2
+ VERSION = "2.0.0"
3
3
  end
data/lib/github_client.rb CHANGED
@@ -13,7 +13,9 @@ module GithubClient
13
13
  end
14
14
 
15
15
  require "github_client/client"
16
- require "github_client/requests/get_user_repositories_request"
16
+ require "github_client/requests/get_repositories_request"
17
+ require "github_client/requests/get_repositories_for_user_request"
17
18
  require "github_client/requests/get_org_repositories_request"
18
- require "github_client/responses/get_user_repositories_response"
19
+ require "github_client/responses/get_repositories_response"
20
+ require "github_client/responses/get_repositories_for_user_response"
19
21
  require "github_client/responses/get_org_repositories_response"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Chavez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-03 00:00:00.000000000 Z
11
+ date: 2019-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: api_client_base
@@ -141,16 +141,15 @@ files:
141
141
  - Rakefile
142
142
  - bin/console
143
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
144
  - github_client.gemspec
148
145
  - lib/github_client.rb
149
146
  - lib/github_client/client.rb
150
147
  - lib/github_client/requests/get_org_repositories_request.rb
151
- - lib/github_client/requests/get_user_repositories_request.rb
148
+ - lib/github_client/requests/get_repositories_for_user_request.rb
149
+ - lib/github_client/requests/get_repositories_request.rb
152
150
  - lib/github_client/responses/get_org_repositories_response.rb
153
- - lib/github_client/responses/get_user_repositories_response.rb
151
+ - lib/github_client/responses/get_repositories_for_user_response.rb
152
+ - lib/github_client/responses/get_repositories_response.rb
154
153
  - lib/github_client/version.rb
155
154
  homepage: https://github.com/MarkFChavez/github_client-ruby
156
155
  licenses: