Module: DeviantArt::Client::Deviation

Included in:
DeviantArt::Client
Defined in:
lib/deviantart/client/deviation.rb

Instance Method Summary collapse

Instance Method Details

#download_deviation(deviationid) ⇒ Object

Get the original file download (if allowed)



52
53
54
# File 'lib/deviantart/client/deviation.rb', line 52

def download_deviation(deviationid)
  perform(DeviantArt::Deviation::Download, :get, "/api/v1/oauth2/deviation/download/#{deviationid}")
end

#get_deviation(deviationid) ⇒ Object

Fetch a deviation details



12
13
14
# File 'lib/deviantart/client/deviation.rb', line 12

def get_deviation(deviationid)
  perform(DeviantArt::Deviation, :get, "/api/v1/oauth2/deviation/#{deviationid}")
end

#get_deviation_content(deviationid) ⇒ Object

Fetch full data that is not included in the main devaition details



17
18
19
# File 'lib/deviantart/client/deviation.rb', line 17

def get_deviation_content(deviationid)
  perform(DeviantArt::Deviation::Content, :get, '/api/v1/oauth2/deviation/content', { deviationid: deviationid })
end

#get_deviation_embeddedcontent(deviationid, offset_deviationid: nil, offset: 0, limit: 10) ⇒ Object

Fetch content embedded in a deviation. Journal and literature deviations support embedding of deviations inside them.



23
24
25
26
27
28
29
# File 'lib/deviantart/client/deviation.rb', line 23

def get_deviation_embeddedcontent(deviationid, offset_deviationid: nil, offset: 0, limit: 10)
  params = { deviationid: deviationid }
  params['offset_deviationid'] = offset_deviationid if offset_deviationid
  params['offset'] = offset if offset != 0
  params['limit'] = limit if limit != 10
  perform(DeviantArt::Deviation::EmbeddedContent, :get, '/api/v1/oauth2/deviation/embeddedcontent', params)
end

#get_deviation_metadata(deviationids, ext_submission: false, ext_camera: false, ext_stats: false, ext_collection: false) ⇒ Object

Fetch deviation metadata for a set of deviations. This endpoint is limited to 50 deviations per query when fetching the base data and 10 when fetching extended data.



33
34
35
36
37
38
39
40
# File 'lib/deviantart/client/deviation.rb', line 33

def (deviationids, ext_submission: false, ext_camera: false, ext_stats: false, ext_collection: false)
  params = { deviationids: deviationids.is_a?(Enumerable) ? deviationids : [deviationids] }
  params['ext_submission'] = ext_submission
  params['ext_camera'] = ext_camera
  params['ext_stats'] = ext_stats
  params['ext_collection'] = ext_collection
  perform(DeviantArt::Deviation::Metadata, :get, '/api/v1/oauth2/deviation/metadata', params)
end

#get_deviation_whofaved(deviationid, offset: 0, limit: 10) ⇒ Object

Fetch a list of users who faved the deviation



43
44
45
46
47
48
49
# File 'lib/deviantart/client/deviation.rb', line 43

def get_deviation_whofaved(deviationid, offset: 0, limit: 10)
  params = {}
  params['deviationid'] = deviationid
  params['offset'] = offset if offset != 0
  params['limit'] = limit if limit != 10
  perform(DeviantArt::Deviation::WhoFaved, :get, '/api/v1/oauth2/deviation/whofaved', params)
end