Module: Deploygate::Api::Push
- Defined in:
- lib/deploygate/api/push.rb
Class Method Summary collapse
- .connection ⇒ Object
- .endpoint_path(owner_name) ⇒ Object
- .upload_file(owner_name, token, filepath, message = nil, distribution_key = nil, release_note = nil) ⇒ Object
Class Method Details
.connection ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/deploygate/api/push.rb', line 17 def connection Faraday.new(url: BASE_URL) do |faraday| faraday.request :multipart faraday.request :url_encoded faraday.response :logger faraday.response :json faraday.adapter :net_http end end |
.endpoint_path(owner_name) ⇒ Object
27 28 29 30 31 |
# File 'lib/deploygate/api/push.rb', line 27 def endpoint_path(owner_name) path = "/api/users/%<owner_name>s/apps" % { owner_name: owner_name, } end |
.upload_file(owner_name, token, filepath, message = nil, distribution_key = nil, release_note = nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/deploygate/api/push.rb', line 4 def upload_file(owner_name, token, filepath, = nil, distribution_key = nil, release_note = nil) params = { token: token, file: Faraday::UploadIO.new(filepath, "application/octet-stream"), message: , distribution_key: distribution_key, release_note: release_note, }.select {|k, v| v } response = connection.post(endpoint_path(owner_name), params) response.body end |