Class: OneSignal::App

Inherits:
OneSignal show all
Defined in:
lib/one_signal/app.rb

Constant Summary

Constants included from OneSignal

VERSION

Class Method Summary collapse

Class Method Details

.all(params: {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/one_signal/app.rb', line 5

def self.all(params: {})
  uri_string = @@base_uri
  uri_string += "/apps"
  uri = URI.parse(uri_string)

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

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

  return response
end

.create(params: {}) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/one_signal/app.rb', line 38

def self.create(params: {})
  uri_string = @@base_uri
  uri_string += "/apps"
  uri = URI.parse(uri_string)

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

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

  return response
end

.get(id: "") ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/one_signal/app.rb', line 21

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

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

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

  return response
end

.update(id: "", params: {}) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/one_signal/app.rb', line 54

def self.update(id: "", params: {})
  uri_string = @@base_uri
  uri_string += "/apps"
  uri_string += "/#{id}"
  uri = URI.parse(uri_string)

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

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

  return response
end