Class: Tinycms::Blogs::Api

Inherits:
Tinycms::BaseApi show all
Defined in:
lib/tinycms/blogs/api.rb

Class Method Summary collapse

Methods inherited from Tinycms::BaseApi

client

Class Method Details

.get(blog_id) ⇒ Object



18
19
20
21
22
23
# File 'lib/tinycms/blogs/api.rb', line 18

def self.get(blog_id)
  Retriable.retriable do
    response = client.get("/api/blogs/#{blog_id}")
    Tinycms::Blogs::Mapper.map(response.body)
  end
end

.get_allObject



8
9
10
11
12
13
14
15
16
# File 'lib/tinycms/blogs/api.rb', line 8

def self.get_all
  Retriable.retriable do
    response = client.get("/api/blogs")
    blogs = response.body
    blogs.map do |blog_response|
      Tinycms::Blogs::Mapper.map(blog_response)
    end
  end
end