Class: TalkboxApi::Sections
- Inherits:
-
Object
- Object
- TalkboxApi::Sections
- Defined in:
- lib/talkbox_api/sections.rb
Overview
Sections resource class This class provides methods for interacting with the Talkbox API sections resource.
Instance Method Summary collapse
-
#all ⇒ Array
Retrieves all sections.
-
#create(params) ⇒ Hash
Creates a new section.
-
#delete(id) ⇒ Hash
Deletes a section.
-
#get(id) ⇒ Hash
Retrieves a specific section.
-
#initialize(conn) ⇒ Sections
constructor
A new instance of Sections.
-
#update(id, params) ⇒ Hash
Updates an existing section.
Constructor Details
#initialize(conn) ⇒ Sections
Returns a new instance of Sections.
7 8 9 |
# File 'lib/talkbox_api/sections.rb', line 7 def initialize(conn) @conn = conn end |
Instance Method Details
#all ⇒ Array
Retrieves all sections
13 14 15 |
# File 'lib/talkbox_api/sections.rb', line 13 def all @conn.get("#{PATH_PREFIX}/sections").body end |
#create(params) ⇒ Hash
Creates a new section
27 28 29 |
# File 'lib/talkbox_api/sections.rb', line 27 def create(params) @conn.post("#{PATH_PREFIX}/sections", params.to_json, { "Content-Type" => "application/json" }).body end |
#delete(id) ⇒ Hash
Deletes a section
42 43 44 |
# File 'lib/talkbox_api/sections.rb', line 42 def delete(id) @conn.delete("#{PATH_PREFIX}/sections/#{id}").body end |
#get(id) ⇒ Hash
Retrieves a specific section
20 21 22 |
# File 'lib/talkbox_api/sections.rb', line 20 def get(id) @conn.get("#{PATH_PREFIX}/sections/#{id}").body end |
#update(id, params) ⇒ Hash
Updates an existing section
35 36 37 |
# File 'lib/talkbox_api/sections.rb', line 35 def update(id, params) @conn.put("#{PATH_PREFIX}/sections/#{id}", params.to_json, { "Content-Type" => "application/json" }).body end |