Module: Shikimori::API::V1::Favorites
- Included in:
- Shikimori::API::V1
- Defined in:
- lib/shikimori/api/v1/favorites.rb
Overview
Methods for the Favorites API
Instance Method Summary collapse
-
#create_favorite(id, type:, person_type: 'person', headers: nil, **query) ⇒ Bool
Add object to favorites.
-
#delete_favorite(id, type:, headers: nil, **query) ⇒ Boolean
Delete Favorite.
-
#reorder_favorite(id, position:, headers: nil, **query) ⇒ Bool
Reorder favorite.
Instance Method Details
#create_favorite(id, type:, person_type: 'person', headers: nil, **query) ⇒ Bool
Add object to favorites
36 37 38 39 40 41 |
# File 'lib/shikimori/api/v1/favorites.rb', line 36 def create_favorite(id, type:, person_type: 'person', headers: nil, **query) path = creation_favorite_path_by(type.to_s.downcase, id.to_s, person_type) rest.post base_url.join('favorites', *path).url, {}, headers: headers, query: query true end |
#delete_favorite(id, type:, headers: nil, **query) ⇒ Boolean
Delete Favorite
67 68 69 70 71 72 |
# File 'lib/shikimori/api/v1/favorites.rb', line 67 def delete_favorite(id, type:, headers: nil, **query) path = deletion_favorite_path_by(type.to_s.downcase, id.to_s) rest.delete base_url.join('favorites', *path).url, headers: headers, query: query true end |
#reorder_favorite(id, position:, headers: nil, **query) ⇒ Bool
Reorder favorite
91 92 93 94 95 96 97 98 99 |
# File 'lib/shikimori/api/v1/favorites.rb', line 91 def reorder_favorite(id, position:, headers: nil, **query) rest.post( base_url.join('favorites', id.to_s, 'reorder').url, { new_index: position }, headers: headers, query: query ) true end |