Class: GithubReleaseParty::GitHub
- Inherits:
-
Object
- Object
- GithubReleaseParty::GitHub
- Defined in:
- lib/github-release-party.rb
Class Method Summary collapse
- .get(*args) ⇒ Object
- .patch(*args) ⇒ Object
- .post(*args) ⇒ Object
- .request(method, request_uri, body = nil) ⇒ Object
Class Method Details
.get(*args) ⇒ Object
88 89 90 |
# File 'lib/github-release-party.rb', line 88 def self.get(*args) request(:request_get, *args) end |
.patch(*args) ⇒ Object
96 97 98 |
# File 'lib/github-release-party.rb', line 96 def self.patch(*args) request(:patch, *args) end |
.post(*args) ⇒ Object
92 93 94 |
# File 'lib/github-release-party.rb', line 92 def self.post(*args) request(:request_post, *args) end |
.request(method, request_uri, body = nil) ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/github-release-party.rb', line 102 def self.request(method, request_uri, body=nil) opts = { use_ssl: true, open_timeout: 10, read_timeout: 10, } Net::HTTP.start("api.github.com", 443, opts) do |http| headers = { "Authorization" => "token #{ENV["GITHUB_RELEASE_TOKEN"]}", "User-Agent" => "github-release-party/#{GithubReleaseParty::VERSION}", } if method == :request_post or method == :patch response = http.send(method, request_uri, body, headers) else response = http.send(method, request_uri, headers) end return HTTPResponse.new(response, request_uri) end end |