Class: VixenRename::Net
- Inherits:
-
Object
- Object
- VixenRename::Net
- Includes:
- HTTParty
- Defined in:
- lib/vixen_rename/net.rb
Overview
Interact with a VixenGroup API
Example: VixenRename::Net.new.get_video_by_id 100415, ‘VIXEN’
Instance Method Summary collapse
Instance Method Details
#get_video_by_id(video_id, site) ⇒ Hash
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/vixen_rename/net.rb', line 17 def get_video_by_id(video_id, site) @video_id = video_id @site = site resp = self.class.post("/graphql", body: body, headers: headers) raise VixenAPIError, resp.code, resp.parsed_response, "HTTP Failed" if resp.code != 200 { video_id: resp.dig("data", "findOneVideo", "videoId").to_i, title: resp.dig("data", "findOneVideo", "title"), release_date: Time.parse(resp.dig("data", "findOneVideo", "releaseDate")), models: resp.dig("data", "findOneVideo", "modelsSlugged").map { |m| m["name"] }, site: site } end |