class Moip2::NotificationsApi

Attributes

client[R]

Public Class Methods

new(client) click to toggle source
# File lib/moip2/notifications_api.rb, line 5
def initialize(client)
  @client = client
end

Public Instance Methods

base_path(app_id: nil, notification_id: nil) click to toggle source
# File lib/moip2/notifications_api.rb, line 9
def base_path(app_id: nil, notification_id: nil)
  ["", "v2", "preferences", app_id, "notifications", notification_id].compact.join("/")
end
create(notification, app_id = nil) click to toggle source
# File lib/moip2/notifications_api.rb, line 13
def create(notification, app_id = nil)
  Resource::Notification.new client, client.post(base_path(app_id: app_id), notification)
end
delete(notification_id) click to toggle source
# File lib/moip2/notifications_api.rb, line 25
def delete(notification_id)
  resp = Resource::Notification.new client, client.delete(
    base_path(notification_id: notification_id),
  )

  resp.success?
end
find_all() click to toggle source
# File lib/moip2/notifications_api.rb, line 21
def find_all
  Resource::Notification.new client, client.get(base_path)
end
show(notification_id) click to toggle source
# File lib/moip2/notifications_api.rb, line 17
def show(notification_id)
  Resource::Notification.new client, client.get(base_path(notification_id: notification_id))
end