github_api 0.16.0 → 0.17.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
  SHA1:
3
- metadata.gz: 26afc4d14a19b64a2afdb606f617a8adb4feca39
4
- data.tar.gz: d8dc7404e573e3795fc614f419161b5a741fca79
3
+ metadata.gz: 78e5b988d1308a8fb225d36cab72b3fdb9643fe3
4
+ data.tar.gz: a66c54c119e6e9bf4c12dda1de545a5a1cdba5a7
5
5
  SHA512:
6
- metadata.gz: e9aee22020a61cb8f71d7ef5906d30a06781e94106ccdc609fc6587114b051f3cbab67d70c3d9ed0bc9b2a7a4d02b63755833aa63305f468f6a081a4378e2b7d
7
- data.tar.gz: ae1f3c5346bb2f6c231c5a2e950ee5ed966c1a3cff3d9f2ab8d4401a27e746cbc701a0149b8f681d1dca040d905d4db789b3f9610ddb8b33ecde5715f89d7113
6
+ metadata.gz: 972cd5cb9b8c5eac8a3697a00a2bc578abc0758694bd9028631f7bbd81a416b4be9816ac2c9f168a5b414f6b9b05424725ef87184a47e8ab26895ba71088e31d
7
+ data.tar.gz: e1987a1183df4060db459a10771eb2a00bc669499edb315fcc862e98ffb4414eba385a53cf04b8299a0b6e3f3a313d002c261109b2f917606b7e2243855c84ba
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  <a href="http://piotrmurach.github.io/github/"><img width="136" src="https://github.com/piotrmurach/github/raw/master/icons/github_api.png" alt="github api logo" /></a>
3
3
  </div>
4
4
 
5
- # GithubAPI
5
+ # GithubAPI [![Gitter](https://badges.gitter.im/Join%20Chat.svg)][gitter]
6
6
 
