Class: Ticketmaster::Classification

Inherits:
Result
  • Object
show all
Defined in:
lib/ticketmaster/results/classification.rb

Instance Attribute Summary

Attributes inherited from Result

#data, #request

Instance Method Summary collapse

Methods inherited from Result

array, create, #initialize, search

Constructor Details

This class inherits a constructor from Ticketmaster::Result

Instance Method Details

#genresObject



11
12
13
# File 'lib/ticketmaster/results/classification.rb', line 11

def genres
  Result.array(data['segment']['_embedded']['genres'], request, 'Ticketmaster::Classification') if data['segment']['_embedded']['genres']
end

#idObject



3
4
5
# File 'lib/ticketmaster/results/classification.rb', line 3

def id
  data['id'] || data['segment']['id']
end

#nameObject



7
8
9
# File 'lib/ticketmaster/results/classification.rb', line 7

def name
  data['name'] || data['segment']['name']
end

#reloadObject



23
24
25
26
# File 'lib/ticketmaster/results/classification.rb', line 23

def reload
  data = request.client.get_classification(id, type).data
  self
end

#subgenresObject



15
16
17
# File 'lib/ticketmaster/results/classification.rb', line 15

def subgenres
  Result.array(data['segment']['_embedded']['subgenres'], request, 'Ticketmaster::Classification') if data['segment']['_embedded']['subgenres']
end

#typeObject



19
20
21
# File 'lib/ticketmaster/results/classification.rb', line 19

def type
  data['_links']['self']['href'].match(/(?<=\/discovery\/v\d\/)[a-z\/]+(?=\/)/)[0]
end