-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Brice Sanchez
committed
Jun 21, 2016
1 parent
0bcafa8
commit c53b6ac
Showing
5 changed files
with
86 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
require "refinery/api/helpers/client_helper" | ||
|
||
module Refinery | ||
module API | ||
module Blog | ||
class Posts | ||
include Refinery::API::Helpers::ClientHelper | ||
|
||
def index | ||
config.connection.get(posts_path) | ||
end | ||
|
||
def show(id:) | ||
config.connection.get(posts_path(id)) | ||
end | ||
|
||
def create(post:) | ||
config.connection.post(posts_path) do |req| | ||
req.body = post.to_json | ||
end | ||
end | ||
|
||
def update(id:, post:) | ||
config.connection.put(posts_path(id)) do |req| | ||
req.body = post.to_json | ||
end | ||
end | ||
|
||
def destroy(id:) | ||
config.connection.delete(posts_path(id)) | ||
end | ||
|
||
private | ||
def posts_path(id = nil) | ||
path = api_path + "/posts" | ||
path << "/#{id}" if id | ||
path | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require "refinery/api/helpers/client_helper" | ||
|
||
module Refinery | ||
module API | ||
module Inquiries | ||
class Inquiries | ||
include Refinery::API::Helpers::ClientHelper | ||
|
||
def index | ||
config.connection.get(inquiries_path) | ||
end | ||
|
||
def show(id:) | ||
config.connection.get(inquiries_path(id)) | ||
end | ||
|
||
def create(post:) | ||
config.connection.post(inquiries_path) do |req| | ||
req.body = post.to_json | ||
end | ||
end | ||
|
||
def destroy(id:) | ||
config.connection.delete(inquiries_path(id)) | ||
end | ||
|
||
private | ||
def inquiries_path(id = nil) | ||
path = api_path + "/inquiries" | ||
path << "/#{id}" if id | ||
path | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters