lingfennan-github_api 0.18.2

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.
Files changed (126) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +20 -0
  3. data/README.md +741 -0
  4. data/lib/github_api.rb +93 -0
  5. data/lib/github_api/api.rb +398 -0
  6. data/lib/github_api/api/actions.rb +60 -0
  7. data/lib/github_api/api/arguments.rb +253 -0
  8. data/lib/github_api/api/config.rb +105 -0
  9. data/lib/github_api/api/config/property.rb +30 -0
  10. data/lib/github_api/api/config/property_set.rb +120 -0
  11. data/lib/github_api/api/factory.rb +33 -0
  12. data/lib/github_api/authorization.rb +75 -0
  13. data/lib/github_api/client.rb +77 -0
  14. data/lib/github_api/client/activity.rb +31 -0
  15. data/lib/github_api/client/activity/events.rb +233 -0
  16. data/lib/github_api/client/activity/feeds.rb +50 -0
  17. data/lib/github_api/client/activity/notifications.rb +181 -0
  18. data/lib/github_api/client/activity/starring.rb +130 -0
  19. data/lib/github_api/client/activity/watching.rb +176 -0
  20. data/lib/github_api/client/authorizations.rb +142 -0
  21. data/lib/github_api/client/authorizations/app.rb +98 -0
  22. data/lib/github_api/client/emojis.rb +19 -0
  23. data/lib/github_api/client/gists.rb +289 -0
  24. data/lib/github_api/client/gists/comments.rb +100 -0
  25. data/lib/github_api/client/git_data.rb +31 -0
  26. data/lib/github_api/client/git_data/blobs.rb +51 -0
  27. data/lib/github_api/client/git_data/commits.rb +101 -0
  28. data/lib/github_api/client/git_data/references.rb +150 -0
  29. data/lib/github_api/client/git_data/tags.rb +95 -0
  30. data/lib/github_api/client/git_data/trees.rb +113 -0
  31. data/lib/github_api/client/gitignore.rb +57 -0
  32. data/lib/github_api/client/issues.rb +248 -0
  33. data/lib/github_api/client/issues/assignees.rb +77 -0
  34. data/lib/github_api/client/issues/comments.rb +146 -0
  35. data/lib/github_api/client/issues/events.rb +50 -0
  36. data/lib/github_api/client/issues/labels.rb +189 -0
  37. data/lib/github_api/client/issues/milestones.rb +146 -0
  38. data/lib/github_api/client/markdown.rb +62 -0
  39. data/lib/github_api/client/meta.rb +19 -0
  40. data/lib/github_api/client/orgs.rb +127 -0
  41. data/lib/github_api/client/orgs/hooks.rb +182 -0
  42. data/lib/github_api/client/orgs/members.rb +142 -0
  43. data/lib/github_api/client/orgs/memberships.rb +131 -0
  44. data/lib/github_api/client/orgs/projects.rb +57 -0
  45. data/lib/github_api/client/orgs/teams.rb +407 -0
  46. data/lib/github_api/client/projects.rb +83 -0
  47. data/lib/github_api/client/projects/cards.rb +158 -0
  48. data/lib/github_api/client/projects/columns.rb +146 -0
  49. data/lib/github_api/client/pull_requests.rb +195 -0
  50. data/lib/github_api/client/pull_requests/comments.rb +140 -0
  51. data/lib/github_api/client/pull_requests/reviews.rb +158 -0
  52. data/lib/github_api/client/repos.rb +468 -0
  53. data/lib/github_api/client/repos/branches.rb +48 -0
  54. data/lib/github_api/client/repos/branches/protections.rb +75 -0
  55. data/lib/github_api/client/repos/collaborators.rb +84 -0
  56. data/lib/github_api/client/repos/comments.rb +125 -0
  57. data/lib/github_api/client/repos/commits.rb +80 -0
  58. data/lib/github_api/client/repos/contents.rb +246 -0
  59. data/lib/github_api/client/repos/deployments.rb +138 -0
  60. data/lib/github_api/client/repos/downloads.rb +62 -0
  61. data/lib/github_api/client/repos/forks.rb +48 -0
  62. data/lib/github_api/client/repos/hooks.rb +214 -0
  63. data/lib/github_api/client/repos/keys.rb +104 -0
  64. data/lib/github_api/client/repos/merging.rb +47 -0
  65. data/lib/github_api/client/repos/pages.rb +48 -0
  66. data/lib/github_api/client/repos/projects.rb +62 -0
  67. data/lib/github_api/client/repos/pub_sub_hubbub.rb +133 -0
  68. data/lib/github_api/client/repos/releases.rb +189 -0
  69. data/lib/github_api/client/repos/releases/assets.rb +136 -0
  70. data/lib/github_api/client/repos/releases/tags.rb +24 -0
  71. data/lib/github_api/client/repos/statistics.rb +89 -0
  72. data/lib/github_api/client/repos/statuses.rb +91 -0
  73. data/lib/github_api/client/say.rb +25 -0
  74. data/lib/github_api/client/scopes.rb +46 -0
  75. data/lib/github_api/client/search.rb +133 -0
  76. data/lib/github_api/client/search/legacy.rb +111 -0
  77. data/lib/github_api/client/users.rb +117 -0
  78. data/lib/github_api/client/users/emails.rb +65 -0
  79. data/lib/github_api/client/users/followers.rb +115 -0
  80. data/lib/github_api/client/users/keys.rb +104 -0
  81. data/lib/github_api/configuration.rb +70 -0
  82. data/lib/github_api/connection.rb +82 -0
  83. data/lib/github_api/constants.rb +61 -0
  84. data/lib/github_api/core_ext/array.rb +25 -0
  85. data/lib/github_api/core_ext/hash.rb +91 -0
  86. data/lib/github_api/core_ext/ordered_hash.rb +107 -0
  87. data/lib/github_api/deprecation.rb +39 -0
  88. data/lib/github_api/error.rb +32 -0
  89. data/lib/github_api/error/client_error.rb +89 -0
  90. data/lib/github_api/error/service_error.rb +223 -0
  91. data/lib/github_api/ext/faraday.rb +38 -0
  92. data/lib/github_api/mash.rb +7 -0
  93. data/lib/github_api/middleware.rb +37 -0
  94. data/lib/github_api/mime_type.rb +33 -0
  95. data/lib/github_api/normalizer.rb +23 -0
  96. data/lib/github_api/null_encoder.rb +25 -0
  97. data/lib/github_api/page_iterator.rb +138 -0
  98. data/lib/github_api/page_links.rb +63 -0
  99. data/lib/github_api/paged_request.rb +42 -0
  100. data/lib/github_api/pagination.rb +115 -0
  101. data/lib/github_api/parameter_filter.rb +35 -0
  102. data/lib/github_api/params_hash.rb +115 -0
  103. data/lib/github_api/rate_limit.rb +25 -0
  104. data/lib/github_api/request.rb +85 -0
  105. data/lib/github_api/request/basic_auth.rb +36 -0
  106. data/lib/github_api/request/jsonize.rb +54 -0
  107. data/lib/github_api/request/oauth2.rb +44 -0
  108. data/lib/github_api/request/verbs.rb +63 -0
  109. data/lib/github_api/response.rb +48 -0
  110. data/lib/github_api/response/atom_parser.rb +22 -0
  111. data/lib/github_api/response/follow_redirects.rb +140 -0
  112. data/lib/github_api/response/header.rb +87 -0
  113. data/lib/github_api/response/jsonize.rb +28 -0
  114. data/lib/github_api/response/mashify.rb +24 -0
  115. data/lib/github_api/response/raise_error.rb +22 -0
  116. data/lib/github_api/response/xmlize.rb +27 -0
  117. data/lib/github_api/response_wrapper.rb +161 -0
  118. data/lib/github_api/ssl_certs/cacerts.pem +2183 -0
  119. data/lib/github_api/utils/url.rb +63 -0
  120. data/lib/github_api/validations.rb +22 -0
  121. data/lib/github_api/validations/format.rb +26 -0
  122. data/lib/github_api/validations/presence.rb +32 -0
  123. data/lib/github_api/validations/required.rb +21 -0
  124. data/lib/github_api/validations/token.rb +41 -0
  125. data/lib/github_api/version.rb +5 -0
  126. metadata +338 -0
