songkick_ruby 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/songkick/client/calendar.rb +6 -6
 - data/lib/songkick/client/event.rb +2 -2
 - data/lib/songkick/client/request.rb +11 -4
 - data/lib/songkick/client/search.rb +6 -6
 - data/lib/songkick/client.rb +1 -1
 - data/lib/songkick/version.rb +1 -1
 - data/lib/songkick.rb +2 -2
 - data/songkick_ruby.gemspec +1 -1
 - metadata +3 -3
 
| 
         @@ -2,16 +2,16 @@ module Songkick 
     | 
|
| 
       2 
2 
     | 
    
         
             
              class Client
         
     | 
| 
       3 
3 
     | 
    
         
             
                module Calendar
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
                  def artist_calendar(artist_id)
         
     | 
| 
       6 
     | 
    
         
            -
                    get "artists/#{artist_id}/calendar.#{format}"
         
     | 
| 
      
 5 
     | 
    
         
            +
                  def artist_calendar(artist_id, page = 1)
         
     | 
| 
      
 6 
     | 
    
         
            +
                    get "artists/#{artist_id}/calendar.#{format}", page
         
     | 
| 
       7 
7 
     | 
    
         
             
                  end
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
                  def location_calendar(location_id)
         
     | 
| 
       10 
     | 
    
         
            -
                    get "metro_areas/#{location_id}/calendar.#{format}"
         
     | 
| 
      
 9 
     | 
    
         
            +
                  def location_calendar(location_id, page = 1)
         
     | 
| 
      
 10 
     | 
    
         
            +
                    get "metro_areas/#{location_id}/calendar.#{format}", page
         
     | 
| 
       11 
11 
     | 
    
         
             
                  end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
                  def user_calendar(username)
         
     | 
| 
       14 
     | 
    
         
            -
                    get "users/#{artist_id}/calendar.#{format}"
         
     | 
| 
      
 13 
     | 
    
         
            +
                  def user_calendar(username, page = 1)
         
     | 
| 
      
 14 
     | 
    
         
            +
                    get "users/#{artist_id}/calendar.#{format}", page
         
     | 
| 
       15 
15 
     | 
    
         
             
                  end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                end
         
     | 
| 
         @@ -4,14 +4,21 @@ module Songkick 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
                  private
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                  def get(url)
         
     | 
| 
       8 
     | 
    
         
            -
                    uri =  
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
                    
         
     | 
| 
      
 7 
     | 
    
         
            +
                  def get(url, page)
         
     | 
| 
      
 8 
     | 
    
         
            +
                    uri = generate_uri(url, page)
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
       11 
10 
     | 
    
         
             
                    response = Net::HTTP.get_response(uri)
         
     | 
| 
       12 
11 
     | 
    
         
             
                    json? ? JSON.parse(response.body) : response.body
         
     | 
| 
       13 
12 
     | 
    
         
             
                  end
         
     | 
| 
       14 
13 
     | 
    
         | 
| 
      
 14 
     | 
    
         
            +
                  def generate_uri(url, page)
         
     | 
| 
      
 15 
     | 
    
         
            +
                    uri = API_URL + url
         
     | 
| 
      
 16 
     | 
    
         
            +
                    uri += uri.include?("?") ? "&page=#{page}" : "?page=#{page}" if page.to_i > 1
         
     | 
| 
      
 17 
     | 
    
         
            +
                    uri = URI.parse uri.include?("?") ? uri + "&apikey=#{api_key}" : uri + "?apikey=#{api_key}"
         
     | 
| 
      
 18 
     | 
    
         
            +
                    print 
         
     | 
| 
      
 19 
     | 
    
         
            +
                    uri
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
       15 
22 
     | 
    
         
             
                end
         
     | 
| 
       16 
23 
     | 
    
         
             
              end
         
     | 
| 
       17 
24 
     | 
    
         
             
            end
         
     | 
| 
         @@ -2,21 +2,21 @@ module Songkick 
     | 
|
| 
       2 
2 
     | 
    
         
             
              class Client
         
     | 
| 
       3 
3 
     | 
    
         
             
                module Search
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
                  def search_events(opts)
         
     | 
| 
      
 5 
     | 
    
         
            +
                  def search_events(opts, page = 1)
         
     | 
| 
       6 
6 
     | 
    
         
             
                    _opts = opts.collect{|k, v| "#{k}=#{v.gsub(" ", "%20")}"}.join("&")
         
     | 
| 
       7 
     | 
    
         
            -
                    get "events.#{format}?#{_opts}"
         
     | 
| 
      
 7 
     | 
    
         
            +
                    get "events.#{format}?#{_opts}", page
         
     | 
| 
       8 
8 
     | 
    
         
             
                  end
         
     | 
| 
       9 
9 
     | 
    
         
             
                  alias_method :search_event, :search_events
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                  def search_locations(opts)
         
     | 
| 
      
 12 
     | 
    
         
            +
                  def search_locations(opts, page = 1)
         
     | 
| 
       13 
13 
     | 
    
         
             
                    _opts = opts.collect{|k, v| "#{k}=#{v.gsub(" ", "%20")}"}.join("&")
         
     | 
| 
       14 
     | 
    
         
            -
                    get "search/locations.#{format}?#{_opts}"
         
     | 
| 
      
 14 
     | 
    
         
            +
                    get "search/locations.#{format}?#{_opts}", page
         
     | 
| 
       15 
15 
     | 
    
         
             
                  end
         
     | 
| 
       16 
16 
     | 
    
         
             
                  alias_method :search_location, :search_locations
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
                  def search_artists(text)
         
     | 
| 
       19 
     | 
    
         
            -
                    get "search/artists.#{format}?query=#{text.gsub(" ","%20")}"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  def search_artists(text, page = 1)
         
     | 
| 
      
 19 
     | 
    
         
            +
                    get "search/artists.#{format}?query=#{text.gsub(" ","%20")}", page
         
     | 
| 
       20 
20 
     | 
    
         
             
                  end
         
     | 
| 
       21 
21 
     | 
    
         
             
                  alias_method :search_artist, :search_artists
         
     | 
| 
       22 
22 
     | 
    
         | 
    
        data/lib/songkick/client.rb
    CHANGED
    
    
    
        data/lib/songkick/version.rb
    CHANGED
    
    
    
        data/lib/songkick.rb
    CHANGED
    
    
    
        data/songkick_ruby.gemspec
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: songkick_ruby
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 19
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 1
         
     | 
| 
      
 8 
     | 
    
         
            +
              - 1
         
     | 
| 
       8 
9 
     | 
    
         
             
              - 0
         
     | 
| 
       9 
     | 
    
         
            -
               
     | 
| 
       10 
     | 
    
         
            -
              version: 1.0.0
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 1.1.0
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Gregory Marcilhacy
         
     |