module Deploygate::Api::Invite

Public Class Methods

add_members(owner_name, app_id, token, users, role = Role::DEVELOPER) click to toggle source
# File lib/deploygate/api/invite.rb, line 15
def add_members(owner_name, app_id, token, users, role = Role::DEVELOPER)
  params = {
    token: token,
    users: Array(users).join(","),
    role:  role,
  }
  response = connection.post(endpoint_path(owner_name, app_id), params)
  response.body
end
connection() click to toggle source
# File lib/deploygate/api/invite.rb, line 34
def connection
  Faraday.new(url: BASE_URL) do |faraday|
    faraday.request :url_encoded
    faraday.response :logger
    faraday.response :json
    faraday.adapter :net_http
  end
end
endpoint_path(owner_name, app_id) click to toggle source
# File lib/deploygate/api/invite.rb, line 43
def endpoint_path(owner_name, app_id)
  path = "/api/users/%<owner_name>s/apps/%<app_id>s/members" % {
    owner_name: owner_name,
    app_id: app_id,
  }
end
get_members(owner_name, app_id, token) click to toggle source
# File lib/deploygate/api/invite.rb, line 9
def get_members(owner_name, app_id, token)
  params = { token: token }
  response = connection.get(endpoint_path(owner_name, app_id), params)
  response.body
end
remove_members(owner_name, app_id, token, users) click to toggle source
# File lib/deploygate/api/invite.rb, line 25
def remove_members(owner_name, app_id, token, users)
  params = {
    token: token,
    users: Array(users).join(","),
  }
  response = connection.delete(endpoint_path(owner_name, app_id), params)
  response.body
end