Class: GiphyAPI::Sticker
- Inherits:
-
Base
- Object
- Base
- GiphyAPI::Sticker
show all
- Defined in:
- lib/giphy_api/resources/sticker.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
find_with_scope
#assign_raw_data, included
Constructor Details
#initialize(attributes = {}) ⇒ Sticker
Returns a new instance of Sticker.
25
26
27
28
29
30
31
|
# File 'lib/giphy_api/resources/sticker.rb', line 25
def initialize attributes = {}
super(attributes)
self.user = User.new raw_data['user'] if raw_data['user']
self.images = (raw_data['images'] || Image.(raw_data)).collect do |type, image|
[type, Image.new(image)]
end.to_h
end
|
Instance Attribute Details
#images ⇒ Object
Returns the value of attribute images.
5
6
7
|
# File 'lib/giphy_api/resources/sticker.rb', line 5
def images
@images
end
|
#user ⇒ Object
Returns the value of attribute user.
5
6
7
|
# File 'lib/giphy_api/resources/sticker.rb', line 5
def user
@user
end
|
Class Method Details
.random(**options) ⇒ Object
20
21
22
|
# File 'lib/giphy_api/resources/sticker.rb', line 20
def random **options
find_with_scope('/random', :one, options)
end
|
.search(keyword, **options) ⇒ Object
8
9
10
|
# File 'lib/giphy_api/resources/sticker.rb', line 8
def search keyword, **options
find_with_scope('/search', :all, options.merge(q: keyword))
end
|
.translate(term, **options) ⇒ Object
16
17
18
|
# File 'lib/giphy_api/resources/sticker.rb', line 16
def translate term, **options
find_with_scope('/translate', :one, options.merge(s: term))
end
|
.trending(**options) ⇒ Object
12
13
14
|
# File 'lib/giphy_api/resources/sticker.rb', line 12
def trending **options
find_with_scope('/trending', :all, options)
end
|