7
7
  [![Gem Version](https://badge.fury.io/rb/github_api.svg)][gem]
8
8
  [![Build Status](https://secure.travis-ci.org/piotrmurach/github.svg?branch=master)][travis]
@@ -11,6 +11,7 @@
11
11
  [![Inline docs](http://inch-ci.org/github/piotrmurach/github.svg)][inchpages]
12
12
  [![Dependency Status](https://gemnasium.com/piotrmurach/github.svg?travis)][gemnasium]
13
13
 
14
+ [gitter]: https://gitter.im/piotrmurach/github_api
14
15
  [gem]: http://badge.fury.io/rb/github_api
15
16
  [travis]: http://travis-ci.org/piotrmurach/github
16
17
  [codeclimate]: https://codeclimate.com/github/piotrmurach/github
@@ -705,9 +706,27 @@ github.delete 'username', 'tome-of-knowledge', 'full_path_to/file.ext',
705
706
 
706
707
  The test suite is split into two groups, `live` and `mock`.
707
708
 
708
- The `live` tests are the ones in `features` folder and they simply exercise the GitHub API by making live requests and then being cached with VCR in directory named `features\cassettes`. For details on how to get set up, please navigate to the `features` folder.
709
+ The `live` tests are in the `features` folder and exercise the GitHub API directly by making live requests and then caching responses with VCR in directory named `features\cassettes`. For details on how to get set up, please navigate to the `features` folder.
709
710
 
710
- The `mock` tests are in the `spec` directory and their primary concern is to test the gem internals without the hindrance of external calls.
711
+ To run all feature tests do:
712
+
713
+ ```ruby
714
+ bundle exec rake features
715
+ ```
716
+
717
+ The `mock` tests are in the `spec` folder and their primary concern is to test the gem internals without the hindrance of external calls.
718
+
719
+ To run all specs do:
720
+
721
+ ```ruby
722
+ bundle exec rake spec
723
+ ```
724
+
725
+ Finally to run all tests do:
726
+
727
+ ```ruby
728
+ bundle exec rake
729
+ ```
711
730
 
712
731
  ## Development
713
732
 
@@ -13,6 +13,7 @@ module Github
13
13
  'markdown',
14
14
  'meta',
15
15
  'orgs',
16
+ 'projects',
16
17
  'pull_requests',
17
18
  'repos',
18
19
  'say',
@@ -52,6 +53,8 @@ module Github
52
53
  namespace :orgs
53
54
  alias :organizations :orgs
54
55
 
56
+ namespace :projects
57
+
55
58
  namespace :pull_requests
56
59
  alias :pulls :pull_requests
57
60
 
@@ -8,6 +8,7 @@ module Github
8
8
  'hooks',
9
9
  'members',
10
10
  'memberships',
11
+ 'projects',
11
12
  'teams'
12
13
 
13
14
  # Access to Client::Orgs::Hooks API
@@ -19,6 +20,9 @@ module Github
19
20
  # Access to Client::Orgs::Memberships API
20
21
  namespace :memberships
21
22
 
23
+ # Access to Client::Orgs::Projects API
24
+ namespace :projects
25
+
22
26
  # Access to Client::Orgs::Teams API
23
27
  namespace :teams
24
28
 
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Github
4
+ class Client::Orgs::Projects < API
5
+ PREVIEW_MEDIA = "application/vnd.github.inertia-preview+json".freeze # :nodoc:
6
+
7
+ # List your organization projects
8
+ #
9
+ # @see List your organization projects
10
+ #
11
+ # @example
12
+ # github = Github.new 'org-name'
13
+ # github.orgs.projects.list 'org-name' { |project| ... }
14
+ #
15
+ # @example
16
+ # github = Github.new
17
+ # github.orgs.projects.list 'org-name', state: 'closed'
18
+ #
19
+ # @api public
20
+ def list(*args)
21
+ arguments(args, required: [:org_name])
22
+ params = arguments.params
23
+
24
+ params["accept"] ||= PREVIEW_MEDIA
25
+
26
+ response = get_request("/orgs/#{arguments.org_name}/projects", params)
27
+ return response unless block_given?
28
+ response.each { |el| yield el }
29
+ end
30
+ alias_method :all, :list
31
+
32
+ # Create a new project for the specified repo
33
+ #
34
+ # @param [Hash] params
35
+ # @option params [String] :name
36
+ # Required string - The name of the project.
37
+ # @option params [String] :body
38
+ # Optional string - The body of the project.
39
+ #
40
+ # @example
41
+ # github = Github.new
42
+ # github.repos.create 'owner-name', 'repo-name', name: 'project-name'
43
+ # github.repos.create name: 'project-name', body: 'project-body', owner: 'owner-name', repo: 'repo-name'
44
+ def create(*args)
45
+ arguments(args, required: [:org_name]) do
46
+ assert_required %w[ name ]
47
+ end
48
+ params = arguments.params
49
+
50
+ params["accept"] ||= PREVIEW_MEDIA
51
+
52
+ post_request("/orgs/#{arguments.org_name}/projects", params)
53
+ end
54
+ end # Projects
55
+ end # Github
@@ -0,0 +1,81 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ module Github
5
+ # Projects API
6
+ class Client::Projects < API
7
+ PREVIEW_MEDIA = "application/vnd.github.inertia-preview+json" # :nodoc:
8
+
9
+ require_all 'github_api/client/projects',
10
+ 'columns',
11
+ 'cards'
12
+
13
+ # Access to Projects::Columns API
14
+ namespace :columns
15
+
16
+ # Access to Projects::Cards API
17
+ namespace :cards
18
+
19
+ # Get properties for a single project
20
+ #
21
+ # @see https://developer.github.com/v3/projects/#get-a-project
22
+ #
23
+ # @example
24
+ # github = Github.new
25
+ # github.projects.get 1002604
26
+ #
27
+ # @api public
28
+ def get(*args)
29
+ arguments(args, required: [:id])
30
+ params = arguments.params
31
+
32
+ params["accept"] ||= PREVIEW_MEDIA
33
+
34
+ get_request("/projects/#{arguments.id}", params)
35
+ end
36
+ alias find get
37
+
38
+ # Edit a project
39
+ #
40
+ # @param [Hash] params
41
+ # @option params [String] :name
42
+ # Optional string
43
+ # @option params [String] :body
44
+ # Optional string
45
+ # @option params [String] :state
46
+ # Optional string
47
+ #
48
+ # @example
49
+ # github = Github.new
50
+ # github.projects.edit 1002604,
51
+ # name: "Outcomes Tracker",
52
+ # body: "The board to track work for the Outcomes application."
53
+ #
54
+ # @api public
55
+ def edit(*args)
56
+ arguments(args, required: [:id])
57
+ params = arguments.params
58
+
59
+ params["accept"] ||= PREVIEW_MEDIA
60
+
61
+ patch_request("/projects/#{arguments.id}", params)
62
+ end
63
+
64
+ # Delete a project
65
+ #
66
+ # @example
67
+ # github = Github.new
68
+ # github.projects.delete 1002604
69
+ #
70
+ # @api public
71
+ def delete(*args)
72
+ arguments(args, required: [:id])
73
+ params = arguments.params
74
+
75
+ params["accept"] ||= PREVIEW_MEDIA
76
+
77
+ delete_request("/projects/#{arguments.id}", arguments.params)
78
+ end
79
+ alias remove delete
80
+ end # Projects
81
+ end # Github
@@ -0,0 +1,156 @@
1
+ # frozen_string_literal: true
2
+ # encoding: utf-8
3
+
4
+ module Github
5
+ class Client::Projects::Cards < API
6
+ REQUIRED_MOVE_CARD_PARAMS = %w(position).freeze
7
+
8
+ # List project cards for a column
9
+ #
10
+ # @example
11
+ # github = Github.new
12
+ # github.projects.cards.list :column_id
13
+ #
14
+ # @see https://developer.github.com/v3/projects/cards/#list-project-cards
15
+ #
16
+ # @api public
17
+ def list(*args)
18
+ arguments(args, required: [:column_id])
19
+ params = arguments.params
20
+
21
+ params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
22
+
23
+ response = get_request("/projects/columns/#{arguments.column_id}/cards", params)
24
+
25
+ return response unless block_given?
26
+ response.each { |el| yield el }
27
+ end
28
+ alias all list
29
+
30
+ # Get a project card
31
+ #
32
+ # @example
33
+ # github = Github.new
34
+ # github.projects.cards.get :card_id
35
+ #
36
+ # @see https://developer.github.com/v3/projects/cards/#get-a-project-card
37
+ #
38
+ # @api public
39
+ def get(*args)
40
+ arguments(args, required: [:card_id])
41
+ params = arguments.params
42
+
43
+ params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
44
+
45
+ get_request("/projects/columns/cards/#{arguments.card_id}", params)
46
+ end
47
+ alias find get
48
+
49
+ # Create a project card for a column
50
+ #
51
+ # @param [Hash] params
52
+ # @option params [String] :note
53
+ # The card's note content. Only valid for cards without another type of
54
+ # content, so this must be omitted if content_id and content_type are
55
+ # specified.
56
+ # @option params [Integer] :content_id
57
+ # The id of the Issue to associate with this card.
58
+ # @option params [String] :content_type
59
+ # The type of content to associate with this card. Can only be "Issue" at
60
+ # this time.
61
+ #
62
+ # @example
63
+ # github = Github.new
64
+ # github.projects.cards.create :column_id, note: 'Card Note'
65
+ #
66
+ # @example
67
+ # github = Github.new
68
+ # github.projects.cards.create :column_id, id: <content-id>, content_type: 'content-type'
69
+ #
70
+ # @see https://developer.github.com/v3/projects/cards/#create-a-project-card
71
+ #
72
+ # @api public
73
+ def create(*args)
74
+ arguments(args, required: [:column_id])
75
+ params = arguments.params
76
+
77
+ params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
78
+
79
+ post_request("/projects/columns/#{arguments.column_id}/cards", params)
80
+ end
81
+
82
+ # Update a project card
83
+ #
84
+ # @param [Hash] params
85
+ # @option params [String] :note
86
+ # The card's note content. Only valid for cards without another type of
87
+ # content, so this cannot be specified if the card already has a
88
+ # content_id and content_type.
89
+ #
90
+ # @example
91
+ # github = Github.new
92
+ # github.projects.cards.update :card_id, note: 'New card note'
93
+ #
94
+ # @see https://developer.github.com/v3/projects/cards/#update-a-project-card
95
+ #
96
+ # @api public
97
+ def update(*args)
98
+ arguments(args, required: [:card_id])
99
+ params = arguments.params
100
+
101
+ params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
102
+
103
+ patch_request("/projects/columns/cards/#{arguments.card_id}", params)
104
+ end
105
+ alias edit update
106
+
107
+ # Delete a project card
108
+ #
109
+ # @example
110
+ # github = Github.new
111
+ # github.projects.cards.delete :card_id
112
+ #
113
+ # @see https://developer.github.com/v3/projects/cards/#delete-a-project-card
114
+ #
115
+ # @api public
116
+ def delete(*args)
117
+ arguments(args, required: [:card_id])
118
+ params = arguments.params
119
+
120
+ params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
121
+
122
+ delete_request("/projects/columns/cards/#{arguments.card_id}", params)
123
+ end
124
+ alias remove delete
125
+
126
+ # Move a project card
127
+ #
128
+ # @param [Hash] params
129
+ # @option params [String] :position
130
+ # Required. Required. Can be one of 'first', 'last', or
131
+ # 'after:<column-id>', where <column-id> is the id value of a column in
132
+ # the same project.
133
+ #
134
+ # @example
135
+ # github = Github.new
136
+ # github.projects.cards.move :card_id, position: 'bottom'
137
+ #
138
+ # @example
139
+ # github = Github.new
140
+ # github.projects.cards.move :card_id, position: 'after:<card-id>', column_id: <column-id>
141
+ #
142
+ # @see https://developer.github.com/v3/projects/cards/#move-a-project-card
143
+ #
144
+ # @api public
145
+ def move(*args)
146
+ arguments(args, required: [:card_id]) do
147
+ assert_required REQUIRED_MOVE_CARD_PARAMS
148
+ end
149
+ params = arguments.params
150
+
151
+ params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
152
+
153
+ post_request("/projects/columns/cards/#{arguments.card_id}/moves", params)
154
+ end
155
+ end
156
+ end
@@ -0,0 +1,144 @@
1
+ # frozen_string_literal: true
2
+ # encoding: utf-8
3
+
4
+ module Github
5
+ class Client::Projects::Columns < API
6
+ REQUIRED_COLUMN_PARAMS = %w(name).freeze
7
+ REQUIRED_MOVE_COLUMN_PARAMS = %w(position).freeze
8
+
9
+ # List a project's columns
10
+ #
11
+ # @example
12
+ # github = Github.new
13
+ # github.projects.columns.list :project_id
14
+ #
15
+ # @see https://developer.github.com/v3/projects/columns/#list-project-columns
16
+ #
17
+ # @api public
18
+ def list(*args)
19
+ arguments(args, required: [:project_id])
20
+ params = arguments.params
21
+
22
+ params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
23
+
24
+ response = get_request("/projects/#{arguments.project_id}/columns", params)
25
+
26
+ return response unless block_given?
27
+ response.each { |el| yield el }
28
+ end
29
+ alias all list
30
+
31
+ # Get a project columns
32
+ #
33
+ # @example
34
+ # github = Github.new
35
+ # github.projects.columns.get :column_id
36
+ #
37
+ # @see https://developer.github.com/v3/projects/columns/#get-a-project-column
38
+ #
39
+ # @api public
40
+ def get(*args)
41
+ arguments(args, required: [:column_id])
42
+ params = arguments.params
43
+
44
+ params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
45
+
46
+ get_request("/projects/columns/#{arguments.column_id}", params)
47
+ end
48
+ alias find get
49
+
50
+ # Create a project column
51
+ #
52
+ # @param [Hash] params
53
+ # @option params [String] :name
54
+ # Required. The name of the column.
55
+ #
56
+ # @example
57
+ # github = Github.new
58
+ # github.projects.columns.create :project_id, name: 'column-name'
59
+ #
60
+ # @see https://developer.github.com/v3/projects/columns/#create-a-project-column
61
+ #
62
+ # @api public
63
+ def create(*args)
64
+ arguments(args, required: [:project_id]) do
65
+ assert_required REQUIRED_COLUMN_PARAMS
66
+ end
67
+ params = arguments.params
68
+
69
+ params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
70
+
71
+ post_request("/projects/#{arguments.project_id}/columns", params)
72
+ end
73
+
74
+ # Update a project column
75
+ #
76
+ # @param [Hash] params
77
+ # @option params [String] :name
78
+ # Required. The name of the column.
79
+ #
80
+ # @example
81
+ # github = Github.new
82
+ # github.repos.projects.update :column_id, name: 'new-column-name'
83
+ #
84
+ # @see https://developer.github.com/v3/projects/columns/#update-a-project-column
85
+ #
86
+ # @api public
87
+ def update(*args)
88
+ arguments(args, required: [:column_id]) do
89
+ assert_required REQUIRED_COLUMN_PARAMS
90
+ end
91
+ params = arguments.params
92
+
93
+ params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
94
+
95
+ patch_request("/projects/columns/#{arguments.column_id}", params)
96
+ end
97
+ alias edit update
98
+
99
+ # Delete a project column
100
+ #
101
+ # @example
102
+ # github = Github.new
103
+ # github.projects.columns.delete :column_id
104
+ #
105
+ # @see https://developer.github.com/v3/projects/columns/#delete-a-project-column
106
+ #
107
+ # @api public
108
+ def delete(*args)
109
+ arguments(args, required: [:column_id])
110
+ params = arguments.params
111
+
112
+ params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
113
+
114
+ delete_request("/projects/columns/#{arguments.column_id}", params)
115
+ end
116
+ alias remove delete
117
+
118
+ # Move a project column
119
+ #
120
+ # @param [Hash] params
121
+ # @option params [String] :position
122
+ # Required. Required. Can be one of 'first', 'last', or
123
+ # 'after:<column-id>', where <column-id> is the id value of a column in
124
+ # the same project.
125
+ #
126
+ # @example
127
+ # github = Github.new
128
+ # github.projects.columns.move :column_id, position: 'first'
129
+ #
130
+ # @see https://developer.github.com/v3/projects/columns/#move-a-project-column
131
+ #
132
+ # @api public
133
+ def move(*args)
134
+ arguments(args, required: [:column_id]) do
135
+ assert_required REQUIRED_MOVE_COLUMN_PARAMS
136
+ end
137
+ params = arguments.params
138
+
139
+ params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA
140
+
141
+ post_request("/projects/columns/#{arguments.column_id}/moves", params)
142
+ end
143
+ end
144
+ end
@@ -15,6 +15,7 @@ module Github
15
15
  'keys',
16
16
  'merging',
17
17
  'pages',
18
+ 'projects',
18
19
  'pub_sub_hubbub',
19
20
  'releases',
20
21
  'statistics',
@@ -71,6 +72,9 @@ module Github
71
72
  # Access to Repos::Pages API
72
73
  namespace :pages
73
74
 
75
+ # Access to Repos::Projects API
76
+ namespace :projects
77
+
74
78
  # Access to Repos::PubSubHubbub API
75
79
  namespace :pubsubhubbub, full_name: :pub_sub_hubbub
76
80
 
@@ -229,7 +233,6 @@ module Github
229
233
  # @example
230
234
  def create(*args)
231
235
  arguments(args) do
232
- permit VALID_REPO_OPTIONS + %w[ org ]
233
236
  assert_required %w[ name ]
234
237
  end
235
238
  params = arguments.params
@@ -81,7 +81,6 @@ module Github
81
81
  # @api public
82
82
  def create(*args)
83
83
  arguments(args, required: [:user, :repo, :sha]) do
84
- permit VALID_COMMENT_OPTIONS
85
84
  assert_required REQUIRED_COMMENT_OPTIONS
86
85
  end
87
86
 
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Github
4
+ class Client::Repos::Projects < API
5
+ PREVIEW_MEDIA = "application/vnd.github.inertia-preview+json".freeze # :nodoc:
6
+
7
+ # List a repo's projects
8
+ #
9
+ # @example
10
+ # github = Github.new
11
+ # github.repos.projects.list owner: 'owner-name', repo: 'repo-name'
12
+ #
13
+ # @example
14
+ # github = Github.new
15
+ # github.repos.projects.list state: 'open', owner: 'owner-name', repo: 'repo-name'
16
+ #
17
+ # @example
18
+ # github.repos.projects.list owner: 'owner-name', repo: 'repo-name' { |cbr| .. }
19
+ #
20
+ # @return [Array]
21
+ #
22
+ # @api public
23
+ def list(*args)
24
+ arguments(args, required: [:owner, :repo])
25
+ params = arguments.params
26
+
27
+ params["accept"] ||= PREVIEW_MEDIA
28
+
29
+ response = get_request("/repos/#{arguments.owner}/#{arguments.repo}/projects", params)
30
+ return response unless block_given?
31
+ response.each { |el| yield el }
32
+ end
33
+ alias :all :list
34
+
35
+ # Create a new project for the specified repo
36
+ #
37
+ # @param [Hash] params
38
+ # @option params [String] :name
39
+ # Required string - The name of the project.
40
+ # @option params [String] :body
41
+ # Optional string - The body of the project.
42
+ #
43
+ # @example
44
+ # github = Github.new
45
+ # github.repos.create 'owner-name', 'repo-name', name: 'project-name'
46
+ # github.repos.create name: 'project-name', body: 'project-body', owner: 'owner-name', repo: 'repo-name'
47
+ #
48
+ # @api public
49
+ def create(*args)
50
+ arguments(args, required: [:owner, :repo]) do
51
+ assert_required %w[ name ]
52
+ end
53
+ params = arguments.params
54
+
55
+ params["accept"] ||= PREVIEW_MEDIA
56
+
57
+ post_request("/repos/#{arguments.owner}/#{arguments.repo}/projects", params)
58
+ end
59
+ end # Projects
60
+ end # Github
@@ -2,10 +2,8 @@
2
2
 
3
3
  module Github
4
4
  class Client::Repos::PubSubHubbub < API
5
- OPTIONS = {
6
- :headers => {
7
- CONTENT_TYPE => 'application/x-www-form-urlencoded'
8
- }
5
+ HEADERS = {
6
+ CONTENT_TYPE => 'application/x-www-form-urlencoded'
9
7
  }
10
8
 
11
9
  # Subscribe to existing topic/event through pubsubhubbub
@@ -29,7 +27,7 @@ module Github
29
27
  def subscribe(*args)
30
28
  params = arguments(args, required: [:topic, :callback]).params
31
29
  _merge_action!("subscribe", arguments.topic, arguments.callback, params)
32
- params['options'] = OPTIONS
30
+ params['headers'] = HEADERS
33
31
 
34
32
  post_request("/hub", params)
35
33
  end
@@ -56,7 +54,7 @@ module Github
56
54
  def unsubscribe(*args)
57
55
  params = arguments(args, required: [:topic, :callback]).params
58
56
  _merge_action!("unsubscribe", arguments.topic, arguments.callback, params)
59
- params['options'] = OPTIONS
57
+ params['headers'] = HEADERS
60
58
 
61
59
  post_request("/hub", params)
62
60
  end
@@ -5,7 +5,7 @@ module Github
5
5
 
6
6
  # List a user's followers
7
7
  #
8
- # @xample
8
+ # @example
9
9
  # github = Github.new
10
10
  # github.users.followers.list 'user-name'
11
11
  # github.users.followers.list 'user-name' { |user| ... }
@@ -26,7 +26,7 @@ module Github #:nodoc
26
26
  super(
27
27
  generate_message(
28
28
  problem: "Invalid option #{invalid.keys.join(', ')} provided for this request.",
29
- summary: "Github gem checks the request parameters passed to ensure that github api is not hit unnecessairly and to fail fast.",
29
+ summary: "Github gem checks the request parameters passed to ensure that github api is not hit unnecessarily and to fail fast.",
30
30
  resolution: "Valid options are: #{valid.join(', ')}, make sure these are the ones you are using"
31
31
  )
32
32
  )
@@ -39,7 +39,7 @@ module Github #:nodoc
39
39
  super(
40
40
  generate_message(
41
41
  problem: "Missing required parameters: #{provided.keys.join(', ')} provided for this request.",
42
- summary: "Github gem checks the request parameters passed to ensure that github api is not hit unnecessairly and to fail fast.",
42
+ summary: "Github gem checks the request parameters passed to ensure that github api is not hit unnecessarily and to fail fast.",
43
43
  resolution: "Required parameters are: #{required.join(', ')}, make sure these are the ones you are using"
44
44
  )
45
45
  )
@@ -137,7 +137,12 @@ module Github
137
137
  elsif data[:errors]
138
138
  message = "\nErrors:\n"
139
139
  message << data[:errors].map do |error|
140
- "Error: #{error.map { |k, v| "#{k}: #{v}" }.join(', ')}"
140
+ case error
141
+ when Hash
142
+ "Error: #{error.map { |k, v| "#{k}: #{v}" }.join(', ')}"
143
+ else
144
+ "Error: #{error}"
145
+ end
141
146
  end.join("\n")
142
147
  end
143
148
  end
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
1
2
  # encoding: utf-8
2
3
 
3
4
  module Github
4
- # Deals with normalazing client supplied parameter keys.
5
+ # Normalize client-supplied parameter keys.
5
6
  module Normalizer
6
7
  # Turns any keys from nested hashes including nested arrays into strings
7
- #
8
8
  def normalize!(params)
9
9
  case params
10
10
  when Hash
@@ -16,10 +16,8 @@ module Github
16
16
  params.map! do |el|
17
17
  normalize!(el)
18
18
  end
19
- else
20
- params.to_s
21
19
  end
22
- return params
20
+ params
23
21
  end
24
22
  end # Normalizer
25
23
  end # Github
@@ -9,7 +9,7 @@ module Github
9
9
  include Normalizer
10
10
  include MimeType
11
11
 
12
- REQUEST_PARAMS = [:accept, :media, :data, :raw, :content_type, :headers]
12
+ REQUEST_PARAMS = [:accept, :media, :data, :raw, :headers]
13
13
 
14
14
  def initialize(hash)
15
15
  super(normalize!(Hash[hash]))
@@ -71,9 +71,6 @@ module Github
71
71
  if value = accept
72
72
  headers[:accept] = value
73
73
  end
74
- if self['content_type']
75
- headers[:content_type] = self['content_type']
76
- end
77
74
  opts[:raw] = key?('raw') ? self['raw'] : false
78
75
  opts[:headers] = headers unless headers.empty?
79
76
  opts
@@ -55,7 +55,7 @@ module Github
55
55
  raise ArgumentError, "unknown http method: #{method}"
56
56
  end
57
57
 
58
- puts "EXECUTED: #{action} - #{path} with PARAMS: #{params}" if ENV['DEBUG']
58
+ puts "EXECUTED: #{action} - #{path} with PARAMS: #{params.request_params}" if ENV['DEBUG']
59
59
 
60
60
  request_options = params.options
61
61
  connection_options = current_options.merge(request_options)
@@ -1,10 +1,10 @@
1
1
  require 'faraday'
2
2
  require 'set'
3
3
 
4
- # First saw on octokit, then copied from lostisland/faraday_middleware
4
+ # First saw on octokit, then copied from lostisland/faraday_middleware
5
5
  # and adapted for this library.
6
6
  #
7
- # faraday_middleware/lib/faraday_middleware/response/follow_redirects.rb
7
+ # faraday_middleware/lib/faraday_middleware/response/follow_redirects.rb
8
8
 
9
9
  module Github
10
10
  # Public: Exception thrown when the maximum amount of requests is exceeded.
@@ -35,7 +35,7 @@ module Github
35
35
  # faraday.use :cookie_jar
36
36
  # faraday.adapter Faraday.default_adapter
37
37
  # end
38
-
38
+
39
39
  class Response::FollowRedirects < Faraday::Middleware
40
40
  # HTTP methods for which 30x redirects can be followed
41
41
  ALLOWED_METHODS = Set.new [:head, :options, :get, :post, :put, :patch, :delete]
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Github
4
- VERSION = "0.16.0"
4
+ VERSION = "0.17.0"
5
5
  end # Github
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Murach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-02 00:00:00.000000000 Z
11
+ date: 2017-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -112,14 +112,20 @@ dependencies:
112
112
  requirements:
113
113
  - - ">="
114
114
  - !ruby/object:Gem::Version
115
- version: '0'
115
+ version: 1.5.0
116
+ - - "<"
117
+ - !ruby/object:Gem::Version
118
+ version: '2.0'
116
119
  type: :development
117
120
  prerelease: false
118
121
  version_requirements: !ruby/object:Gem::Requirement
119
122
  requirements:
120
123
  - - ">="
121
124
  - !ruby/object:Gem::Version
122
- version: '0'
125
+ version: 1.5.0
126
+ - - "<"
127
+ - !ruby/object:Gem::Version
128
+ version: '2.0'
123
129
  - !ruby/object:Gem::Dependency
124
130
  name: rake
125
131
  requirement: !ruby/object:Gem::Requirement
@@ -134,6 +140,62 @@ dependencies:
134
140
  - - "<"
135
141
  - !ruby/object:Gem::Version
136
142
  version: '11.0'
143
+ - !ruby/object:Gem::Dependency
144
+ name: cucumber
145
+ requirement: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - "~>"
148
+ - !ruby/object:Gem::Version
149
+ version: '2.1'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - "~>"
155
+ - !ruby/object:Gem::Version
156
+ version: '2.1'
157
+ - !ruby/object:Gem::Dependency
158
+ name: rspec
159
+ requirement: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - "~>"
162
+ - !ruby/object:Gem::Version
163
+ version: 2.14.1
164
+ type: :development
165
+ prerelease: false
166
+ version_requirements: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - "~>"
169
+ - !ruby/object:Gem::Version
170
+ version: 2.14.1
171
+ - !ruby/object:Gem::Dependency
172
+ name: vcr
173
+ requirement: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - "~>"
176
+ - !ruby/object:Gem::Version
177
+ version: 3.0.3
178
+ type: :development
179
+ prerelease: false
180
+ version_requirements: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - "~>"
183
+ - !ruby/object:Gem::Version
184
+ version: 3.0.3
185
+ - !ruby/object:Gem::Dependency
186
+ name: webmock
187
+ requirement: !ruby/object:Gem::Requirement
188
+ requirements:
189
+ - - "~>"
190
+ - !ruby/object:Gem::Version
191
+ version: 2.3.2
192
+ type: :development
193
+ prerelease: false
194
+ version_requirements: !ruby/object:Gem::Requirement
195
+ requirements:
196
+ - - "~>"
197
+ - !ruby/object:Gem::Version
198
+ version: 2.3.2
137
199
  description: " Ruby client that supports all of the GitHub API methods. It's build
138
200
  in a modular way, that is, you can either instantiate the whole api wrapper Github.new
139
201
  or use parts of it e.i. Github::Client::Repos.new if working solely with repositories
@@ -187,7 +249,11 @@ files:
187
249
  - lib/github_api/client/orgs/hooks.rb
188
250
  - lib/github_api/client/orgs/members.rb
189
251
  - lib/github_api/client/orgs/memberships.rb
252
+ - lib/github_api/client/orgs/projects.rb
190
253
  - lib/github_api/client/orgs/teams.rb
254
+ - lib/github_api/client/projects.rb
255
+ - lib/github_api/client/projects/cards.rb
256
+ - lib/github_api/client/projects/columns.rb
191
257
  - lib/github_api/client/pull_requests.rb
192
258
  - lib/github_api/client/pull_requests/comments.rb
193
259
  - lib/github_api/client/pull_requests/reviews.rb
@@ -203,6 +269,7 @@ files:
203
269
  - lib/github_api/client/repos/keys.rb
204
270
  - lib/github_api/client/repos/merging.rb
205
271
  - lib/github_api/client/repos/pages.rb
272
+ - lib/github_api/client/repos/projects.rb
206
273
  - lib/github_api/client/repos/pub_sub_hubbub.rb
207
274
  - lib/github_api/client/repos/releases.rb
208
275
  - lib/github_api/client/repos/releases/assets.rb