Class: Intown::Event

Inherits:
Client show all
Defined in:
lib/intown/event.rb

Constant Summary

Constants inherited from Client

Client::API_VERSION

Class Method Summary collapse

Methods inherited from Client

artist_identifier, bad_gateway, encode_name, facebook_identifier, internal_server_error, musicbrainz_identifier, options, process_not_acceptable, process_not_found, process_response

Class Method Details

.date_options(params) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/intown/event.rb', line 12

def date_options(params)
  return {:date => format_date(params[:date])} if params[:date]
  return {:date => "#{format_date(params[:from])},#{format_date(params[:to])}"} if params[:from] && params[:to]
  return {:date => "upcoming"} if params[:upcoming] == true
  return {:date => "all"} if params[:all] == true
  {}
end

.format_date(date) ⇒ Object



20
21
22
# File 'lib/intown/event.rb', line 20

def format_date(date)
  date.strftime("%Y-%m-%d")
end

.list(params) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/intown/event.rb', line 4

def list(params)
  identifier = artist_identifier(params)
  event_params = options.merge(date_options(params))
  url = "/artists/#{identifier}/events"
  response = get(url, event_params)
  process_response(response)
end