Class: Swiftner::API::VideoContent

Inherits:
Service
  • Object
show all
Defined in:
lib/swiftner/API/video_content.rb

Overview

VideoContent class represents video content in the Swiftner API. It allows you to find and update video content.

Instance Attribute Summary

Attributes inherited from Service

#client, #details, #id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Service

build, client, #initialize, map_collection, validate_required

Constructor Details

This class inherits a constructor from Swiftner::API::Service

Class Method Details

.find(id) ⇒ Object



13
14
15
16
# File 'lib/swiftner/API/video_content.rb', line 13

def self.find(id)
  response = client.get("/video-content/get/#{id}")
  build(response.parsed_response)
end

.find_video_contentsObject



8
9
10
11
# File 'lib/swiftner/API/video_content.rb', line 8

def self.find_video_contents
  response = client.get("/video-content/get-all/")
  map_collection(response)
end

Instance Method Details

#update(attributes) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/swiftner/API/video_content.rb', line 18

def update(attributes)
  attributes = attributes.transform_keys(&:to_s)
  @details = @details.merge(attributes)

  client.put(
    "/video-content/update/#{id}",
    body: @details.to_json,
    headers: { "Content-Type" => "application/json" }
  )
  self
end