class Remindrr::App

Attributes

created_at[RW]
endpoint[RW]
id[RW]
name[RW]
updated_at[RW]

Public Class Methods

all() click to toggle source
# File lib/remindrr/app.rb, line 13
def self.all
  apps = get('v1/apps')
  apps.map { |app| new app }
end
create(opts) click to toggle source
# File lib/remindrr/app.rb, line 23
def self.create(opts)
  params = {
    name:     opts[:name],
    endpoint: opts[:endpoint]
  }

  app = post('v1/apps', params)
  new app
end
find(id) click to toggle source
# File lib/remindrr/app.rb, line 18
def self.find(id)
  app = get("v1/apps/#{id}")
  new app
end
new(attrs) click to toggle source
# File lib/remindrr/app.rb, line 7
def initialize(attrs)
  attrs.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
end

Public Instance Methods

destroy() click to toggle source
# File lib/remindrr/app.rb, line 44
def destroy
  delete("v1/apps/#{self.id}")
end
save() click to toggle source
# File lib/remindrr/app.rb, line 33
def save
  params = {
    id:       self.id,
    name:     self.name,
    endpoint: self.endpoint
  }

  put("v1/apps/#{self.id}", params)
  self
end