github_api 0.15.0 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +770 -0
  3. data/README.md +25 -8
  4. data/lib/github_api.rb +37 -76
  5. data/lib/github_api/api.rb +46 -19
  6. data/lib/github_api/api/arguments.rb +6 -1
  7. data/lib/github_api/api/config.rb +3 -5
  8. data/lib/github_api/api/config/property_set.rb +1 -0
  9. data/lib/github_api/authorization.rb +2 -0
  10. data/lib/github_api/client.rb +5 -0
  11. data/lib/github_api/client/activity.rb +2 -0
  12. data/lib/github_api/client/activity/events.rb +2 -0
  13. data/lib/github_api/client/activity/feeds.rb +2 -0
  14. data/lib/github_api/client/activity/notifications.rb +2 -0
  15. data/lib/github_api/client/activity/starring.rb +3 -1
  16. data/lib/github_api/client/activity/watching.rb +3 -1
  17. data/lib/github_api/client/authorizations.rb +2 -0
  18. data/lib/github_api/client/authorizations/app.rb +3 -1
  19. data/lib/github_api/client/emojis.rb +2 -0
  20. data/lib/github_api/client/gists.rb +4 -2
  21. data/lib/github_api/client/gists/comments.rb +3 -1
  22. data/lib/github_api/client/git_data.rb +2 -0
  23. data/lib/github_api/client/git_data/blobs.rb +2 -1
  24. data/lib/github_api/client/git_data/commits.rb +2 -0
  25. data/lib/github_api/client/git_data/references.rb +6 -2
  26. data/lib/github_api/client/git_data/tags.rb +2 -0
  27. data/lib/github_api/client/git_data/trees.rb +2 -0
  28. data/lib/github_api/client/gitignore.rb +2 -0
  29. data/lib/github_api/client/issues.rb +2 -0
  30. data/lib/github_api/client/issues/assignees.rb +35 -0
  31. data/lib/github_api/client/issues/comments.rb +2 -0
  32. data/lib/github_api/client/issues/events.rb +2 -0
  33. data/lib/github_api/client/issues/labels.rb +2 -0
  34. data/lib/github_api/client/issues/milestones.rb +2 -0
  35. data/lib/github_api/client/markdown.rb +4 -2
  36. data/lib/github_api/client/meta.rb +2 -0
  37. data/lib/github_api/client/orgs.rb +6 -0
  38. data/lib/github_api/client/orgs/hooks.rb +2 -0
  39. data/lib/github_api/client/orgs/members.rb +2 -0
  40. data/lib/github_api/client/orgs/memberships.rb +2 -0
  41. data/lib/github_api/client/orgs/projects.rb +57 -0
  42. data/lib/github_api/client/orgs/teams.rb +5 -3
  43. data/lib/github_api/client/projects.rb +83 -0
  44. data/lib/github_api/client/projects/cards.rb +158 -0
  45. data/lib/github_api/client/projects/columns.rb +146 -0
  46. data/lib/github_api/client/pull_requests.rb +2 -0
  47. data/lib/github_api/client/pull_requests/comments.rb +2 -0
  48. data/lib/github_api/client/pull_requests/reviews.rb +2 -0
  49. data/lib/github_api/client/repos.rb +27 -15
  50. data/lib/github_api/client/repos/branches.rb +48 -0
  51. data/lib/github_api/client/repos/branches/protections.rb +75 -0
  52. data/lib/github_api/client/repos/collaborators.rb +2 -1
  53. data/lib/github_api/client/repos/comments.rb +2 -1
  54. data/lib/github_api/client/repos/commits.rb +2 -0
  55. data/lib/github_api/client/repos/contents.rb +26 -4
  56. data/lib/github_api/client/repos/deployments.rb +3 -1
  57. data/lib/github_api/client/repos/downloads.rb +2 -0
  58. data/lib/github_api/client/repos/forks.rb +6 -2
  59. data/lib/github_api/client/repos/hooks.rb +2 -0
  60. data/lib/github_api/client/repos/invitations.rb +41 -0
  61. data/lib/github_api/client/repos/keys.rb +2 -0
  62. data/lib/github_api/client/repos/merging.rb +2 -0
  63. data/lib/github_api/client/repos/pages.rb +2 -0
  64. data/lib/github_api/client/repos/projects.rb +62 -0
  65. data/lib/github_api/client/repos/pub_sub_hubbub.rb +6 -6
  66. data/lib/github_api/client/repos/releases.rb +2 -0
  67. data/lib/github_api/client/repos/releases/assets.rb +3 -1
  68. data/lib/github_api/client/repos/releases/tags.rb +2 -0
  69. data/lib/github_api/client/repos/statistics.rb +2 -0
  70. data/lib/github_api/client/repos/statuses.rb +2 -0
  71. data/lib/github_api/client/say.rb +2 -0
  72. data/lib/github_api/client/scopes.rb +2 -0
  73. data/lib/github_api/client/search.rb +3 -0
  74. data/lib/github_api/client/search/legacy.rb +2 -0
  75. data/lib/github_api/client/users.rb +2 -0
  76. data/lib/github_api/client/users/emails.rb +3 -0
  77. data/lib/github_api/client/users/followers.rb +3 -1
  78. data/lib/github_api/client/users/keys.rb +2 -0
  79. data/lib/github_api/configuration.rb +4 -1
  80. data/lib/github_api/connection.rb +5 -1
  81. data/lib/github_api/error.rb +1 -4
  82. data/lib/github_api/error/client_error.rb +4 -2
  83. data/lib/github_api/error/service_error.rb +9 -2
  84. data/lib/github_api/ext/faraday.rb +3 -1
  85. data/lib/github_api/mash.rb +7 -0
  86. data/lib/github_api/middleware.rb +8 -6
  87. data/lib/github_api/normalizer.rb +3 -5
  88. data/lib/github_api/page_iterator.rb +4 -1
  89. data/lib/github_api/page_links.rb +4 -0
  90. data/lib/github_api/paged_request.rb +2 -0
  91. data/lib/github_api/pagination.rb +10 -7
  92. data/lib/github_api/parameter_filter.rb +4 -1
  93. data/lib/github_api/params_hash.rb +4 -4
  94. data/lib/github_api/request.rb +8 -9
  95. data/lib/github_api/request/basic_auth.rb +1 -1
  96. data/lib/github_api/request/jsonize.rb +0 -1
  97. data/lib/github_api/request/oauth2.rb +2 -0
  98. data/lib/github_api/request/verbs.rb +3 -0
  99. data/lib/github_api/response/follow_redirects.rb +140 -0
  100. data/lib/github_api/response/header.rb +6 -1
  101. data/lib/github_api/response/mashify.rb +2 -3
  102. data/lib/github_api/response/raise_error.rb +2 -1
  103. data/lib/github_api/response_wrapper.rb +5 -0
  104. data/lib/github_api/utils/url.rb +2 -0
  105. data/lib/github_api/validations.rb +5 -8
  106. data/lib/github_api/validations/format.rb +2 -0
  107. data/lib/github_api/validations/presence.rb +3 -1
  108. data/lib/github_api/validations/required.rb +2 -0
  109. data/lib/github_api/version.rb +2 -2
  110. metadata +100 -36
  111. data/lib/github_api/core_ext/ordered_hash.rb +0 -107
  112. data/lib/github_api/requestable.rb +0 -67
  113. data/lib/github_api/resource.rb +0 -13