@@ -0,0 +1,62 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative '../api'
4
+
5
+ module Github
6
+ class Client::Markdown < API
7
+
8
+ # Render an arbritrary Markdown document
9
+ #
10
+ # = Parameters
11
+ # <tt>:text</tt> - Required string - The Markdown text to render
12
+ # <tt>:mode<tt> - Optional string - The rendering mode
13
+ # * <tt>markdown</tt> to render a document as plain Markdown, just
14
+ # like README files are rendered.
15
+ # * <tt>gfm</tt> to render a document as user-content, e.g. like user
16
+ # comments or issues are rendered. In GFM mode, hard line breaks are
17
+ # always taken into account, and issue and user mentions are
18
+ # linked accordingly.
19
+ # <tt>:context<tt> - Optional string - The repository context, only taken
20
+ # into account when rendering as <tt>gfm</tt>
21
+ #
22
+ # = Examples
23
+ # github = Github.new
24
+ # github.markdown.render
25
+ # "text": "Hello world github/linguist#1 **cool**, and #1!",
26
+ # "mode": "gfm",
27
+ # "context": "github/gollum"
28
+ #
29
+ def render(*args)
30
+ arguments(args) do
31
+ assert_required ['text']
32
+ end
33
+ params = arguments.params
34
+ params['raw'] = true
35
+
36
+ post_request("markdown", arguments.params)
37
+ end
38
+
39
+ # Render a Markdown document in raw mode
40
+ #
41
+ # = Input
42
+ # The raw API it not JSON-based. It takes a Markdown document as plaintext
43
+ # <tt>text/plain</tt> or <tt>text/x-markdown</tt> and renders it as plain
44
+ # Markdown without a repository context (just like a README.md file is
45
+ # rendered – this is the simplest way to preview a readme online)
46
+ #
47
+ # = Examples
48
+ # github = Github.new
49
+ # github.markdown.render_raw "Hello github/linguist#1 **cool**, and #1!",
50
+ # "accept": "text/plain",
51
+ #
52
+ def render_raw(*args)
53
+ params = arguments(args).params
54
+ params['data'] = args.shift
55
+ params['raw'] = true
56
+ params['accept'] = params.fetch('accept') { 'text/plain' }
57
+
58
+ post_request("markdown/raw", params)
59
+ end
60
+
61
+ end # Markdown
62
+ end # Github
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative '../api'
4
+
5
+ module Github
6
+ class Client::Meta < API
7
+ # Get meta information about GitHub.com, the service.
8
+ #
9
+ # @example
10
+ # Github.meta.get
11
+ #
12
+ # @api public
13
+ def get(*args)
14
+ arguments(*args)
15
+
16
+ get_request("/meta", arguments.params)
17
+ end
18
+ end # Client::Meta
19
+ end # Github
@@ -0,0 +1,127 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative '../api'
4
+
5
+ module Github
6
+ # Organizations API
7
+ class Client::Orgs < API
8
+
9
+ require_all 'github_api/client/orgs',
10
+ 'hooks',
11
+ 'members',
12
+ 'memberships',
13
+ 'projects',
14
+ 'teams'
15
+
16
+ # Access to Client::Orgs::Hooks API
17
+ namespace :hooks
18
+
19
+ # Access to Client::Orgs::Members API
20
+ namespace :members
21
+
22
+ # Access to Client::Orgs::Memberships API
23
+ namespace :memberships
24
+
25
+ # Access to Client::Orgs::Projects API
26
+ namespace :projects
27
+
28
+ # Access to Client::Orgs::Teams API
29
+ namespace :teams
30
+
31
+ # List all organizations
32
+ #
33
+ # Lists all organizations, in the order that they were created on GitHub.
34
+ #
35
+ # @see https://developer.github.com/v3/orgs/#list-all-organizations
36
+ #
37
+ # @param [Hash] params
38
+ # @option params [String] :since
39
+ # The integer ID of the last Organization that you've seen.
40
+ #
41
+ # @example
42
+ # github = Github.new
43
+ # github.orgs.list :every
44
+ #
45
+ # List all public organizations for a user.
46
+ #
47
+ # @see https://developer.github.com/v3/orgs/#list-user-organizations
48
+ #
49
+ # @example
50
+ # github = Github.new
51
+ # github.orgs.list user: 'user-name'
52
+ #
53
+ # List public and private organizations for the authenticated user.
54
+ #
55
+ # @example
56
+ # github = Github.new oauth_token: '..'
57
+ # github.orgs.list
58
+ #
59
+ # @api public
60
+ def list(*args)
61
+ params = arguments(args).params
62
+
63
+ if (user_name = params.delete('user'))
64
+ response = get_request("/users/#{user_name}/orgs", params)
65
+ elsif args.map(&:to_s).include?('every')
66
+ response = get_request('/organizations', params)
67
+ else
68
+ # For the authenticated user
69
+ response = get_request('/user/orgs', params)
70
+ end
71
+ return response unless block_given?
72
+ response.each { |el| yield el }
73
+ end
74
+ alias_method :all, :list
75
+
76
+ # Get properties for a single organization
77
+ #
78
+ # @see https://developer.github.com/v3/orgs/#get-an-organization
79
+ #
80
+ # @example
81
+ # github = Github.new
82
+ # github.orgs.get 'github'
83
+ #
84
+ # @api public
85
+ def get(*args)
86
+ arguments(args, required: [:org_name])
87
+
88
+ get_request("/orgs/#{arguments.org_name}", arguments.params)
89
+ end
90
+ alias_method :find, :get
91
+
92
+ # Edit organization
93
+ #
94
+ # @see https://developer.github.com/v3/orgs/#edit-an-organization
95
+ #
96
+ # @param [Hash] params
97
+ # @option params [String] :billing_email
98
+ # Billing email address. This address is not publicized.
99
+ # @option params [String] :company
100
+ # The company name
101
+ # @option params [String] :email
102
+ # The publicly visible email address
103
+ # @option params [String] :location
104
+ # The location
105
+ # @option params [String] :name
106
+ # The shorthand name of the company.
107
+ # @option params [String] :description
108
+ # The description of the company.
109
+ #
110
+ # @example
111
+ # github = Github.new oauth_token: '...'
112
+ # github.orgs.edit 'github',
113
+ # billing_email: "support@github.com",
114
+ # blog: "https://github.com/blog",
115
+ # company: "GitHub",
116
+ # email: "support@github.com",
117
+ # location: "San Francisco",
118
+ # name: "github"
119
+ #
120
+ # @api public
121
+ def edit(*args)
122
+ arguments(args, required: [:org_name])
123
+
124
+ patch_request("/orgs/#{arguments.org_name}", arguments.params)
125
+ end
126
+ end # Orgs
127
+ end # Github
@@ -0,0 +1,182 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative '../../api'
4
+
5
+ module Github
6
+ # The Organizations Hooks API manages the post-receive web and
7
+ # service hooks for an organization.
8
+ class Client::Orgs::Hooks < API
9
+
10
+ REQUIRED_PARAMS = %w( name config ).freeze # :nodoc:
11
+
12
+ # List organization hooks
13
+ #
14
+ # @see https://developer.github.com/v3/orgs/hooks/#list-hooks
15
+ #
16
+ # @example
17
+ # github = Github.new
18
+ # github.orgs.hooks.list 'org-name'
19
+ # github.orgs.hooks.list 'org-name' { |hook| ... }
20
+ #
21
+ # @api public
22
+ def list(*args)
23
+ arguments(args, required: [:org_name])
24
+
25
+ response = get_request("/orgs/#{arguments.org_name}/hooks", arguments.params)
26
+ return response unless block_given?
27
+ response.each { |el| yield el }
28
+ end
29
+ alias_method :all, :list
30
+
31
+ # Get a single hook
32
+ #
33
+ # @see https://developer.github.com/v3/orgs/hooks/#get-single-hook
34
+ #
35
+ # @example
36
+ # github = Github.new
37
+ # github.orgs.hooks.get 'org-name', 'hook-id'
38
+ #
39
+ # @api public
40
+ def get(*args)
41
+ arguments(args, required: [:org_name, :id])
42
+
43
+ get_request("/orgs/#{arguments.org_name}/hooks/#{arguments.id}",
44
+ arguments.params)
45
+ end
46
+ alias_method :find, :get
47
+
48
+ # Create a hook
49
+ #
50
+ # @see https://developer.github.com/v3/orgs/hooks/#create-a-hook
51
+ #
52
+ # @param [Hash] params
53
+ # @input params [String] :name
54
+ # Required. The name of the service that is being called.
55
+ # @input params [Hash] :config
56
+ # Required. Key/value pairs to provide settings for this hook.
57
+ # These settings vary between the services and are defined in
58
+ # the github-services repository. Booleans are stored internally
59
+ # as "1" for true, and "0" for false. Any JSON true/false values
60
+ # will be converted automatically.
61
+ # @input params [Array] :events
62
+ # Determines what events the hook is triggered for. Default: ["push"]
63
+ # @input params [Boolean] :active
64
+ # Determines whether the hook is actually triggered on pushes.
65
+ #
66
+ # To create a webhook, the following fields are required by the config:
67
+ #
68
+ # @input config [String] :url
69
+ # A required string defining the URL to which the payloads
70
+ # will be delivered.
71
+ # @input config [String] :content_type
72
+ # An optional string defining the media type used to serialize
73
+ # the payloads. Supported values include json and form.
74
+ # The default is form.
75
+ # @input config [String] :secret
76
+ # An optional string that’s passed with the HTTP requests as
77
+ # an X-Hub-Signature header. The value of this header is
78
+ # computed as the HMAC hex digest of the body,
79
+ # using the secret as the key.
80
+ # @input config [String] :insecure_ssl
81
+ # An optional string that determines whether the SSL certificate
82
+ # of the host for url will be verified when delivering payloads.
83
+ # Supported values include "0" (verification is performed) and
84
+ # "1" (verification is not performed). The default is "0".or instance, if the library doesn't get updated to permit a given parameter the api call won't work, however if we skip permission all together, the endpoint should always work provided the actual resource path doesn't change. I'm in the process of completely removing the permit functionality.
85
+ #
86
+ # @example
87
+ # github = Github.new
88
+ # github.orgs.hooks.create 'org-name',
89
+ # name: "web",
90
+ # active: true,
91
+ # config: {
92
+ # url: "http://something.com/webhook"
93
+ # }
94
+ # }
95
+ #
96
+ # @api public
97
+ def create(*args)
98
+ arguments(args, required: [:org_name]) do
99
+ assert_required REQUIRED_PARAMS
100
+ end
101
+
102
+ post_request("/orgs/#{arguments.org_name}/hooks", arguments.params)
103
+ end
104
+
105
+ # Edit a hook
106
+ #
107
+ # @see https://developer.github.com/v3/orgs/hooks/#edit-a-hook
108
+ #
109
+ # @param [Hash] params
110
+ # @input params [Hash] :config
111
+ # Required. Key/value pairs to provide settings for this hook.
112
+ # These settings vary between the services and are defined in
113
+ # the github-services repository. Booleans are stored internally
114
+ # as "1" for true, and "0" for false. Any JSON true/false values
115
+ # will be converted automatically.
116
+ # @input params [Array] :events
117
+ # Determines what events the hook is triggered for. Default: ["push"]
118
+ # @input params [Array] :add_events
119
+ # Determines a list of events to be added to the list of events
120
+ # that the Hook triggers for.
121
+ # @input params [Array] :remove_events
122
+ # Determines a list of events to be removed from the list of
123
+ # events that the Hook triggers for.
124
+ # @input params [Boolean] :active
125
+ # Determines whether the hook is actually triggered on pushes.
126
+ #
127
+ # @example
128
+ # github = Github.new
129
+ # github.orgs.hooks.edit 'org-name', 'hook-id',
130
+ # "name" => "campfire",
131
+ # "active" => true,
132
+ # "config" => {
133
+ # "subdomain" => "github",
134
+ # "room" => "Commits",
135
+ # "token" => "abc123"
136
+ # }
137
+ #
138
+ # @api public
139
+ def edit(*args)
140
+ arguments(args, required: [:org_name, :id]) do
141
+ assert_required REQUIRED_PARAMS
142
+ end
143
+
144
+ patch_request("/orgs/#{arguments.org_name}/hooks/#{arguments.id}",
145
+ arguments.params)
146
+ end
147
+
148
+ # Ping a hook
149
+ #
150
+ # This will trigger a ping event to be sent to the hook.
151
+ #
152
+ # @see https://developer.github.com/v3/orgs/hooks/#ping-a-hook
153
+ #
154
+ # @example
155
+ # github = Github.new
156
+ # github.orgs.hooks.ping 'org-name', 'hook-id'
157
+ #
158
+ # @api public
159
+ def ping(*args)
160
+ arguments(args, required: [:org_name, :id])
161
+
162
+ post_request("/orgs/#{arguments.org_name}/hooks/#{arguments.id}/pings",
163
+ arguments.params)
164
+ end
165
+
166
+ # Delete a hook
167
+ #
168
+ # @see https://developer.github.com/v3/orgs/hooks/#delete-a-hook
169
+ #
170
+ # @example
171
+ # github = Github.new
172
+ # github.orgs.hooks.delete 'org-name', 'hook-id'
173
+ #
174
+ # @api public
175
+ def delete(*args)
176
+ arguments(args, required: [:org_name, :id])
177
+
178
+ delete_request("/orgs/#{arguments.org_name}/hooks/#{arguments.id}",
179
+ arguments.params)
180
+ end
181
+ end # Client::Orgs::Hooks
182
+ end # Github
@@ -0,0 +1,142 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative '../../api'
4
+
5
+ module Github
6
+ class Client::Orgs::Members < API
7
+ # List members
8
+ #
9
+ # List all users who are members of an organization. A member is a user
10
+ # that belongs to at least 1 team in the organization.
11
+ # If the authenticated user is also a member of this organization then
12
+ # both concealed and public members will be returned.
13
+ # Otherwise only public members are returned.
14
+ #
15
+ # @see https://developer.github.com/v3/orgs/members/#members-list
16
+ #
17
+ # @param [Hash] params
18
+ # @option params [String] :filter
19
+ # Filter members returned in the list. Can be one of:
20
+ # * 2fa_disabled: Members without two-factor authentication enabled.
21
+ # Available for owners of organizations with private repositories.
22
+ # * all: All members the authenticated user can see.
23
+ # Default: all
24
+ # @option params [String] :role
25
+ # Filter members returned by their role. Can be one of:
26
+ # * all: All members of the organization, regardless of role.
27
+ # * admin: Organization owners.
28
+ # * member: Non-owner organization members.
29
+ #
30
+ # @example
31
+ # github = Github.new
32
+ # github.orgs.members.list 'org-name'
33
+ # github.orgs.members.list 'org-name' { |memb| ... }
34
+ #
35
+ # List public members
36
+ #
37
+ # @see https://developer.github.com/v3/orgs/members/#public-members-list
38
+ #
39
+ # Members of an organization can choose to have their
40
+ # membership publicized or not.
41
+ #
42
+ # @example
43
+ # github = Github.new
44
+ # github.orgs.members.list 'org-name', public: true
45
+ # github.orgs.members.list 'org-name', public: true { |memb| ... }
46
+ #
47
+ # @api public
48
+ def list(*args)
49
+ params = arguments(args, required: [:org_name]).params
50
+ org_name = arguments.org_name
51
+
52
+ response = if params.delete('public')
53
+ get_request("/orgs/#{org_name}/public_members", params)
54
+ else
55
+ get_request("/orgs/#{org_name}/members", params)
56
+ end
57
+ return response unless block_given?
58
+ response.each { |el| yield el }
59
+ end
60
+ alias_method :all, :list
61
+
62
+ # Check if user is, publicly or privately, a member of an organization
63
+ #
64
+ # @example
65
+ # github = Github.new
66
+ # github.orgs.members.member? 'org-name', 'member-name'
67
+ #
68
+ # Check if a user is a public member of an organization
69
+ #
70
+ # @example
71
+ # github = Github.new
72
+ # github.orgs.members.member? 'org-name', 'member-name', public: true
73
+ #
74
+ # @api public
75
+ def member?(*args)
76
+ params = arguments(args, required: [:org_name, :user]).params
77
+ org_name = arguments.org_name
78
+ user = arguments.user
79
+
80
+ response = if params.delete('public')
81
+ get_request("/orgs/#{org_name}/public_members/#{user}", params)
82
+ else
83
+ get_request("/orgs/#{org_name}/members/#{user}", params)
84
+ end
85
+ response.status == 204
86
+ rescue Github::Error::NotFound
87
+ false
88
+ end
89
+ # Remove a member
90
+ #
91
+ # Removing a user from this list will remove them from all teams and
92
+ # they will no longer have any access to the organization's repositories.
93
+ #
94
+ # @see https://developer.github.com/v3/orgs/members/#remove-a-member
95
+ #
96
+ # @example
97
+ # github = Github.new
98
+ # github.orgs.members.remove 'org-name', 'member-name'
99
+ #
100
+ # @api public
101
+ def delete(*args)
102
+ arguments(args, required: [:org_name, :user])
103
+
104
+ delete_request("/orgs/#{arguments.org_name}/members/#{arguments.user}",
105
+ arguments.params)
106
+ end
107
+ alias_method :remove, :delete
108
+
109
+ # Publicize a user's membership
110
+ #
111
+ # @see https://developer.github.com/v3/orgs/members/#publicize-a-users-membership
112
+ #
113
+ # @example
114
+ # github = Github.new oauth_token: '...'
115
+ # github.orgs.members.publicize 'org-name', 'member-name'
116
+ #
117
+ # @api public
118
+ def publicize(*args)
119
+ arguments(args, required: [:org_name, :user])
120
+
121
+ put_request("/orgs/#{arguments.org_name}/public_members/#{arguments.user}", arguments.params)
122
+ end
123
+ alias_method :make_public, :publicize
124
+ alias_method :publicize_membership, :publicize
125
+
126
+ # Conceal a user's membership
127
+ #
128
+ # @see https://developer.github.com/v3/orgs/members/#conceal-a-users-membership
129
+ #
130
+ # @example
131
+ # github = Github.new oauth_token: '...'
132
+ # github.orgs.members.conceal 'org-name', 'member-name'
133
+ #
134
+ # @api public
135
+ def conceal(*args)
136
+ arguments(args, required: [:org_name, :user])
137
+
138
+ delete_request("/orgs/#{arguments.org_name}/public_members/#{arguments.user}", arguments.params)
139
+ end
140
+ alias_method :conceal_membership, :conceal
141
+ end # Client::Orgs::Members
142
+ end # Github