Class: SeismicAPI::Teamsites
- Inherits:
-
Object
- Object
- SeismicAPI::Teamsites
- Defined in:
- lib/seismic_api/teamsites.rb
Overview
Client for all endpoints related to teamsites
Defined Under Namespace
Classes: AllTestResponse
Instance Method Summary collapse
-
#add_folder(teamsiteId:, name:, parentFolderId: "root", **args) ⇒ SeismicAPI::Response
Create a folder in the teamsite.
-
#add_url(teamsiteId:, name:, url:, **args) ⇒ SeismicAPI::Response
Add a url as content.
-
#all ⇒ SeismicAPI::Response
Return all teamsites.
-
#find(id:) ⇒ SeismicAPI::Response
Find a specific teamsite.
-
#initialize(oauth_token:) ⇒ self
constructor
Initialize teamsites client.
-
#items(teamsiteId:, **query) ⇒ SeismicAPI::Response
Query for items.
-
#publish(teamsiteId:, content:, **args) ⇒ SeismicAPI::Response
Publish given library content.
-
#unpublish(teamsiteId:, libraryContentId:) ⇒ SeismicAPI::Response
Unpublish given library content.
- #update_url(teamsiteId:, contentId:, **args) ⇒ Object
Constructor Details
#initialize(oauth_token:) ⇒ self
Initialize teamsites client
18 19 20 21 |
# File 'lib/seismic_api/teamsites.rb', line 18 def initialize(oauth_token:) @oauth_token = oauth_token @base_url = SeismicAPI.config.base_url + "/teamsites" end |
Instance Method Details
#add_folder(teamsiteId:, name:, parentFolderId: "root", **args) ⇒ SeismicAPI::Response
Create a folder in the teamsite
52 53 54 55 56 57 |
# File 'lib/seismic_api/teamsites.rb', line 52 def add_folder(teamsiteId:, name:, parentFolderId: "root", **args) request.post( "#{teamsites_url}/#{teamsiteId}/folders", body: { name: name, parentFolderId: parentFolderId, **args } ) end |
#add_url(teamsiteId:, name:, url:, **args) ⇒ SeismicAPI::Response
Add a url as content
70 71 72 73 74 75 |
# File 'lib/seismic_api/teamsites.rb', line 70 def add_url(teamsiteId:, name:, url:, **args) request.post( "#{teamsites_url}/#{teamsiteId}/urls", body: { url: url, name: name, **args } ) end |
#all ⇒ SeismicAPI::Response
Return all teamsites
27 28 29 |
# File 'lib/seismic_api/teamsites.rb', line 27 def all request.get(teamsites_url) end |
#find(id:) ⇒ SeismicAPI::Response
Find a specific teamsite
37 38 39 |
# File 'lib/seismic_api/teamsites.rb', line 37 def find(id:) request.get("#{teamsites_url}/#{id}") end |
#items(teamsiteId:, **query) ⇒ SeismicAPI::Response
Query for items
120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/seismic_api/teamsites.rb', line 120 def items(teamsiteId:, **query) unless query[:externalId] || query[:externalConnectionId] raise ArgumentError, "Must suppy one of externalId or "\ "externalConnectionId as a query option" end request.get( "#{teamsites_url}/#{teamsiteId}/items", params: query ) end |
#publish(teamsiteId:, content:, **args) ⇒ SeismicAPI::Response
Publish given library content
91 92 93 94 95 96 |
# File 'lib/seismic_api/teamsites.rb', line 91 def publish(teamsiteId:, content:, **args) request.post( "#{teamsites_url}/#{teamsiteId}/publish", body: { content: content, **args } ) end |
#unpublish(teamsiteId:, libraryContentId:) ⇒ SeismicAPI::Response
Unpublish given library content
105 106 107 108 109 |
# File 'lib/seismic_api/teamsites.rb', line 105 def unpublish(teamsiteId:, libraryContentId:) request.put( "#{teamsites_url}/#{teamsiteId}/items/#{libraryContentId}/unpublish" ) end |
#update_url(teamsiteId:, contentId:, **args) ⇒ Object
77 78 79 80 81 82 |
# File 'lib/seismic_api/teamsites.rb', line 77 def update_url(teamsiteId:, contentId:, **args) request.patch( "#{teamsites_url}/#{teamsiteId}/urls/#{contentId}", body: args ) end |