Class: Giphy::Artist

Inherits:
Object
  • Object
show all
Defined in:
lib/giphy/artist.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Artist

Returns a new instance of Artist.



7
8
9
# File 'lib/giphy/artist.rb', line 7

def initialize(hash)
  @hash = hash
end

Class Method Details

.build_batch_from(array) ⇒ Object



3
4
5
# File 'lib/giphy/artist.rb', line 3

def self.build_batch_from(array)
  array.map { |artist| new(artist) }
end

Instance Method Details

#avatarObject



15
16
17
# File 'lib/giphy/artist.rb', line 15

def avatar
  URI(hash.fetch('avatar'))
end

#countObject



27
28
29
# File 'lib/giphy/artist.rb', line 27

def count
  hash.fetch('count').to_i
end

#nameObject



23
24
25
# File 'lib/giphy/artist.rb', line 23

def name
  hash.fetch('name')
end

#usernameObject



11
12
13
# File 'lib/giphy/artist.rb', line 11

def username
  hash.fetch('username')
end

#websiteObject



19
20
21
# File 'lib/giphy/artist.rb', line 19

def website
  URI(hash.fetch('website'))
end