Module: DeviantArt::Client::Collections

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

Instance Method Summary collapse

Instance Method Details

#create_collection_folder(name) ⇒ Object

Create new collection folder



46
47
48
49
50
# File 'lib/deviantart/client/collections.rb', line 46

def create_collection_folder(name)
  params = {}
  params['folder'] = name unless name.nil?
  perform(DeviantArt::Collections::Folders::Create, :post, '/api/v1/oauth2/collections/folders/create', params)
end

#fave(deviationid, folderid: nil) ⇒ Object

Add deviation to favourites



32
33
34
35
36
# File 'lib/deviantart/client/collections.rb', line 32

def fave(deviationid, folderid: nil)
  params = { deviationid: deviationid }
  params['folderid'] = folderid unless folderid.nil?
  perform(DeviantArt::Collections::Fave, :post, '/api/v1/oauth2/collections/fave', params)
end

#get_collections(folderid, username: nil, offset: 0, limit: 10) ⇒ Object

Fetch collection folder contents



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

def get_collections(folderid, username: nil, offset: 0, limit: 10)
  params = {}
  params['username'] = username unless username.nil?
  params['offset'] = offset if offset != 0
  params['limit'] = limit if limit != 10
  perform(DeviantArt::Collections, :get, "/api/v1/oauth2/collections/#{folderid}", params)
end

#get_collections_folders(username: nil, calculate_size: false, ext_preload: false, offset: 0, limit: 10) ⇒ Object

Fetch collection folders



12
13
14
15
16
17
18
19
20
# File 'lib/deviantart/client/collections.rb', line 12

def get_collections_folders(username: nil, calculate_size: false, ext_preload: false, offset: 0, limit: 10)
  params = {}
  params['username'] = username unless username.nil?
  params['calculate_size'] = calculate_size if calculate_size
  params['ext_preload'] = ext_preload if ext_preload
  params['offset'] = offset if offset != 0
  params['limit'] = limit if limit != 10
  perform(DeviantArt::Collections::Folders, :get, '/api/v1/oauth2/collections/folders', params)
end

#remove_collection_folder(folderid) ⇒ Object

Delete collection folder



53
54
55
# File 'lib/deviantart/client/collections.rb', line 53

def remove_collection_folder(folderid)
  perform(DeviantArt::Collections::Folders::Remove, :get, "/api/v1/oauth2/collections/folders/remove/#{folderid}")
end

#unfave(deviationid, folderid: nil) ⇒ Object

Remove deviation from favourites



39
40
41
42
43
# File 'lib/deviantart/client/collections.rb', line 39

def unfave(deviationid, folderid: nil)
  params = { deviationid: deviationid }
  params['folderid'] = folderid unless folderid.nil?
  perform(DeviantArt::Collections::Unfave, :post, '/api/v1/oauth2/collections/unfave', params)
end