@@ -1,107 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Github
4
- module CoreExt #:nodoc:
5
-
6
- if RUBY_VERSION >= '1.9'
7
- class OrderedHash < ::Hash; end
8
- else
9
- class OrderedHash < ::Hash
10
- attr_accessor :order
11
-
12
- class << self
13
- def [](*args)
14
- hsh = OrderedHash.new
15
- if Hash == args[0]
16
- hsh.replace args[0]
17
- elsif (args.size % 2) != 0
18
- pp args if ENV['DEBUG']
19
- raise ArgumentError, "odd number of elements for Hash"
20
- else
21
- 0.step(args.size - 1, 2) do |a|
22
- b = a + 1
23
- hsh[args[a]] = args[b]
24
- end
25
- end
26
- hsh
27
- end
28
- end
29
-
30
- def initialize(*args, &block)
31
- super
32
- @order = []
33
- end
34
-
35
- def []=(key, value)
36
- @order.push key unless member?(key)
37
- super key, value
38
- end
39
-
40
- def ==(hsh2)
41
- return false if @order != hsh2.order
42
- super hsh2
43
- end
44
-
45
- def clear
46
- @order = []
47
- super
48
- end
49
-
50
- def delete(key)
51
- @order.delete key
52
- super
53
- end
54
-
55
- def each_key
56
- @order.each { |k| yield k }
57
- self
58
- end
59
-
60
- def each_value
61
- @order.each { |k| yield self[k] }
62
- self
63
- end
64
-
65
- def each
66
- @order.each { |k| yield k, self[k] }
67
- self
68
- end
69
- alias :each_pair :each
70
-
71
- def delete_if
72
- @order.clone.each { |k| delete k if yield }
73
- self
74
- end
75
-
76
- def values
77
- ary = []
78
- @order.each { |k| ary.push self[k] }
79
- ary
80
- end
81
-
82
- def keys
83
- @order
84
- end
85
-
86
- def replace(hsh2)
87
- @order = hsh2.keys
88
- super hsh2
89
- end
90
-
91
- def shift
92
- key = @order.first
93
- key ? [key, delete(key)] : super
94
- end
95
-
96
- def class
97
- Hash
98
- end
99
-
100
- def __class__
101
- OrderedHash
102
- end
103
- end # OrderedHash
104
- end
105
-
106
- end # CoreExt
107
- end # Github
@@ -1,67 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Github
4
- # Defines HTTP verbs
5
- module Request
6
-
7
- METHODS = [:get, :post, :put, :delete, :patch]
8
- METHODS_WITH_BODIES = [ :post, :put, :patch ]
9
-
10
- def get_request(path, params={}, options={})
11
- request(:get, path, params, options)
12
- end
13
-
14
- def patch_request(path, params={}, options={})
15
- request(:patch, path, params, options)
16
- end
17
-
18
- def post_request(path, params={}, options={})
19
- request(:post, path, params, options)
20
- end
21
-
22
- def put_request(path, params={}, options={})
23
- request(:put, path, params, options)
24
- end
25
-
26
- def delete_request(path, params={}, options={})
27
- request(:delete, path, params, options)
28
- end
29
-
30
- def request(method, path, params, options)
31
- if !METHODS.include?(method)
32
- raise ArgumentError, "unkown http method: #{method}"
33
- end
34
- # _extract_mime_type(params, options)
35
-
36
- puts "EXECUTED: #{method} - #{path} with #{params} and #{options}" if ENV['DEBUG']
37
-
38
- conn = connection(options)
39
- path = (conn.path_prefix + path).gsub(/\/\//,'/') if conn.path_prefix != '/'
40
-
41
- response = conn.send(method) do |request|
42
- case method.to_sym
43
- when *(METHODS - METHODS_WITH_BODIES)
44
- request.body = params.delete('data') if params.has_key?('data')
45
- request.url(path, params)
46
- when *METHODS_WITH_BODIES
47
- request.path = path
48
- request.body = extract_data_from_params(params) unless params.empty?
49
- end
50
- end
51
- response.body
52
- end
53
-
54
- private
55
-
56
- def extract_data_from_params(params) # :nodoc:
57
- return params['data'] if params.has_key?('data') and !params['data'].nil?
58
- return params
59
- end
60
-
61
- def _extract_mime_type(params, options) # :nodoc:
62
- options['resource'] = params['resource'] ? params.delete('resource') : ''
63
- options['mime_type'] = params['resource'] ? params.delete('mime_type') : ''
64
- end
65
-
66
- end # Request
67
- end # Github
@@ -1,13 +0,0 @@
1
-
2
- module Github
3
-
4
- class Resource < API
5
-
6
- def call(*args)
7
- method = args.shift
8
- template =
9
- response = request(method, )
10
-
11
- end
12
- end
13
- end