Sha256: 899219b3e749ae7a1a669e48e702b7ffcfc6c4a4108368fe4ae015e1ded4fb69

Contents?: true

Size: 771 Bytes

Versions: 5

Compression:

Stored size: 771 Bytes

Contents

module Intown
  class Event < Client
    class << self
      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

      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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
intown-0.2 lib/intown/event.rb
intown-0.1.6 lib/intown/event.rb
intown-0.1.5 lib/intown/event.rb
intown-0.1.4 lib/intown/event.rb
intown-0.1.3 lib/intown/event.rb