Class: Spage::Api::Page

Inherits:
Object
  • Object
show all
Includes:
Spage::Api
Defined in:
lib/spage/api/page.rb

Overview

Page resources in the statuspage.io API

Instance Method Summary collapse

Methods included from Spage::Api

#client

Instance Method Details

#allObject



12
13
14
15
16
17
18
19
20
# File 'lib/spage/api/page.rb', line 12

def all
  response = client.get(:pages)

  handle_response(response) do
    response.body.map do |page|
      Spage::Page.new(page)
    end
  end
end

#find(id) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/spage/api/page.rb', line 22

def find(id)
  response = client.get(:pages, id)

  handle_response(response) do
    Spage::Page.new(response.body)
  end
end

#update(id, page) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/spage/api/page.rb', line 30

def update(id, page)
  json = Spage::Serializers::Page.new(page, update: true).to_json
  response = client.put(:pages, id, json)

  handle_response(response) do
    Spage::Page.new(response.body)
  end
end