github_api 0.3.5 → 0.3.6

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 (147) hide show
  1. data/LICENSE.txt +20 -0
  2. data/README.rdoc +228 -0
  3. data/Rakefile +52 -0
  4. data/features/github_api.feature +50 -0
  5. data/features/options.feature +4 -0
  6. data/features/pagination.feature +4 -0
  7. data/features/step_definitions/github_api_steps.rb +11 -0
  8. data/features/support/env.rb +13 -0
  9. data/lib/github_api.rb +73 -0
  10. data/lib/github_api/api.rb +175 -0
  11. data/lib/github_api/api/utils.rb +9 -0
  12. data/lib/github_api/authorization.rb +73 -0
  13. data/lib/github_api/authorizations.rb +119 -0
  14. data/lib/github_api/cache_control.rb +19 -0
  15. data/lib/github_api/client.rb +55 -0
  16. data/lib/github_api/compatibility.rb +23 -0
  17. data/lib/github_api/configuration.rb +96 -0
  18. data/lib/github_api/connection.rb +75 -0
  19. data/lib/github_api/core_ext/array.rb +14 -0
  20. data/lib/github_api/core_ext/hash.rb +42 -0
  21. data/lib/github_api/error.rb +35 -0
  22. data/lib/github_api/events.rb +202 -0
  23. data/lib/github_api/gists.rb +200 -0
  24. data/lib/github_api/gists/comments.rb +86 -0
  25. data/lib/github_api/git_data.rb +26 -0
  26. data/lib/github_api/git_data/blobs.rb +51 -0
  27. data/lib/github_api/git_data/commits.rb +78 -0
  28. data/lib/github_api/git_data/references.rb +113 -0
  29. data/lib/github_api/git_data/tags.rb +78 -0
  30. data/lib/github_api/git_data/trees.rb +89 -0
  31. data/lib/github_api/issues.rb +215 -0
  32. data/lib/github_api/issues/comments.rb +123 -0
  33. data/lib/github_api/issues/events.rb +54 -0
  34. data/lib/github_api/issues/labels.rb +191 -0
  35. data/lib/github_api/issues/milestones.rb +140 -0
  36. data/lib/github_api/mime_type.rb +55 -0
  37. data/lib/github_api/orgs.rb +95 -0
  38. data/lib/github_api/orgs/members.rb +120 -0
  39. data/lib/github_api/orgs/teams.rb +245 -0
  40. data/lib/github_api/pull_requests.rb +224 -0
  41. data/lib/github_api/pull_requests/comments.rb +144 -0
  42. data/lib/github_api/repos.rb +286 -0
  43. data/lib/github_api/repos/collaborators.rb +81 -0
  44. data/lib/github_api/repos/commits.rb +180 -0
  45. data/lib/github_api/repos/downloads.rb +155 -0
  46. data/lib/github_api/repos/forks.rb +48 -0
  47. data/lib/github_api/repos/hooks.rb +174 -0
  48. data/lib/github_api/repos/keys.rb +104 -0
  49. data/lib/github_api/repos/pub_sub_hubbub.rb +102 -0
  50. data/lib/github_api/repos/watching.rb +94 -0
  51. data/lib/github_api/request.rb +84 -0
  52. data/lib/github_api/request/basic_auth.rb +31 -0
  53. data/lib/github_api/request/caching.rb +33 -0
  54. data/lib/github_api/request/oauth2.rb +33 -0
  55. data/lib/github_api/response.rb +28 -0
  56. data/lib/github_api/response/helpers.rb +14 -0
  57. data/lib/github_api/response/jsonize.rb +26 -0
  58. data/lib/github_api/response/mashify.rb +24 -0
  59. data/lib/github_api/response/raise_error.rb +33 -0
  60. data/lib/github_api/result.rb +42 -0
  61. data/lib/github_api/users.rb +84 -0
  62. data/lib/github_api/users/emails.rb +49 -0
  63. data/lib/github_api/users/followers.rb +98 -0
  64. data/lib/github_api/users/keys.rb +84 -0
  65. data/lib/github_api/version.rb +12 -0
  66. data/spec/README.rdoc +22 -0
  67. data/spec/coverage_adapter.rb +15 -0
  68. data/spec/fixtures/auths/authorization.json +14 -0
  69. data/spec/fixtures/auths/authorizations.json +16 -0
  70. data/spec/fixtures/events/events.json +29 -0
  71. data/spec/fixtures/issues/comment.json +13 -0
  72. data/spec/fixtures/issues/comments.json +15 -0
  73. data/spec/fixtures/issues/event.json +13 -0
  74. data/spec/fixtures/issues/events.json +15 -0
  75. data/spec/fixtures/issues/issue.json +56 -0
  76. data/spec/fixtures/issues/issues.json +58 -0
  77. data/spec/fixtures/issues/milestone.json +18 -0
  78. data/spec/fixtures/issues/milestones.json +20 -0
  79. data/spec/fixtures/orgs/members.json +9 -0
  80. data/spec/fixtures/orgs/org.json +18 -0
  81. data/spec/fixtures/orgs/orgs.json +8 -0
  82. data/spec/fixtures/orgs/team.json +8 -0
  83. data/spec/fixtures/orgs/team_repos.json +29 -0
  84. data/spec/fixtures/orgs/teams.json +7 -0
  85. data/spec/fixtures/repos/branches.json +9 -0
  86. data/spec/fixtures/repos/collaborators.json +8 -0
  87. data/spec/fixtures/repos/commit.json +53 -0
  88. data/spec/fixtures/repos/commit_comment.json +16 -0
  89. data/spec/fixtures/repos/commit_comments.json +18 -0
  90. data/spec/fixtures/repos/commits.json +27 -0
  91. data/spec/fixtures/repos/contributors.json +8 -0
  92. data/spec/fixtures/repos/download.json +10 -0
  93. data/spec/fixtures/repos/download_s3.json +21 -0
  94. data/spec/fixtures/repos/downloads.json +12 -0
  95. data/spec/fixtures/repos/fork.json +27 -0
  96. data/spec/fixtures/repos/forks.json +29 -0
  97. data/spec/fixtures/repos/hook.json +15 -0
  98. data/spec/fixtures/repos/hooks.json +10 -0
  99. data/spec/fixtures/repos/key.json +6 -0
  100. data/spec/fixtures/repos/keys.json +8 -0
  101. data/spec/fixtures/repos/languages.json +4 -0
  102. data/spec/fixtures/repos/repo.json +90 -0
  103. data/spec/fixtures/repos/repo_comments.json +18 -0
  104. data/spec/fixtures/repos/repos.json +29 -0
  105. data/spec/fixtures/repos/tags.json +11 -0
  106. data/spec/fixtures/repos/teams.json +7 -0
  107. data/spec/fixtures/repos/watched.json +29 -0
  108. data/spec/fixtures/repos/watchers.json +8 -0
  109. data/spec/fixtures/users/user.json +32 -0
  110. data/spec/github/api_spec.rb +25 -0
  111. data/spec/github/authorization_spec.rb +176 -0
  112. data/spec/github/authorizations_spec.rb +242 -0
  113. data/spec/github/client_spec.rb +50 -0
  114. data/spec/github/core_ext/hash_spec.rb +44 -0
  115. data/spec/github/events_spec.rb +491 -0
  116. data/spec/github/gists/comments_spec.rb +5 -0
  117. data/spec/github/gists_spec.rb +5 -0
  118. data/spec/github/git_data/blobs_spec.rb +5 -0
  119. data/spec/github/git_data/commits_spec.rb +5 -0
  120. data/spec/github/git_data/references_spec.rb +5 -0
  121. data/spec/github/git_data/tags_spec.rb +5 -0
  122. data/spec/github/git_data/trees_spec.rb +5 -0
  123. data/spec/github/git_data_spec.rb +5 -0
  124. data/spec/github/issues/comments_spec.rb +254 -0
  125. data/spec/github/issues/events_spec.rb +153 -0
  126. data/spec/github/issues/labels_spec.rb +5 -0
  127. data/spec/github/issues/milestones_spec.rb +260 -0
  128. data/spec/github/issues_spec.rb +287 -0
  129. data/spec/github/mime_type_spec.rb +70 -0
  130. data/spec/github/orgs/members_spec.rb +275 -0
  131. data/spec/github/orgs/teams_spec.rb +563 -0
  132. data/spec/github/orgs_spec.rb +160 -0
  133. data/spec/github/repos/collaborators_spec.rb +169 -0
  134. data/spec/github/repos/commits_spec.rb +424 -0
  135. data/spec/github/repos/downloads_spec.rb +247 -0
  136. data/spec/github/repos/forks_spec.rb +108 -0
  137. data/spec/github/repos/hooks_spec.rb +333 -0
  138. data/spec/github/repos/keys_spec.rb +217 -0
  139. data/spec/github/repos/pub_sub_hubbub_spec.rb +83 -0
  140. data/spec/github/repos/watching_spec.rb +222 -0
  141. data/spec/github/repos_spec.rb +571 -0
  142. data/spec/github/result_spec.rb +43 -0
  143. data/spec/github/users_spec.rb +140 -0
  144. data/spec/github_spec.rb +109 -0
  145. data/spec/spec_helper.rb +86 -0
  146. data/spec/support/base.rb +13 -0
  147. metadata +149 -4
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+
3
+ if RUBY_VERSION < "1.9"
4
+
5
+ def ruby_18 #:nodoc:
6
+ yield
7
+ end
8
+
9
+ def ruby_19 #:nodoc:
10
+ false
11
+ end
12
+
13
+ else
14
+
15
+ def ruby_18 #:nodoc:
16
+ false
17
+ end
18
+
19
+ def ruby_19 #:nodoc:
20
+ yield
21
+ end
22
+
23
+ end
@@ -0,0 +1,96 @@
1
+ # encoding: utf-8
2
+
3
+ module Github
4
+ module Configuration
5
+
6
+ VALID_OPTIONS_KEYS = [
7
+ :adapter,
8
+ :client_id,
9
+ :client_secret,
10
+ :oauth_token,
11
+ :endpoint,
12
+ :mime_type,
13
+ :user_agent,
14
+ :connection_options,
15
+ :repo,
16
+ :user,
17
+ :login,
18
+ :password,
19
+ :basic_auth
20
+ ].freeze
21
+
22
+ # Other adapters are :typhoeus, :patron, :em_synchrony, :excon, :test
23
+ DEFAULT_ADAPTER = :net_http
24
+
25
+ # By default, don't set an application key
26
+ DEFAULT_CLIENT_ID = nil
27
+
28
+ # By default, don't set an application secret
29
+ DEFAULT_CLIENT_SECRET = nil
30
+
31
+ # By default, don't set a user oauth access token
32
+ DEFAULT_OAUTH_TOKEN = nil
33
+
34
+ # By default, don't set a user login name
35
+ DEFAULT_LOGIN = nil
36
+
37
+ # By default, don't set a user password
38
+ DEFAULT_PASSWORD = nil
39
+
40
+ # By default, don't set a user basic authentication
41
+ DEFAULT_BASIC_AUTH = nil
42
+
43
+ # The endpoint used to connect to GitHub if none is set
44
+ DEFAULT_ENDPOINT = 'https://api.github.com'.freeze
45
+
46
+ # The value sent in the http header for 'User-Agent' if none is set
47
+ DEFAULT_USER_AGENT = "Github Ruby Gem #{Github::VERSION::STRING}".freeze
48
+
49
+ # By default the <tt>Accept</tt> header will make a request for <tt>JSON</tt>
50
+ DEFAULT_MIME_TYPE = :json
51
+
52
+ # By default uses the Faraday connection options if none is set
53
+ DEFAULT_CONNECTION_OPTIONS = {}
54
+
55
+ # By default, don't set user name
56
+ DEFAULT_USER = nil
57
+
58
+ # By default, don't set repository name
59
+ DEFAULT_REPO = nil
60
+
61
+ attr_accessor *VALID_OPTIONS_KEYS
62
+
63
+ # Convenience method to allow for global setting of configuration options
64
+ def configure
65
+ yield self
66
+ end
67
+
68
+ def self.extended(base)
69
+ base.set_defaults
70
+ end
71
+
72
+ def options
73
+ options = {}
74
+ VALID_OPTIONS_KEYS.each { |k| options[k] = send(k) }
75
+ options
76
+ end
77
+
78
+ def set_defaults
79
+ self.adapter = DEFAULT_ADAPTER
80
+ self.client_id = DEFAULT_CLIENT_ID
81
+ self.client_secret = DEFAULT_CLIENT_SECRET
82
+ self.oauth_token = DEFAULT_OAUTH_TOKEN
83
+ self.endpoint = DEFAULT_ENDPOINT
84
+ self.user_agent = DEFAULT_USER_AGENT
85
+ self.connection_options = DEFAULT_CONNECTION_OPTIONS
86
+ self.mime_type = DEFAULT_MIME_TYPE
87
+ self.user = DEFAULT_USER
88
+ self.repo = DEFAULT_REPO
89
+ self.login = DEFAULT_LOGIN
90
+ self.password = DEFAULT_PASSWORD
91
+ self.basic_auth = DEFAULT_BASIC_AUTH
92
+ self
93
+ end
94
+
95
+ end # Configuration
96
+ end # Github
@@ -0,0 +1,75 @@
1
+ # encoding: utf-8
2
+
3
+ require 'faraday'
4
+ require 'github_api/response'
5
+ require 'github_api/response/mashify'
6
+ require 'github_api/response/jsonize'
7
+ require 'github_api/response/helpers'
8
+ require 'github_api/response/raise_error'
9
+ require 'github_api/request/oauth2'
10
+ require 'github_api/request/basic_auth'
11
+
12
+ module Github
13
+ module Connection
14
+
15
+ ALLOWED_OPTIONS = [
16
+ :headers,
17
+ :url,
18
+ :params,
19
+ :request,
20
+ :ssl
21
+ ].freeze
22
+
23
+ private
24
+
25
+ def default_options(options={}) # :nodoc:
26
+ {
27
+ :headers => {
28
+ 'Accept' => '*/*', #accepts,
29
+ 'User-Agent' => user_agent,
30
+ 'Content-Type' => 'application/x-www-form-urlencoded'
31
+ },
32
+ :ssl => { :verify => false },
33
+ :url => endpoint
34
+ }
35
+ end
36
+
37
+ def clear_cache # :nodoc:
38
+ @connection = nil
39
+ end
40
+
41
+ def caching? # :nodoc:
42
+ !@connection.nil?
43
+ end
44
+
45
+ def connection(options = {}) # :nodoc:
46
+
47
+ merged_options = _filter_params_keys(ALLOWED_OPTIONS, default_options.merge(options))
48
+ clear_cache unless options.empty?
49
+
50
+ @connection ||= begin
51
+ Faraday.new(merged_options.merge(connection_options)) do |builder|
52
+ puts options.inspect
53
+
54
+ builder.use Faraday::Request::JSON
55
+ builder.use Faraday::Request::Multipart
56
+ builder.use Faraday::Request::UrlEncoded
57
+ builder.use Faraday::Response::Logger
58
+
59
+ builder.use Github::Request::OAuth2, oauth_token if oauth_token?
60
+ builder.use Github::Request::BasicAuth, authentication if basic_authed?
61
+
62
+ builder.use Github::Response::Helpers
63
+ unless options[:raw]
64
+ builder.use Github::Response::Mashify
65
+ builder.use Github::Response::Jsonize
66
+ end
67
+
68
+ builder.use Github::Response::RaiseError
69
+ builder.adapter adapter
70
+ end
71
+ end
72
+ end
73
+
74
+ end # Connection
75
+ end # Github
@@ -0,0 +1,14 @@
1
+ class Array # :nodoc:
2
+
3
+ def except(*keys) # :nodoc:
4
+ puts "module except works!!!"
5
+ self.dup.except!(*keys)
6
+ end unless method_defined?(:except)
7
+
8
+ def except!(*items) # :nodoc:
9
+ copy = self.dup
10
+ copy.reject! { |item| items.include? item }
11
+ copy
12
+ end unless method_defined?(:except!)
13
+
14
+ end # Hash
@@ -0,0 +1,42 @@
1
+ class Hash # :nodoc:
2
+
3
+ def except(*items) # :nodoc:
4
+ puts "array except works!!!"
5
+ self.dup.except!(*items)
6
+ end unless method_defined?(:except)
7
+
8
+ def except!(*keys) # :nodoc:
9
+ copy = self.dup
10
+ keys.each { |key| copy.delete!(key) }
11
+ copy
12
+ end unless method_defined?(:except!)
13
+
14
+ def symbolize_keys # :nodoc:
15
+ inject({}) do |hash, (key, value)|
16
+ hash[(key.to_sym rescue key) || key] = value
17
+ hash
18
+ end
19
+ end
20
+
21
+ def symbolize_keys! # :nodoc:
22
+ hash = symbolize_keys
23
+ hash.each do |key, val|
24
+ hash[key] = case val
25
+ when Hash
26
+ val.symbolize_keys!
27
+ when Array
28
+ val.map do |item|
29
+ item.is_a?(Hash) ? item.symbolize_keys! : item
30
+ end
31
+ else
32
+ val
33
+ end
34
+ end
35
+ return hash
36
+ end unless method_defined?(:symbolize_keys!)
37
+
38
+ def serialize # :nodoc:
39
+ self.map { |key, val| [key, val].join("=") }.join("&")
40
+ end unless method_defined?(:serialize)
41
+
42
+ end # Hash
@@ -0,0 +1,35 @@
1
+ # encoding: utf-8
2
+
3
+ module Github
4
+ class Error < StandardError
5
+ attr_reader :response_message, :response_headers
6
+
7
+ def initialize(message, headers)
8
+ @response_message = message
9
+ super message
10
+ end
11
+
12
+ def inspect
13
+ %(#<#{self.class}>)
14
+ end
15
+ end # Error
16
+
17
+ # Raised when Github returns the HTTP status code 400
18
+ class BadRequest < Error; end
19
+
20
+ # Raised when Github returns the HTTP status code 401
21
+ class Unauthorised < Error; end
22
+
23
+ # Raised when Github returns the HTTP status code 403
24
+ class Forbidden < Error; end
25
+
26
+ # Raised when Github returns the HTTP status code 404
27
+ class ResourceNotFound < Error; end
28
+
29
+ # Raised when Github returns the HTTP status code 500
30
+ class InternalServerError < Error; end
31
+
32
+ # Raised when Github returns the HTTP status code 503
33
+ class ServiceUnavailable < Error; end
34
+
35
+ end # Github
@@ -0,0 +1,202 @@
1
+ # encoding: utf-8
2
+
3
+ module Github
4
+ class Events < API
5
+
6
+ # Creates new Gists API
7
+ def initialize(options = {})
8
+ super(options)
9
+ end
10
+
11
+ # List all public events
12
+ #
13
+ # = Examples
14
+ # @github = Github.new
15
+ # @github.events.public
16
+ # @github.events.public { |event| ... }
17
+ #
18
+ def public(params={})
19
+ _normalize_params_keys(params)
20
+
21
+ response = get("/events", params)
22
+ return response unless block_given?
23
+ response.each { |el| yield el }
24
+ end
25
+ alias :public_events :public
26
+ alias :list_public :public
27
+ alias :list_public_events :public
28
+
29
+ # List all repository events for a given user
30
+ #
31
+ # = Examples
32
+ # @github = Github.new
33
+ # @github.events.repository_events 'user-name', 'repo-name'
34
+ # @github.events.repository_events 'user-name', 'repo-name' { |event| ... }
35
+ #
36
+ def repository(user_name=nil, repo_name=nil, params={})
37
+ _update_user_repo_params(user_name, repo_name)
38
+ _validate_user_repo_params(user, repo) unless user? && repo?
39
+ _normalize_params_keys(params)
40
+
41
+ response = get("/repos/#{user}/#{repo}/events", params)
42
+ return response unless block_given?
43
+ response.each { |el| yield el }
44
+ end
45
+ alias :repos :repository
46
+ alias :repo_events :repository
47
+ alias :repository_events :repository
48
+ alias :list_repository_events :repository
49
+
50
+ # List all issue events for a given repository
51
+ #
52
+ # = Examples
53
+ # @github = Github.new
54
+ # @github.events.issue 'user-name', 'repo-name'
55
+ # @github.events.issue 'user-name', 'repo-name' { |event| ... }
56
+ #
57
+ def issue(user_name=nil, repo_name=nil, params={})
58
+ _update_user_repo_params(user_name, repo_name)
59
+ _validate_user_repo_params(user, repo) unless user? && repo?
60
+ _normalize_params_keys(params)
61
+
62
+ response = get("/repos/#{user}/#{repo}/issues/events", params)
63
+ return response unless block_given?
64
+ response.each { |el| yield el }
65
+ end
66
+ alias :issues :issue
67
+ alias :issue_events :issue
68
+ alias :list_issue_events :issue
69
+
70
+ # List all public events for a network of repositories
71
+ #
72
+ # = Examples
73
+ # @github = Github.new
74
+ # @github.events.network 'user-name', 'repo-name'
75
+ # @github.events.network 'user-name', 'repo-name' { |event| ... }
76
+ #
77
+ def network(user_name=nil, repo_name=nil, params={})
78
+ _update_user_repo_params(user_name, repo_name)
79
+ _validate_user_repo_params(user, repo) unless user? && repo?
80
+ _normalize_params_keys(params)
81
+
82
+ response = get("/networks/#{user}/#{repo}/events", params)
83
+ return response unless block_given?
84
+ response.each { |el| yield el }
85
+ end
86
+ alias :repo_network :network
87
+ alias :repository_network :network
88
+ alias :list_repo_network_events :network
89
+ alias :list_repository_network_events :network
90
+
91
+ # List all public events for an organization
92
+ #
93
+ # = Examples
94
+ # @github = Github.new
95
+ # @github.events.org 'org-name'
96
+ # @github.events.org 'org-name' { |event| ... }
97
+ #
98
+ def org(org_name, params={})
99
+ _validate_presence_of org_name
100
+ _normalize_params_keys(params)
101
+
102
+ response = get("/orgs/#{org_name}/events", params)
103
+ return response unless block_given?
104
+ response.each { |el| yield el }
105
+ end
106
+ alias :organization :org
107
+ alias :list_orgs :org
108
+ alias :list_org_events :org
109
+ alias :list_organization_events :org
110
+
111
+ # List all events that a user has received
112
+ #
113
+ # These are events that you’ve received by watching repos and following users.
114
+ # If you are authenticated as the given user, you will see private events.
115
+ # Otherwise, you’ll only see public events.
116
+ #
117
+ # = Examples
118
+ # @github = Github.new
119
+ # @github.events.received 'user-name'
120
+ # @github.events.received 'user-name' { |event| ... }
121
+ #
122
+ # List all public events that a user has received
123
+ #
124
+ # = Examples
125
+ # @github = Github.new
126
+ # @github.events.received 'user-name', :public => true
127
+ # @github.events.received 'user-name', :public => true { |event| ... }
128
+ #
129
+ def received(user_name, params={})
130
+ _validate_presence_of user_name
131
+ _normalize_params_keys(params)
132
+
133
+ public_events = if params['public']
134
+ params.delete('public')
135
+ '/public'
136
+ end
137
+
138
+ response = get("/users/#{user_name}/received_events#{public_events}", params)
139
+ return response unless block_given?
140
+ response.each { |el| yield el }
141
+ end
142
+ alias :user_received :received
143
+ alias :list_user_received :received
144
+
145
+ # List all events that a user has performed
146
+ #
147
+ # If you are authenticated as the given user, you will see your private
148
+ # events. Otherwise, you’ll only see public events.
149
+ #
150
+ # = Examples
151
+ # @github = Github.new
152
+ # @github.events.performed 'user-name'
153
+ # @github.events.performed 'user-name' { |event| ... }
154
+ #
155
+ # List all public events that a user has performed
156
+ #
157
+ # = Examples
158
+ # @github = Github.new
159
+ # @github.events.performed 'user-name', :public => true
160
+ # @github.events.performed 'user-name', :public => true { |event| ... }
161
+ #
162
+ def performed(user_name, params={})
163
+ _validate_presence_of user_name
164
+ _normalize_params_keys(params)
165
+
166
+ public_events = if params['public']
167
+ params.delete('public')
168
+ '/public'
169
+ end
170
+
171
+ response = get("/users/#{user_name}/events#{public_events}", params)
172
+ return response unless block_given?
173
+ response.each { |el| yield el }
174
+ end
175
+ alias :user_performed :performed
176
+ alias :list_user_performed :performed
177
+
178
+ # List all events for an organization
179
+ #
180
+ # This is the user’s organization dashboard. You must be authenticated
181
+ # as the user to view this.
182
+ #
183
+ # = Examples
184
+ # @github = Github.new
185
+ # @github.events.user_org 'user-name', 'org-name'
186
+ # @github.events.user_org 'user-name', 'org-name' { |event| ... }
187
+ #
188
+ def user_org(user_name, org_name, params={})
189
+ _validate_presence_of user_name, org_name
190
+ _normalize_params_keys(params)
191
+
192
+ response = get("/users/#{user_name}/events/orgs/#{org_name}", params)
193
+ return response unless block_given?
194
+ response.each { |el| yield el }
195
+ end
196
+ alias :user_organization :user_org
197
+ alias :list_user_org :user_org
198
+ alias :list_user_org_events :user_org
199
+ alias :list_user_organization_events :user_org
200
+
201
+ end # Events
202
+ end # Github