class OneSignal::App

Public Class Methods

all(params: {}, opts: {}) click to toggle source
# File lib/one_signal/app.rb, line 5
def self.all(params: {}, opts: {})
  opts[:auth_key] ||= @@user_auth_key

  uri_string = @@base_uri
  uri_string += "/apps"
  uri = URI.parse(uri_string)

  response = send_get_request(uri: uri, params: params, opts: opts)

  ensure_http_status(response: response,
                     status: '200',
                     method_name: 'All',
                     uri: uri,
                     params: params)

  return response
end
create(params: {}, opts: {}) click to toggle source
# File lib/one_signal/app.rb, line 42
def self.create(params: {}, opts: {})
  opts[:auth_key] ||= @@user_auth_key

  uri_string = @@base_uri
  uri_string += "/apps"
  uri = URI.parse(uri_string)

  response = send_post_request(uri: uri, body: params, opts: opts)

  ensure_http_status(response: response,
                     status: '200',
                     method_name: 'Create',
                     uri: uri,
                     params: params)

  return response
end
get(id: "", opts: {}) click to toggle source
# File lib/one_signal/app.rb, line 23
def self.get(id: "", opts: {})
  opts[:auth_key] ||= @@user_auth_key

  uri_string = @@base_uri
  uri_string += "/apps"
  uri_string += "/#{id}"
  uri = URI.parse(uri_string)

  response = send_get_request(uri: uri, params: nil, opts: opts)

  ensure_http_status(response: response,
                     status: '200',
                     method_name: 'Get',
                     uri: uri,
                     params: nil)

  return response
end
update(id: "", params: {}, opts: {}) click to toggle source
# File lib/one_signal/app.rb, line 60
def self.update(id: "", params: {}, opts: {})
  opts[:auth_key] ||= @@user_auth_key

  uri_string = @@base_uri
  uri_string += "/apps"
  uri_string += "/#{id}"
  uri = URI.parse(uri_string)

  response = send_put_request(uri: uri, body: params, opts: opts)

  ensure_http_status(response: response,
                     status: '200',
                     method_name: 'Update',
                     uri: uri,
                     params: params)

  return response
end