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,100 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative '../../api'
4
+
5
+ module Github
6
+ class Client::Gists::Comments < API
7
+ # List comments on a gist
8
+ #
9
+ # @see https://developer.github.com/v3/gists/comments/#list-comments-on-a-gist
10
+ #
11
+ # @example
12
+ # github = Github.new
13
+ # github.gists.comments.list 'gist-id'
14
+ #
15
+ # @return [Hash]
16
+ #
17
+ # @api public
18
+ def list(*args)
19
+ arguments(args, required: [:gist_id])
20
+
21
+ response = get_request("/gists/#{arguments.gist_id}/comments",
22
+ arguments.params)
23
+ return response unless block_given?
24
+ response.each { |el| yield el }
25
+ end
26
+ alias_method :all, :list
27
+
28
+ # Get a single comment
29
+ #
30
+ # @see https://developer.github.com/v3/gists/comments/#get-a-single-comment
31
+ #
32
+ # @example
33
+ # github = Github.new
34
+ # github.gists.comments.get 'gist-id', 'comment-id'
35
+ #
36
+ # @api public
37
+ def get(*args)
38
+ arguments(args, required: [:gist_id, :id])
39
+
40
+ get_request("/gists/#{arguments.gist_id}/comments/#{arguments.id}",
41
+ arguments.params)
42
+ end
43
+ alias_method :find, :get
44
+
45
+ # Create a comment
46
+ #
47
+ # @see https://developer.github.com/v3/gists/comments/#create-a-comment
48
+ #
49
+ # @param [Hash] params
50
+ # @option params [String] :body
51
+ # Required. The comment text.
52
+ #
53
+ # @example
54
+ # github = Github.new
55
+ # github.gists.comments.create 'gist-id'
56
+ #
57
+ # @api public
58
+ def create(*args)
59
+ arguments(args, required: [:gist_id])
60
+
61
+ post_request("/gists/#{arguments.gist_id}/comments", arguments.params)
62
+ end
63
+
64
+ # Edit a comment
65
+ #
66
+ # @see https://developer.github.com/v3/gists/comments/#edit-a-comment
67
+ #
68
+ # @param [Hash] params
69
+ # @option params [String] :body
70
+ # Required. The comment text.
71
+ #
72
+ # @example
73
+ # github = Github.new
74
+ # github.gists.comments.edit 'gist-id', 'comment-id'
75
+ #
76
+ # @api public
77
+ def edit(*args)
78
+ arguments(args, required: [:gist_id, :id])
79
+
80
+ patch_request("/gists/#{arguments.gist_id}/comments/#{arguments.id}",
81
+ arguments.params)
82
+ end
83
+
84
+ # Delete a comment
85
+ #
86
+ # @see https://developer.github.com/v3/gists/comments/#delete-a-comment
87
+ #
88
+ # @xample
89
+ # github = Github.new
90
+ # github.gists.comments.delete 'gist-id', 'comment-id'
91
+ #
92
+ # @api public
93
+ def delete(*args)
94
+ arguments(args, required: [:gist_id, :id])
95
+
96
+ delete_request("/gists/#{arguments.gist_id}/comments/#{arguments.id}",
97
+ arguments.params)
98
+ end
99
+ end # Gists::Comments
100
+ end # Github
@@ -0,0 +1,31 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative '../api'
4
+
5
+ module Github
6
+ class Client::GitData < API
7
+
8
+ require_all 'github_api/client/git_data',
9
+ 'blobs',
10
+ 'commits',
11
+ 'references',
12
+ 'tags',
13
+ 'trees'
14
+
15
+ # Access to GitData::Blobs API
16
+ namespace :blobs
17
+
18
+ # Access to GitData::Commits API
19
+ namespace :commits
20
+
21
+ # Access to GitData::References API
22
+ namespace :references
23
+
24
+ # Access to GitData::Tags API
25
+ namespace :tags
26
+
27
+ # Access to GitData::Tags API
28
+ namespace :trees
29
+
30
+ end # GitData
31
+ end # Github
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative '../../api'
4
+
5
+ module Github
6
+ # Since blobs can be any arbitrary binary data, the input and responses for
7
+ # the blob api takes an encoding parameter that can be either utf-8 or base64.
8
+ # If your data cannot be losslessly sent as a UTF-8 string, you can base64 encode it.
9
+ class Client::GitData::Blobs < API
10
+
11
+ VALID_BLOB_PARAM_NAMES = %w[ content encoding ].freeze
12
+
13
+ # Get a blob
14
+ #
15
+ # @example
16
+ # github = Github.new
17
+ # github.git_data.blobs.get 'user-name', 'repo-name', 'sha'
18
+ #
19
+ # @api public
20
+ def get(*args)
21
+ arguments(args, required: [:user, :repo, :sha])
22
+
23
+ get_request("/repos/#{arguments.user}/#{arguments.repo}/git/blobs/#{arguments.sha}", arguments.params)
24
+ end
25
+ alias :find :get
26
+
27
+ # Create a blob
28
+ #
29
+ # @param [Hash] params
30
+ # @input params [String] :content
31
+ # String of content.
32
+ # @input params [String] :encoding
33
+ # String containing encoding<tt>utf-8</tt> or <tt>base64</tt>
34
+ #
35
+ # @examples
36
+ # github = Github.new
37
+ # github.git_data.blobs.create 'user-name', 'repo-name',
38
+ # content: "Content of the blob",
39
+ # encoding: "utf-8"
40
+ #
41
+ # @api public
42
+ def create(*args)
43
+ arguments(args, required: [:user, :repo]) do
44
+ permit VALID_BLOB_PARAM_NAMES
45
+ assert_required VALID_BLOB_PARAM_NAMES
46
+ end
47
+
48
+ post_request("/repos/#{arguments.user}/#{arguments.repo}/git/blobs", arguments.params)
49
+ end
50
+ end # GitData::Blobs
51
+ end # Github
@@ -0,0 +1,101 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative '../../api'
4
+
5
+ module Github
6
+ class Client::GitData::Commits < API
7
+
8
+ VALID_COMMIT_PARAM_NAMES = %w[
9
+ message
10
+ tree
11
+ parents
12
+ author
13
+ committer
14
+ name
15
+ email
16
+ date
17
+ ].freeze
18
+
19
+ REQUIRED_COMMIT_PARAMS = %w[
20
+ message
21
+ tree
22
+ parents
23
+ ].freeze
24
+
25
+ # Get a commit
26
+ #
27
+ # @example
28
+ # github = Github.new
29
+ # github.git_data.commits.get 'user-name', 'repo-name', 'sha'
30
+ #
31
+ # @example
32
+ # commits = Github::Commits.new user: 'user-name', repo: 'repo-name'
33
+ # commits.get sha: '...'
34
+ #
35
+ # @api public
36
+ def get(*args)
37
+ arguments(args, required: [:user, :repo, :sha])
38
+ params = arguments.params
39
+
40
+ get_request("/repos/#{arguments.user}/#{arguments.repo}/git/commits/#{arguments.sha}", params)
41
+ end
42
+ alias :find :get
43
+
44
+ # Create a commit
45
+ #
46
+ # @param [Hash] params
47
+ # @input params [String] :message
48
+ # The commit message
49
+ # @input params [String] :tree
50
+ # String of the SHA of the tree object this commit points to
51
+ # @input params [Array[String]] :parents
52
+ # Array of the SHAs of the commits that were the parents of this commit.
53
+ # If omitted or empty, the commit will be written as a root commit.
54
+ # For a single parent, an array of one SHA should be provided,
55
+ # for a merge commit, an array of more than one should be provided.
56
+ #
57
+ # Optional Parameters
58
+ #
59
+ # You can provide an additional commiter parameter, which is a hash
60
+ # containing information about the committer. Or, you can provide an author
61
+ # parameter, which is a hash containing information about the author.
62
+ #
63
+ # The committer section is optional and will be filled with the author
64
+ # data if omitted. If the author section is omitted, it will be filled
65
+ # in with the authenticated users information and the current date.
66
+ #
67
+ # Both the author and commiter parameters have the same keys:
68
+ #
69
+ # @input params [String] :name
70
+ # String of the name of the author (or commiter) of the commit
71
+ # @input params [String] :email
72
+ # String of the email of the author (or commiter) of the commit
73
+ # @input params [Timestamp] :date
74
+ # Indicates when this commit was authored (or committed).
75
+ # This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
76
+ #
77
+ # @example
78
+ # github = Github.new
79
+ # github.git_data.commits.create 'user-name', 'repo-name',
80
+ # message: "my commit message",
81
+ # author: {
82
+ # name: "Scott Chacon",
83
+ # email: "schacon@gmail.com",
84
+ # date: "2008-07-09T16:13:30+12:00"
85
+ # },
86
+ # parents: [
87
+ # "7d1b31e74ee336d15cbd21741bc88a537ed063a0"
88
+ # ],
89
+ # tree: "827efc6d56897b048c772eb4087f854f46256132"]
90
+ #
91
+ # @api public
92
+ def create(*args)
93
+ arguments(args, required: [:user, :repo]) do
94
+ permit VALID_COMMIT_PARAM_NAMES
95
+ assert_required REQUIRED_COMMIT_PARAMS
96
+ end
97
+
98
+ post_request("/repos/#{arguments.user}/#{arguments.repo}/git/commits", arguments.params)
99
+ end
100
+ end # GitData::Commits
101
+ end # Github
@@ -0,0 +1,150 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative '../../api'
4
+
5
+ module Github
6
+ class Client::GitData::References < API
7
+
8
+ VALID_REF_PARAM_NAMES = %w[ ref sha force ].freeze
9
+
10
+ REQUIRED_REF_PARAMS = %w[ ref sha ].freeze
11
+
12
+ VALID_REF_PARAM_VALUES = {
13
+ 'ref' => %r{^refs\/\w+(\/\w+)*} # test fully qualified reference
14
+ }
15
+
16
+ # Get all references
17
+ #
18
+ # This will return an array of all the references on the system,
19
+ # including things like notes and stashes if they exist on the server.
20
+ # Anything in the namespace, not just <tt>heads</tt> and <tt>tags</tt>,
21
+ # though that would be the most common.
22
+ #
23
+ # @example
24
+ # github = Github.new
25
+ # github.git_data.references.list 'user-name', 'repo-name'
26
+ #
27
+ # @example
28
+ # github.git_data.references.list 'user-name', 'repo-name', ref:'tags'
29
+ #
30
+ # @api public
31
+ def list(*args)
32
+ arguments(args, required: [:user, :repo])
33
+ params = arguments.params
34
+ user = arguments.user
35
+ repo = arguments.repo
36
+
37
+ response = if (ref = params.delete('ref'))
38
+ formatted_ref = validate_reference ref
39
+ get_request("/repos/#{user}/#{repo}/git/#{formatted_ref}", params)
40
+ else
41
+ get_request("/repos/#{user}/#{repo}/git/refs", params)
42
+ end
43
+ return response unless block_given?
44
+ response.each { |el| yield el }
45
+ end
46
+ alias :all :list
47
+
48
+ # Get a reference
49
+ #
50
+ # The ref in the URL must be formatted as <tt>heads/branch</tt>,
51
+ # not just branch. For example, the call to get the data for a
52
+ # branch named sc/featureA would be formatted as heads/sc/featureA
53
+ #
54
+ # @example
55
+ # github = Github.new
56
+ # github.git_data.references.get 'user-name', 'repo-name', 'heads/branch'
57
+ #
58
+ # @api public
59
+ def get(*args)
60
+ arguments(args, required: [:user, :repo, :ref])
61
+ validate_reference arguments.ref
62
+ params = arguments.params
63
+
64
+ get_request("/repos/#{arguments.user}/#{arguments.repo}/git/refs/#{arguments.ref}", params)
65
+ end
66
+ alias :find :get
67
+
68
+ # Create a reference
69
+ #
70
+ # @param [Hash] params
71
+ # @input params [String] :ref
72
+ # The name of the fully qualified reference (ie: refs/heads/master).
73
+ # If it doesn’t start with ‘refs’ and have at least two slashes,
74
+ # it will be rejected.
75
+ # @input params [String] :sha
76
+ # The SHA1 value to set this reference to
77
+ #
78
+ # @example
79
+ # github = Github.new
80
+ # github.git_data.references.create 'user-name', 'repo-name',
81
+ # ref: "refs/heads/master",
82
+ # sha: "827efc6d56897b048c772eb4087f854f46256132"
83
+ #
84
+ # @api public
85
+ def create(*args)
86
+ arguments(args, required: [:user, :repo]) do
87
+ permit VALID_REF_PARAM_NAMES
88
+ assert_required REQUIRED_REF_PARAMS
89
+ end
90
+ params = arguments.params
91
+ validate_reference params['ref']
92
+
93
+ post_request("/repos/#{arguments.user}/#{arguments.repo}/git/refs", params)
94
+ end
95
+
96
+ # Update a reference
97
+ #
98
+ # @param [Hash] params
99
+ # @input params [String] :sha
100
+ # The SHA1 value to set this reference to
101
+ # @input params [Boolean] :force
102
+ # Indicates whether to force the update or to make sure the update
103
+ # is a fast-forward update. Leaving this out or setting it to false
104
+ # will make sure you’re not overwriting work. Default: false
105
+ #
106
+ # @example
107
+ # github = Github.new
108
+ # github.git_data.references.update 'user-name', 'repo-name', 'heads/master',
109
+ # sha: "827efc6d56897b048c772eb4087f854f46256132",
110
+ # force: true
111
+ #
112
+ # @api public
113
+ def update(*args)
114
+ arguments(args, required: [:user, :repo, :ref]) do
115
+ permit VALID_REF_PARAM_NAMES
116
+ assert_required %w[ sha ]
117
+ end
118
+
119
+ patch_request("/repos/#{arguments.user}/#{arguments.repo}/git/refs/#{arguments.ref}", arguments.params)
120
+ end
121
+
122
+ # Delete a reference
123
+ #
124
+ # @example
125
+ # github = Github.new
126
+ # github.git_data.references.delete 'user-name', 'repo-name',
127
+ # "heads/master"
128
+ #
129
+ # @api public
130
+ def delete(*args)
131
+ arguments(args, required: [:user, :repo, :ref])
132
+ params = arguments.params
133
+
134
+ delete_request("/repos/#{arguments.user}/#{arguments.repo}/git/refs/#{arguments.ref}", params)
135
+ end
136
+ alias :remove :delete
137
+
138
+ private
139
+
140
+ def validate_reference(ref)
141
+ refs = (ref =~ (/^(\/)?refs.*/) ? ref : "refs/#{ref}").gsub(/(\/)+/, '/')
142
+ refs.gsub!(/^\//, '')
143
+ unless VALID_REF_PARAM_VALUES['ref'] =~ refs
144
+ raise ArgumentError, "Provided 'reference' is invalid"
145
+ end
146
+
147
+ refs
148
+ end
149
+ end # GitData::References
150
+ end # Github
@@ -0,0 +1,95 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative '../../api'
4
+
5
+ module Github
6
+ class Client::GitData::Tags < API
7
+ # This tags api only deals with tag objects -
8
+ # so only annotated tags, not lightweight tags.
9
+ # Refer https://developer.github.com/v3/git/tags/#parameters
10
+
11
+ VALID_TAG_PARAM_NAMES = %w[
12
+ tag
13
+ message
14
+ object
15
+ type
16
+ name
17
+ email
18
+ date
19
+ tagger
20
+ ].freeze
21
+
22
+ VALID_TAG_PARAM_VALUES = {
23
+ 'type' => %w[ blob tree commit ]
24
+ }
25
+
26
+ # Get a tag
27
+ #
28
+ # @example
29
+ # github = Github.new
30
+ # github.git_data.tags.get 'user-name', 'repo-name', 'sha'
31
+ #
32
+ # @api public
33
+ def get(*args)
34
+ arguments(args, required: [:user, :repo, :sha])
35
+ params = arguments.params
36
+
37
+ get_request("/repos/#{arguments.user}/#{arguments.repo}/git/tags/#{arguments.sha}", params)
38
+ end
39
+ alias :find :get
40
+
41
+ # Create a tag object
42
+ #
43
+ # Note that creating a tag object does not create the reference that
44
+ # makes a tag in Git. If you want to create an annotated tag in Git,
45
+ # you have to do this call to create the tag object, and then create
46
+ # the refs/tags/[tag] reference. If you want to create a lightweight
47
+ # tag, you simply have to create the reference -
48
+ # this call would be unnecessary.
49
+ #
50
+ # @param [Hash] params
51
+ # @input params [String] :tag
52
+ # The tag
53
+ # @input params [String] :message
54
+ # The tag message
55
+ # @input params [String] :object
56
+ # The SHA of the git object this is tagging
57
+ # @input params [String] :type
58
+ # The type of the object we're tagging.
59
+ # Normally this is a commit but it can also be a tree or a blob
60
+ # @input params [Hash] :tagger
61
+ # A hash with information about the individual creating the tag.
62
+ #
63
+ # The tagger hash contains the following keys:
64
+ # @input tagger [String] :name
65
+ # The name of the author of the tag
66
+ # @input tagger [String] :email
67
+ # The email of the author of the tag
68
+ # @input tagger [String] :date
69
+ # When this object was tagged. This is a timestamp in ISO 8601
70
+ # format: YYYY-MM-DDTHH:MM:SSZ.
71
+ #
72
+ # @xample
73
+ # github = Github.new
74
+ # github.git_data.tags.create 'user-name', 'repo-name',
75
+ # tag: "v0.0.1",
76
+ # message: "initial version\n",
77
+ # type: "commit",
78
+ # object: "c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c",
79
+ # tagger: {
80
+ # name: "Scott Chacon",
81
+ # email: "schacon@gmail.com",
82
+ # date: "2011-06-17T14:53:3"
83
+ # }
84
+ #
85
+ # @api public
86
+ def create(*args)
87
+ arguments(args, required: [:user, :repo]) do
88
+ permit VALID_TAG_PARAM_NAMES
89
+ assert_values VALID_TAG_PARAM_VALUES
90
+ end
91
+
92
+ post_request("/repos/#{arguments.user}/#{arguments.repo}/git/tags", arguments.params)
93
+ end
94
+ end # GitData::Tags
95
+ end # Github