lastfm 1.26.0 → 1.27.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.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lastfm.gemspec +1 -1
- data/lib/lastfm/method_category/album.rb +67 -0
- data/lib/lastfm/method_category/artist.rb +7 -0
- data/lib/lastfm/method_category/track.rb +4 -1
- data/lib/lastfm/method_category/user.rb +1 -1
- data/lib/lastfm/util.rb +6 -11
- data/spec/fixtures/album_get_buylinks.xml +31 -0
- data/spec/fixtures/album_get_shouts.xml +15 -0
- data/spec/fixtures/album_get_tags.xml +13 -0
- data/spec/fixtures/album_get_top_tags.xml +15 -0
- data/spec/fixtures/album_search.xml +35 -0
- data/spec/fixtures/album_search_no_match.xml +10 -0
- data/spec/fixtures/album_search_single_album.xml +23 -0
- data/spec/fixtures/artist_get_correction.xml +12 -0
- data/spec/fixtures/track_search_no_match.xml +11 -0
- data/spec/fixtures/user_get_loved_tracks_no_tracks.xml +5 -0
- data/spec/fixtures/user_get_loved_tracks_single_track.xml +17 -0
- data/spec/method_specs/album_spec.rb +221 -0
- data/spec/method_specs/artist_spec.rb +12 -0
- data/spec/method_specs/track_spec.rb +18 -0
- data/spec/method_specs/user_spec.rb +30 -0
- metadata +24 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 10b162c132972d25c1e26e047ca3cd4b23a5c40b
         | 
| 4 | 
            +
              data.tar.gz: 45cd8bb96eed2cd4c7f9e2995443a76451983bca
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 849fa8b0f687be981575cffa0c91deca042c088ef75121b02291da04d7e8624f1638f6433c59b4d769d5909e4d92dadec51cf45959646b2d8bcecbc64c5f0a98
         | 
| 7 | 
            +
              data.tar.gz: f521209a84aa6dfe273a32659903d2d57b25637e3dd8d7fc206bef65ad5cd9ae9697dee1f7909049a1c717b1cb257332655d2b2801601b0879018f51801958c1
         | 
    
        data/README.md
    CHANGED
    
    | @@ -31,7 +31,15 @@ It supports methods which require [authentication](http://www.last.fm/api/authen | |
| 31 31 |  | 
| 32 32 | 
             
            ### Album
         | 
| 33 33 |  | 
| 34 | 
            +
            * [album.addTags](http://www.last.fm/api/show/album.addTags)
         | 
| 35 | 
            +
            * [album.getBuylinks](http://www.last.fm/api/show/album.getBuylinks)
         | 
| 34 36 | 
             
            * [album.getInfo](http://www.last.fm/api/show?service=290)
         | 
| 37 | 
            +
            * [album.getShouts](http://www.last.fm/api/show/album.getShouts)
         | 
| 38 | 
            +
            * [album.getTags](http://www.last.fm/api/show/album.getTags)
         | 
| 39 | 
            +
            * [album.getTopTags](http://www.last.fm/api/show/album.getTopTags)
         | 
| 40 | 
            +
            * [album.removeTag](http://www.last.fm/api/show/album.removeTag)
         | 
| 41 | 
            +
            * [album.search](http://www.last.fm/api/show/album.search)
         | 
| 42 | 
            +
            * [album.share](http://www.last.fm/api/show/album.share)
         | 
| 35 43 |  | 
| 36 44 | 
             
            ### Artist
         | 
| 37 45 |  | 
    
        data/lastfm.gemspec
    CHANGED
    
    | @@ -12,7 +12,7 @@ Gem::Specification.new do |gem| | |
| 12 12 | 
             
              gem.test_files    = `git ls-files -- {test,spec,features}/*`.split("\n")
         | 
| 13 13 | 
             
              gem.name          = %q{lastfm}
         | 
| 14 14 | 
             
              gem.require_paths = ["lib"]
         | 
| 15 | 
            -
              gem.version       = "1. | 
| 15 | 
            +
              gem.version       = "1.27.0"
         | 
| 16 16 | 
             
              gem.license       = 'MIT'
         | 
| 17 17 |  | 
| 18 18 | 
             
              gem.add_dependency "xml-simple"
         | 
| @@ -1,6 +1,29 @@ | |
| 1 1 | 
             
            class Lastfm
         | 
| 2 2 | 
             
              module MethodCategory
         | 
| 3 3 | 
             
                class Album < Base
         | 
| 4 | 
            +
                  write_method :add_tags, :required => [:artist, :album, :tags]
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                  write_method :remove_tag, :required => [:artist, :album, :tag]
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                  write_method(
         | 
| 9 | 
            +
                    :share,
         | 
| 10 | 
            +
                    :required => [:artist, :album, :recipient],
         | 
| 11 | 
            +
                    :optional => [
         | 
| 12 | 
            +
                      [:public, nil],
         | 
| 13 | 
            +
                      [:message, nil]
         | 
| 14 | 
            +
                    ]
         | 
| 15 | 
            +
                  )
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                  regular_method(
         | 
| 18 | 
            +
                    :get_buylinks,
         | 
| 19 | 
            +
                    :required => any_params([:artist, :album, :country], [:mbid, :country]),
         | 
| 20 | 
            +
                    :optional => [
         | 
| 21 | 
            +
                      [:autocorrect, nil]
         | 
| 22 | 
            +
                    ]
         | 
| 23 | 
            +
                  ) do |response|
         | 
| 24 | 
            +
                    response.xml['affiliations']
         | 
| 25 | 
            +
                  end
         | 
| 26 | 
            +
             | 
| 4 27 | 
             
                  regular_method(
         | 
| 5 28 | 
             
                    :get_info,
         | 
| 6 29 | 
             
                    :required => any_params([:artist, :album], :mbid)
         | 
| @@ -10,6 +33,50 @@ class Lastfm | |
| 10 33 | 
             
                    result['releasedate'].lstrip! unless result['releasedate'].empty?
         | 
| 11 34 | 
             
                    result
         | 
| 12 35 | 
             
                  end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                  regular_method(
         | 
| 38 | 
            +
                    :get_shouts,
         | 
| 39 | 
            +
                    :required => any_params([:artist, :album], :mbid),
         | 
| 40 | 
            +
                    :optional => [
         | 
| 41 | 
            +
                      [:limit, nil],
         | 
| 42 | 
            +
                      [:autocorrect, nil],
         | 
| 43 | 
            +
                      [:page, nil]
         | 
| 44 | 
            +
                    ]
         | 
| 45 | 
            +
                  ) do |response|
         | 
| 46 | 
            +
                    response.xml['shouts']['shout'] = Util.force_array(response.xml['shouts']['shout'])
         | 
| 47 | 
            +
                  end
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                  regular_method(
         | 
| 50 | 
            +
                    :get_top_tags,
         | 
| 51 | 
            +
                    :required => [:artist, :album],
         | 
| 52 | 
            +
                    :optional => [
         | 
| 53 | 
            +
                      [:autocorrect, nil]
         | 
| 54 | 
            +
                    ]
         | 
| 55 | 
            +
                  ) do |response|
         | 
| 56 | 
            +
                    response.xml['toptags']['tag'] = Util.force_array(response.xml['toptags']['tag'])
         | 
| 57 | 
            +
                  end
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                  regular_method(
         | 
| 60 | 
            +
                    :search,
         | 
| 61 | 
            +
                    :required => [:album],
         | 
| 62 | 
            +
                    :optional => [
         | 
| 63 | 
            +
                      [:limit, nil],
         | 
| 64 | 
            +
                      [:page, nil]
         | 
| 65 | 
            +
                    ]
         | 
| 66 | 
            +
                  ) do |response|
         | 
| 67 | 
            +
                    response.xml['results']['albummatches']['album'] = Util.force_array(response.xml['results']['albummatches']['album'])
         | 
| 68 | 
            +
                    response.xml
         | 
| 69 | 
            +
                  end
         | 
| 70 | 
            +
             | 
| 71 | 
            +
                  method_with_authentication(
         | 
| 72 | 
            +
                    :get_tags,
         | 
| 73 | 
            +
                    :required => any_params([:artist, :album], :mbid),
         | 
| 74 | 
            +
                    :optional => [
         | 
| 75 | 
            +
                      [:autocorrect, nil],
         | 
| 76 | 
            +
                    ]
         | 
| 77 | 
            +
                  ) do |response|
         | 
| 78 | 
            +
                    response.xml['tags']['tag'] = Util.force_array(response.xml['tags']['tag'])
         | 
| 79 | 
            +
                  end
         | 
| 13 80 | 
             
                end
         | 
| 14 81 | 
             
              end
         | 
| 15 82 | 
             
            end
         | 
| @@ -22,6 +22,13 @@ class Lastfm | |
| 22 22 | 
             
                    response.xml['artist']
         | 
| 23 23 | 
             
                  end
         | 
| 24 24 |  | 
| 25 | 
            +
                  regular_method(
         | 
| 26 | 
            +
                    :get_correction,
         | 
| 27 | 
            +
                    :required => [:artist]
         | 
| 28 | 
            +
                  ) do |response|
         | 
| 29 | 
            +
                    response.xml['corrections']['correction']
         | 
| 30 | 
            +
                  end
         | 
| 31 | 
            +
             | 
| 25 32 | 
             
                  regular_method(
         | 
| 26 33 | 
             
                    :get_events,
         | 
| 27 34 | 
             
                    :required => any_params([:artist], [:mbid])
         | 
    
        data/lib/lastfm/util.rb
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            class Lastfm
         | 
| 2 2 | 
             
              class Util
         | 
| 3 3 | 
             
                def self.force_array(array_or_something)
         | 
| 4 | 
            -
                  array_or_something.kind_of?(Array) ? array_or_something : [array_or_something]
         | 
| 4 | 
            +
                  array_or_something.kind_of?(Array) ? array_or_something : [array_or_something].compact
         | 
| 5 5 | 
             
                end
         | 
| 6 6 |  | 
| 7 7 | 
             
                def self.build_options(args, mandatory, optional)
         | 
| @@ -14,18 +14,13 @@ class Lastfm | |
| 14 14 |  | 
| 15 15 | 
             
                def self.build_options_from_hash(options, mandatory, optional)
         | 
| 16 16 | 
             
                  candidates = mandatory.kind_of?(AnyParams) ? mandatory.candidates : [mandatory]
         | 
| 17 | 
            -
                  candidates. | 
| 18 | 
            -
                    Array(params). | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
                          raise ArgumentError.new("%s is required" % param)
         | 
| 22 | 
            -
                        else
         | 
| 23 | 
            -
                          next
         | 
| 24 | 
            -
                        end
         | 
| 25 | 
            -
                      end
         | 
| 17 | 
            +
                  candidates.each do |params|
         | 
| 18 | 
            +
                    missing_param = Array(params).any? { |param| !options.key?(param) }
         | 
| 19 | 
            +
                    if missing_param && params.equal?(candidates.last)
         | 
| 20 | 
            +
                      raise ArgumentError.new("%s is required" % candidates.map{ |c| Array(c).join(', ')}.join(' or '))
         | 
| 26 21 | 
             
                    end
         | 
| 27 22 |  | 
| 28 | 
            -
                    break
         | 
| 23 | 
            +
                    break unless missing_param
         | 
| 29 24 | 
             
                  end
         | 
| 30 25 |  | 
| 31 26 | 
             
                  optional.each do |name, value|
         | 
| @@ -0,0 +1,31 @@ | |
| 1 | 
            +
            <?xml version="1.0" encoding="utf-8"?>
         | 
| 2 | 
            +
            <lfm status="ok">
         | 
| 3 | 
            +
              <affiliations>
         | 
| 4 | 
            +
                <physicals>
         | 
| 5 | 
            +
                  <affiliation>
         | 
| 6 | 
            +
                    <supplierName>Amazon</supplierName>
         | 
| 7 | 
            +
                    <price>
         | 
| 8 | 
            +
                      <currency>GBP</currency>
         | 
| 9 | 
            +
                      <amount>6.34</amount>
         | 
| 10 | 
            +
                      <formatted>£6.34</formatted>
         | 
| 11 | 
            +
                    </price>
         | 
| 12 | 
            +
                    <buyLink>http://www.last.fm/affiliate/byid/8/3418994/1/ws.album.buylinks.f4e2585261d8d10d3297e181d68940fc</buyLink>
         | 
| 13 | 
            +
                    <supplierIcon>http://cdn.last.fm/favicons/1/amazon.gif</supplierIcon>
         | 
| 14 | 
            +
                    <isSearch>0</isSearch>
         | 
| 15 | 
            +
                  </affiliation>
         | 
| 16 | 
            +
                </physicals>
         | 
| 17 | 
            +
                <downloads>
         | 
| 18 | 
            +
                  <affiliation>
         | 
| 19 | 
            +
                    <supplierName>Amazon MP3</supplierName>
         | 
| 20 | 
            +
                    <price>
         | 
| 21 | 
            +
                      <currency>GBP</currency>
         | 
| 22 | 
            +
                      <amount>7.99</amount>
         | 
| 23 | 
            +
                      <formatted>£7.99</formatted>
         | 
| 24 | 
            +
                    </price>
         | 
| 25 | 
            +
                    <buyLink>http://www.last.fm/affiliate/byid/8/3418994/44/ws.album.buylinks.f4e2585261d8d10d3297e181d68940fc</buyLink>
         | 
| 26 | 
            +
                    <supplierIcon>http://cdn.last.fm/favicons/amazon-mp3-16x16-a.gif</supplierIcon>
         | 
| 27 | 
            +
                    <isSearch>0</isSearch>
         | 
| 28 | 
            +
                  </affiliation>
         | 
| 29 | 
            +
                </downloads>
         | 
| 30 | 
            +
              </affiliations>
         | 
| 31 | 
            +
            </lfm>
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            <?xml version="1.0" encoding="utf-8"?>
         | 
| 2 | 
            +
            <lfm status="ok">
         | 
| 3 | 
            +
              <shouts artist="Cher" album="Believe" page="1" perPage="50" totalPages="2" total="53">
         | 
| 4 | 
            +
                <shout>
         | 
| 5 | 
            +
                  <body>A perfect Pop/Dance Masterpiece</body>
         | 
| 6 | 
            +
                  <author>top20fanatico</author>
         | 
| 7 | 
            +
                  <date>Wed, 7 Jan 2015 12:45:35</date>
         | 
| 8 | 
            +
                </shout>
         | 
| 9 | 
            +
                <shout>
         | 
| 10 | 
            +
                  <body>http://www.lastfm.com.br/music/Cher/+images/101972561</body>
         | 
| 11 | 
            +
                  <author>gabcmonteiro</author>
         | 
| 12 | 
            +
                  <date>Sun, 9 Nov 2014 12:07:06</date>
         | 
| 13 | 
            +
                </shout>
         | 
| 14 | 
            +
              </shouts>
         | 
| 15 | 
            +
            </lfm>
         | 
| @@ -0,0 +1,13 @@ | |
| 1 | 
            +
            <?xml version="1.0" encoding="utf-8"?>
         | 
| 2 | 
            +
            <lfm status="ok">
         | 
| 3 | 
            +
              <tags artist="Cher" album="Believe">
         | 
| 4 | 
            +
                <tag>
         | 
| 5 | 
            +
                  <name>sourabh</name> 
         | 
| 6 | 
            +
                  <url>http://www.last.fm/tag/sourabh</url>
         | 
| 7 | 
            +
                </tag>
         | 
| 8 | 
            +
                <tag>
         | 
| 9 | 
            +
                  <name>90s</name> 
         | 
| 10 | 
            +
                  <url>http://www.last.fm/tag/90s</url>
         | 
| 11 | 
            +
                </tag>
         | 
| 12 | 
            +
              </tags>
         | 
| 13 | 
            +
            </lfm>
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            <?xml version="1.0" encoding="utf-8"?>
         | 
| 2 | 
            +
            <lfm status="ok">
         | 
| 3 | 
            +
              <toptags artist="Radiohead" album="The Bends">
         | 
| 4 | 
            +
                <tag>
         | 
| 5 | 
            +
                  <name>albums I own</name> 
         | 
| 6 | 
            +
                  <count>100</count>
         | 
| 7 | 
            +
                  <url>http://www.last.fm/tag/albums%20i%20own</url>
         | 
| 8 | 
            +
                </tag>
         | 
| 9 | 
            +
                <tag>
         | 
| 10 | 
            +
                  <name>alternative rock</name> 
         | 
| 11 | 
            +
                  <count>56</count>
         | 
| 12 | 
            +
                  <url>http://www.last.fm/tag/alternative%20rock</url>
         | 
| 13 | 
            +
                </tag>
         | 
| 14 | 
            +
              </toptags>
         | 
| 15 | 
            +
            </lfm>
         | 
| @@ -0,0 +1,35 @@ | |
| 1 | 
            +
            <?xml version="1.0" encoding="utf-8"?>
         | 
| 2 | 
            +
            <lfm status="ok">
         | 
| 3 | 
            +
              <results for="Believe" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
         | 
| 4 | 
            +
                <opensearch:Query role="request" searchTerms="Believe" startPage="1" />
         | 
| 5 | 
            +
                <opensearch:totalResults>3926</opensearch:totalResults>
         | 
| 6 | 
            +
                <opensearch:startIndex>0</opensearch:startIndex>
         | 
| 7 | 
            +
                <opensearch:itemsPerPage>50</opensearch:itemsPerPage>
         | 
| 8 | 
            +
                <albummatches>
         | 
| 9 | 
            +
                  <album>
         | 
| 10 | 
            +
                    <name>Believe</name>
         | 
| 11 | 
            +
                    <artist>Disturbed</artist>
         | 
| 12 | 
            +
                    <id>1418894</id>
         | 
| 13 | 
            +
                    <url>http://www.last.fm/music/Disturbed/Believe</url>
         | 
| 14 | 
            +
                    <image size="small">http://userserve-ak.last.fm/serve/34s/53553281.png</image>
         | 
| 15 | 
            +
                    <image size="medium">http://userserve-ak.last.fm/serve/64s/53553281.png</image>
         | 
| 16 | 
            +
                    <image size="large">http://userserve-ak.last.fm/serve/126/53553281.png</image>
         | 
| 17 | 
            +
                    <image size="extralarge">http://userserve-ak.last.fm/serve/300x300/53553281.png</image>
         | 
| 18 | 
            +
                    <streamable>0</streamable>
         | 
| 19 | 
            +
                    <mbid>ed32813a-cd20-4bb3-b3fd-bca6161deb17</mbid>
         | 
| 20 | 
            +
                  </album>
         | 
| 21 | 
            +
                  <album>
         | 
| 22 | 
            +
                    <name>Make Believe</name>
         | 
| 23 | 
            +
                    <artist>Weezer</artist>
         | 
| 24 | 
            +
                    <id>2025180</id>
         | 
| 25 | 
            +
                    <url>http://www.last.fm/music/Weezer/Make+Believe</url>
         | 
| 26 | 
            +
                    <image size="small">http://userserve-ak.last.fm/serve/34s/53692665.png</image>
         | 
| 27 | 
            +
                    <image size="medium">http://userserve-ak.last.fm/serve/64s/53692665.png</image>
         | 
| 28 | 
            +
                    <image size="large">http://userserve-ak.last.fm/serve/126/53692665.png</image>
         | 
| 29 | 
            +
                    <image size="extralarge">http://userserve-ak.last.fm/serve/300x300/53692665.png</image>
         | 
| 30 | 
            +
                    <streamable>0</streamable>
         | 
| 31 | 
            +
                    <mbid>9e7103bb-fc9a-4e5a-a90c-2a3ab4c08e19</mbid>
         | 
| 32 | 
            +
                  </album>
         | 
| 33 | 
            +
                </albummatches>
         | 
| 34 | 
            +
              </results>
         | 
| 35 | 
            +
            </lfm>
         | 
| @@ -0,0 +1,10 @@ | |
| 1 | 
            +
            <?xml version="1.0" encoding="utf-8"?>
         | 
| 2 | 
            +
            <lfm status="ok">
         | 
| 3 | 
            +
              <results for="Believe" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
         | 
| 4 | 
            +
                <opensearch:Query role="request" searchTerms="Believe" startPage="1" />
         | 
| 5 | 
            +
                <opensearch:totalResults>0</opensearch:totalResults>
         | 
| 6 | 
            +
                <opensearch:startIndex>0</opensearch:startIndex>
         | 
| 7 | 
            +
                <opensearch:itemsPerPage>50</opensearch:itemsPerPage>
         | 
| 8 | 
            +
                <albummatches></albummatches>
         | 
| 9 | 
            +
              </results>
         | 
| 10 | 
            +
            </lfm>
         | 
| @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            <?xml version="1.0" encoding="utf-8"?>
         | 
| 2 | 
            +
            <lfm status="ok">
         | 
| 3 | 
            +
              <results for="Believe" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
         | 
| 4 | 
            +
                <opensearch:Query role="request" searchTerms="Believe" startPage="1" />
         | 
| 5 | 
            +
                <opensearch:totalResults>3926</opensearch:totalResults>
         | 
| 6 | 
            +
                <opensearch:startIndex>0</opensearch:startIndex>
         | 
| 7 | 
            +
                <opensearch:itemsPerPage>50</opensearch:itemsPerPage>
         | 
| 8 | 
            +
                <albummatches>
         | 
| 9 | 
            +
                  <album>
         | 
| 10 | 
            +
                    <name>Believe</name>
         | 
| 11 | 
            +
                    <artist>Disturbed</artist>
         | 
| 12 | 
            +
                    <id>1418894</id>
         | 
| 13 | 
            +
                    <url>http://www.last.fm/music/Disturbed/Believe</url>
         | 
| 14 | 
            +
                    <image size="small">http://userserve-ak.last.fm/serve/34s/53553281.png</image>
         | 
| 15 | 
            +
                    <image size="medium">http://userserve-ak.last.fm/serve/64s/53553281.png</image>
         | 
| 16 | 
            +
                    <image size="large">http://userserve-ak.last.fm/serve/126/53553281.png</image>
         | 
| 17 | 
            +
                    <image size="extralarge">http://userserve-ak.last.fm/serve/300x300/53553281.png</image>
         | 
| 18 | 
            +
                    <streamable>0</streamable>
         | 
| 19 | 
            +
                    <mbid>ed32813a-cd20-4bb3-b3fd-bca6161deb17</mbid>
         | 
| 20 | 
            +
                  </album>
         | 
| 21 | 
            +
                </albummatches>
         | 
| 22 | 
            +
              </results>
         | 
| 23 | 
            +
            </lfm>
         | 
| @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            <?xml version="1.0" encoding="utf-8"?>
         | 
| 2 | 
            +
            <lfm status="ok">
         | 
| 3 | 
            +
              <corrections>
         | 
| 4 | 
            +
                <correction index="0">
         | 
| 5 | 
            +
                  <artist>
         | 
| 6 | 
            +
                    <name>Guns N' Roses</name>
         | 
| 7 | 
            +
                    <mbid>eeb1195b-f213-4ce1-b28c-8565211f8e43</mbid>
         | 
| 8 | 
            +
                    <url>http://www.last.fm/music/Guns+N%27+Roses</url>
         | 
| 9 | 
            +
                  </artist>
         | 
| 10 | 
            +
                </correction>
         | 
| 11 | 
            +
              </corrections>
         | 
| 12 | 
            +
            </lfm>
         | 
| @@ -0,0 +1,11 @@ | |
| 1 | 
            +
            <?xml version="1.0" encoding="utf-8"?>
         | 
| 2 | 
            +
            <lfm status="ok">
         | 
| 3 | 
            +
              <results xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" for="Believe">
         | 
| 4 | 
            +
                <opensearch:Query role="request" searchTerms="Believe" startPage="1"/>
         | 
| 5 | 
            +
                <opensearch:totalResults>0</opensearch:totalResults>
         | 
| 6 | 
            +
                <opensearch:startIndex>0</opensearch:startIndex>
         | 
| 7 | 
            +
                <opensearch:itemsPerPage>10</opensearch:itemsPerPage>
         | 
| 8 | 
            +
                <trackmatches>
         | 
| 9 | 
            +
                </trackmatches>
         | 
| 10 | 
            +
              </results>
         | 
| 11 | 
            +
            </lfm>
         | 
| @@ -0,0 +1,17 @@ | |
| 1 | 
            +
            <?xml version="1.0" encoding="utf-8"?>
         | 
| 2 | 
            +
            <lfm status="ok">
         | 
| 3 | 
            +
              <lovedtracks user="skr" page="1" perPage="50" totalPages="4" total="180">
         | 
| 4 | 
            +
                <track>
         | 
| 5 | 
            +
                  <name>I Spy</name>
         | 
| 6 | 
            +
                  <mbid/>
         | 
| 7 | 
            +
                  <url>http://www.last.fm/music/Mikhael+Paskalev/_/I+Spy</url>
         | 
| 8 | 
            +
                  <date uts="1329859504">21 Feb 2012, 21:25</date>
         | 
| 9 | 
            +
                  <artist>
         | 
| 10 | 
            +
                    <name>Mikhael Paskalev</name>
         | 
| 11 | 
            +
                    <mbid/>
         | 
| 12 | 
            +
                    <url>http://www.last.fm/music/Mikhael+Paskalev</url>
         | 
| 13 | 
            +
                  </artist>
         | 
| 14 | 
            +
                  <streamable fulltrack="0">0</streamable>
         | 
| 15 | 
            +
                </track>
         | 
| 16 | 
            +
              </lovedtracks>
         | 
| 17 | 
            +
            </lfm>
         | 
| @@ -1,3 +1,4 @@ | |
| 1 | 
            +
            # encoding: utf-8
         | 
| 1 2 | 
             
            require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
         | 
| 2 3 |  | 
| 3 4 | 
             
            describe '#album' do
         | 
| @@ -7,6 +8,91 @@ describe '#album' do | |
| 7 8 | 
             
                @lastfm.album.should be_an_instance_of(Lastfm::MethodCategory::Album)
         | 
| 8 9 | 
             
              end
         | 
| 9 10 |  | 
| 11 | 
            +
              describe '#add_tags' do
         | 
| 12 | 
            +
                it 'should add tags' do
         | 
| 13 | 
            +
                  @lastfm.should_receive(:request).with('album.addTags', {
         | 
| 14 | 
            +
                    :artist => 'foo artist',
         | 
| 15 | 
            +
                    :album => 'foo track',
         | 
| 16 | 
            +
                    :tags => 'aaa,bbb,ccc'
         | 
| 17 | 
            +
                  }, :post, true, true).and_return(@ok_response)
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                  @lastfm.album.add_tags(
         | 
| 20 | 
            +
                    :artist => 'foo artist',
         | 
| 21 | 
            +
                    :album => 'foo track',
         | 
| 22 | 
            +
                    :tags => 'aaa,bbb,ccc'
         | 
| 23 | 
            +
                    ).should be_true
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
              end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
              describe '#get_buylinks' do
         | 
| 28 | 
            +
                it 'should get buylinks' do
         | 
| 29 | 
            +
                  @lastfm.should_receive(:request).with('album.getBuylinks', {
         | 
| 30 | 
            +
                    :artist => 'radiohead',
         | 
| 31 | 
            +
                    :album => 'in rainbows',
         | 
| 32 | 
            +
                    :country => 'united kingdom',
         | 
| 33 | 
            +
                    :autocorrect => nil
         | 
| 34 | 
            +
                  }).and_return(make_response('album_get_buylinks'))
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                  buylinks = @lastfm.album.get_buylinks(
         | 
| 37 | 
            +
                    :artist => 'radiohead',
         | 
| 38 | 
            +
                    :album => 'in rainbows',
         | 
| 39 | 
            +
                    :country => 'united kingdom'
         | 
| 40 | 
            +
                  )
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                  buylinks['physicals'].size.should == 1
         | 
| 43 | 
            +
                  buylinks['physicals']['affiliation']['supplierName'].should == 'Amazon'
         | 
| 44 | 
            +
                  buylinks['physicals']['affiliation']['price']['currency'].should == 'GBP'
         | 
| 45 | 
            +
                  buylinks['physicals']['affiliation']['price']['amount'].should == '6.34'
         | 
| 46 | 
            +
                  buylinks['physicals']['affiliation']['price']['formatted'].should == '£6.34'
         | 
| 47 | 
            +
                  buylinks['physicals']['affiliation']['buyLink'].should == 'http://www.last.fm/affiliate/byid/8/3418994/1/ws.album.buylinks.f4e2585261d8d10d3297e181d68940fc'
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                  buylinks['downloads'].size.should == 1
         | 
| 50 | 
            +
                  buylinks['downloads']['affiliation']['supplierName'].should == 'Amazon MP3'
         | 
| 51 | 
            +
                  buylinks['downloads']['affiliation']['price']['currency'].should == 'GBP'
         | 
| 52 | 
            +
                  buylinks['downloads']['affiliation']['price']['amount'].should == '7.99'
         | 
| 53 | 
            +
                  buylinks['downloads']['affiliation']['price']['formatted'].should == '£7.99'
         | 
| 54 | 
            +
                  buylinks['downloads']['affiliation']['buyLink'].should == 'http://www.last.fm/affiliate/byid/8/3418994/44/ws.album.buylinks.f4e2585261d8d10d3297e181d68940fc'
         | 
| 55 | 
            +
                end
         | 
| 56 | 
            +
                
         | 
| 57 | 
            +
                it 'should get buylinks by mbid' do
         | 
| 58 | 
            +
                  @lastfm.should_receive(:request).with('album.getBuylinks', {
         | 
| 59 | 
            +
                    :mbid => 'radiohead',
         | 
| 60 | 
            +
                    :country => 'united kingdom',
         | 
| 61 | 
            +
                    :autocorrect => nil
         | 
| 62 | 
            +
                  }).and_return(make_response('album_get_buylinks'))
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                  buylinks = @lastfm.album.get_buylinks(
         | 
| 65 | 
            +
                    :mbid => 'radiohead',
         | 
| 66 | 
            +
                    :country => 'united kingdom'
         | 
| 67 | 
            +
                  )
         | 
| 68 | 
            +
             | 
| 69 | 
            +
                  buylinks['physicals'].size.should == 1
         | 
| 70 | 
            +
                  buylinks['physicals']['affiliation']['supplierName'].should == 'Amazon'
         | 
| 71 | 
            +
                  buylinks['physicals']['affiliation']['price']['currency'].should == 'GBP'
         | 
| 72 | 
            +
                  buylinks['physicals']['affiliation']['price']['amount'].should == '6.34'
         | 
| 73 | 
            +
                  buylinks['physicals']['affiliation']['price']['formatted'].should == '£6.34'
         | 
| 74 | 
            +
                  buylinks['physicals']['affiliation']['buyLink'].should == 'http://www.last.fm/affiliate/byid/8/3418994/1/ws.album.buylinks.f4e2585261d8d10d3297e181d68940fc'
         | 
| 75 | 
            +
             | 
| 76 | 
            +
                  buylinks['downloads'].size.should == 1
         | 
| 77 | 
            +
                  buylinks['downloads']['affiliation']['supplierName'].should == 'Amazon MP3'
         | 
| 78 | 
            +
                  buylinks['downloads']['affiliation']['price']['currency'].should == 'GBP'
         | 
| 79 | 
            +
                  buylinks['downloads']['affiliation']['price']['amount'].should == '7.99'
         | 
| 80 | 
            +
                  buylinks['downloads']['affiliation']['price']['formatted'].should == '£7.99'
         | 
| 81 | 
            +
                  buylinks['downloads']['affiliation']['buyLink'].should == 'http://www.last.fm/affiliate/byid/8/3418994/44/ws.album.buylinks.f4e2585261d8d10d3297e181d68940fc'
         | 
| 82 | 
            +
                end
         | 
| 83 | 
            +
             | 
| 84 | 
            +
                it 'should raise ArgumentError without country' do
         | 
| 85 | 
            +
                  expect {@lastfm.album.get_buylinks(
         | 
| 86 | 
            +
                    :artist => 'radiohead',
         | 
| 87 | 
            +
                    :album => 'in rainbows'
         | 
| 88 | 
            +
                  )}.to raise_error(ArgumentError)
         | 
| 89 | 
            +
             | 
| 90 | 
            +
                  expect {@lastfm.album.get_buylinks(
         | 
| 91 | 
            +
                    :mbid => 'radiohead',
         | 
| 92 | 
            +
                  )}.to raise_error(ArgumentError)
         | 
| 93 | 
            +
                end
         | 
| 94 | 
            +
              end
         | 
| 95 | 
            +
             | 
| 10 96 | 
             
              describe '#get_info' do
         | 
| 11 97 | 
             
                it 'should get info by artist and album' do
         | 
| 12 98 | 
             
                  @lastfm.should_receive(:request).with('album.getInfo', {
         | 
| @@ -46,4 +132,139 @@ describe '#album' do | |
| 46 132 | 
             
                  album['tracks']['track'][0]['url'].should == 'http://www.last.fm/music/Cher/_/Believe'
         | 
| 47 133 | 
             
                end
         | 
| 48 134 | 
             
              end
         | 
| 135 | 
            +
             | 
| 136 | 
            +
              describe '#get_shouts' do
         | 
| 137 | 
            +
                it 'should get shouts' do
         | 
| 138 | 
            +
                  @lastfm.should_receive(:request).with('album.getShouts', {
         | 
| 139 | 
            +
                    :artist => 'Cher',
         | 
| 140 | 
            +
                    :album => 'Believe',
         | 
| 141 | 
            +
                    :autocorrect => nil,
         | 
| 142 | 
            +
                    :limit => nil,
         | 
| 143 | 
            +
                    :page => nil
         | 
| 144 | 
            +
                  }).and_return(make_response('album_get_shouts'))
         | 
| 145 | 
            +
             | 
| 146 | 
            +
                  shouts = @lastfm.album.get_shouts(
         | 
| 147 | 
            +
                    :artist => 'Cher',
         | 
| 148 | 
            +
                    :album => 'Believe')
         | 
| 149 | 
            +
                  shouts.size.should == 2
         | 
| 150 | 
            +
                  shouts[0]['body'].should == 'A perfect Pop/Dance Masterpiece'
         | 
| 151 | 
            +
                  shouts[0]['author'].should == 'top20fanatico'
         | 
| 152 | 
            +
                  shouts[0]['date'].should == 'Wed, 7 Jan 2015 12:45:35'
         | 
| 153 | 
            +
                end
         | 
| 154 | 
            +
              end
         | 
| 155 | 
            +
             | 
| 156 | 
            +
              describe '#get_tags' do
         | 
| 157 | 
            +
                it 'should get tags' do
         | 
| 158 | 
            +
                  @lastfm.should_receive(:request).with('album.getTags', {
         | 
| 159 | 
            +
                    :artist => 'Cher',
         | 
| 160 | 
            +
                    :album => 'Believe',
         | 
| 161 | 
            +
                    :autocorrect => nil
         | 
| 162 | 
            +
                  }, :get, true, true).and_return(make_response('album_get_tags'))
         | 
| 163 | 
            +
             | 
| 164 | 
            +
                  tags = @lastfm.album.get_tags(
         | 
| 165 | 
            +
                    :artist => 'Cher',
         | 
| 166 | 
            +
                    :album => 'Believe')
         | 
| 167 | 
            +
                  tags.size.should == 2
         | 
| 168 | 
            +
                  tags[0]['name'].should == 'sourabh'
         | 
| 169 | 
            +
                  tags[0]['url'].should == 'http://www.last.fm/tag/sourabh'
         | 
| 170 | 
            +
                end
         | 
| 171 | 
            +
              end
         | 
| 172 | 
            +
             | 
| 173 | 
            +
              describe '#get_top_tags' do
         | 
| 174 | 
            +
                it 'should get top tags' do
         | 
| 175 | 
            +
                  @lastfm.should_receive(:request).with('album.getTopTags', {
         | 
| 176 | 
            +
                    :artist => 'Radiohead',
         | 
| 177 | 
            +
                    :album => 'The Bends',
         | 
| 178 | 
            +
                    :autocorrect => nil
         | 
| 179 | 
            +
                  }).and_return(make_response('album_get_top_tags'))
         | 
| 180 | 
            +
             | 
| 181 | 
            +
                  tags = @lastfm.album.get_top_tags(
         | 
| 182 | 
            +
                    :artist => 'Radiohead',
         | 
| 183 | 
            +
                    :album => 'The Bends')
         | 
| 184 | 
            +
                  tags.size.should == 2
         | 
| 185 | 
            +
                  tags[0]['name'].should == 'albums I own'
         | 
| 186 | 
            +
                  tags[0]['count'].should == '100'
         | 
| 187 | 
            +
                  tags[0]['url'].should == 'http://www.last.fm/tag/albums%20i%20own'
         | 
| 188 | 
            +
                end
         | 
| 189 | 
            +
              end
         | 
| 190 | 
            +
             | 
| 191 | 
            +
              describe '#remove_tag' do
         | 
| 192 | 
            +
                it 'should remove tag' do
         | 
| 193 | 
            +
                  @lastfm.should_receive(:request).with('album.removeTag', {
         | 
| 194 | 
            +
                    :artist => 'foo artist',
         | 
| 195 | 
            +
                    :album => 'foo track',
         | 
| 196 | 
            +
                    :tag => 'aaa'
         | 
| 197 | 
            +
                  }, :post, true, true).and_return(@ok_response)
         | 
| 198 | 
            +
             | 
| 199 | 
            +
                  @lastfm.album.remove_tag(
         | 
| 200 | 
            +
                    :artist => 'foo artist',
         | 
| 201 | 
            +
                    :album => 'foo track',
         | 
| 202 | 
            +
                    :tag => 'aaa').should be_true
         | 
| 203 | 
            +
                end
         | 
| 204 | 
            +
              end
         | 
| 205 | 
            +
             | 
| 206 | 
            +
              describe '#search' do
         | 
| 207 | 
            +
                it 'should search' do
         | 
| 208 | 
            +
                  @lastfm.should_receive(:request).with('album.search', {
         | 
| 209 | 
            +
                    :album => 'Believe',
         | 
| 210 | 
            +
                    :limit => nil,
         | 
| 211 | 
            +
                    :page => nil,
         | 
| 212 | 
            +
                  }).and_return(make_response('album_search'))
         | 
| 213 | 
            +
             | 
| 214 | 
            +
                  albums = @lastfm.album.search(:album => 'Believe')
         | 
| 215 | 
            +
                  
         | 
| 216 | 
            +
                  albums['results']['for'].should == 'Believe'
         | 
| 217 | 
            +
                  albums['results']['totalResults'].should == '3926'
         | 
| 218 | 
            +
                  albums['results']['albummatches']['album'].size.should == 2
         | 
| 219 | 
            +
                  albums['results']['albummatches']['album'][0]['name'].should == 'Believe'
         | 
| 220 | 
            +
                end
         | 
| 221 | 
            +
             | 
| 222 | 
            +
                it 'should always return an array of albums' do
         | 
| 223 | 
            +
                  @lastfm.should_receive(:request).with('album.search', {
         | 
| 224 | 
            +
                    :album => 'Believe',
         | 
| 225 | 
            +
                    :limit => nil,
         | 
| 226 | 
            +
                    :page => nil,
         | 
| 227 | 
            +
                  }).and_return(make_response('album_search_single_album'))
         | 
| 228 | 
            +
             | 
| 229 | 
            +
                  albums = @lastfm.album.search(:album => 'Believe')
         | 
| 230 | 
            +
                  
         | 
| 231 | 
            +
                  albums['results']['for'].should == 'Believe'
         | 
| 232 | 
            +
                  albums['results']['totalResults'].should == '3926'
         | 
| 233 | 
            +
                  albums['results']['albummatches']['album'].size.should == 1
         | 
| 234 | 
            +
                  albums['results']['albummatches']['album'][0]['name'].should == 'Believe'
         | 
| 235 | 
            +
                end
         | 
| 236 | 
            +
                
         | 
| 237 | 
            +
                it 'should return an empty array if no match found' do
         | 
| 238 | 
            +
                  @lastfm.should_receive(:request).with('album.search', {
         | 
| 239 | 
            +
                    :album => 'Believe',
         | 
| 240 | 
            +
                    :limit => nil,
         | 
| 241 | 
            +
                    :page => nil,
         | 
| 242 | 
            +
                  }).and_return(make_response('album_search_no_match'))
         | 
| 243 | 
            +
             | 
| 244 | 
            +
                  albums = @lastfm.album.search(:album => 'Believe')
         | 
| 245 | 
            +
                  
         | 
| 246 | 
            +
                  albums['results']['for'].should == 'Believe'
         | 
| 247 | 
            +
                  albums['results']['totalResults'].should == '0'
         | 
| 248 | 
            +
                  albums['results']['albummatches']['album'].size.should == 0
         | 
| 249 | 
            +
                end
         | 
| 250 | 
            +
              end
         | 
| 251 | 
            +
             | 
| 252 | 
            +
              describe '#share' do
         | 
| 253 | 
            +
                it 'should share' do
         | 
| 254 | 
            +
                  @lastfm.should_receive(:request).with('album.share', {
         | 
| 255 | 
            +
                    :artist => 'bar artist',
         | 
| 256 | 
            +
                    :album => 'bar album',
         | 
| 257 | 
            +
                    :recipient => 'bar@example.com',
         | 
| 258 | 
            +
                    :message => 'this is a message',
         | 
| 259 | 
            +
                    :public => nil,
         | 
| 260 | 
            +
                  }, :post, true, true).and_return(@ok_response)
         | 
| 261 | 
            +
             | 
| 262 | 
            +
                  @lastfm.album.share(
         | 
| 263 | 
            +
                    :artist => 'bar artist',
         | 
| 264 | 
            +
                    :album => 'bar album',
         | 
| 265 | 
            +
                    :recipient => 'bar@example.com',
         | 
| 266 | 
            +
                    :message => 'this is a message',
         | 
| 267 | 
            +
                  ).should be_true
         | 
| 268 | 
            +
                end
         | 
| 269 | 
            +
              end
         | 
| 49 270 | 
             
            end
         | 
| @@ -7,6 +7,18 @@ describe '#artist' do | |
| 7 7 | 
             
                @lastfm.artist.should be_an_instance_of(Lastfm::MethodCategory::Artist)
         | 
| 8 8 | 
             
              end
         | 
| 9 9 |  | 
| 10 | 
            +
              describe '#get_correction' do
         | 
| 11 | 
            +
                it 'should get corrections' do
         | 
| 12 | 
            +
                  @lastfm.should_receive(:request).with('artist.getCorrection', {
         | 
| 13 | 
            +
                    :artist => 'Guns N Roses'
         | 
| 14 | 
            +
                  }).and_return(make_response('artist_get_correction'))
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                  corrections = @lastfm.artist.get_correction(:artist => 'Guns N Roses')
         | 
| 17 | 
            +
                  corrections[0]['artist']['name'].should == "Guns N' Roses"
         | 
| 18 | 
            +
                  corrections[0]['artist']['url'].should == 'http://www.last.fm/music/Guns+N%27+Roses'
         | 
| 19 | 
            +
                end
         | 
| 20 | 
            +
              end
         | 
| 21 | 
            +
             | 
| 10 22 | 
             
              describe '#get_top_tracks' do
         | 
| 11 23 | 
             
                it 'should get top tracks' do
         | 
| 12 24 | 
             
                  @lastfm.should_receive(:request).with('artist.getTopTracks', {
         | 
| @@ -115,6 +115,7 @@ describe '#track' do | |
| 115 115 | 
             
                  @lastfm.should_receive(:request).with('track.getSimilar', {
         | 
| 116 116 | 
             
                    :artist => 'Cher',
         | 
| 117 117 | 
             
                    :track => 'Believe',
         | 
| 118 | 
            +
                    :limit => nil
         | 
| 118 119 | 
             
                  }).and_return(make_response('track_get_similar'))
         | 
| 119 120 |  | 
| 120 121 | 
             
                  tracks = @lastfm.track.get_similar(
         | 
| @@ -239,6 +240,23 @@ describe '#track' do | |
| 239 240 | 
             
                  tracks['results']['trackmatches']['track'].size.should == 1
         | 
| 240 241 | 
             
                  tracks['results']['trackmatches']['track'][0]['name'].should == 'Make Me Believe'
         | 
| 241 242 | 
             
                end
         | 
| 243 | 
            +
             | 
| 244 | 
            +
                it 'should return an empty array if no match found' do
         | 
| 245 | 
            +
                  @lastfm.should_receive(:request).with('track.search', {
         | 
| 246 | 
            +
                    :artist => nil,
         | 
| 247 | 
            +
                    :track => 'Believe',
         | 
| 248 | 
            +
                    :limit => 10,
         | 
| 249 | 
            +
                    :page => 1,
         | 
| 250 | 
            +
                  }).and_return(make_response('track_search_no_match'))
         | 
| 251 | 
            +
             | 
| 252 | 
            +
                  tracks = @lastfm.track.search(
         | 
| 253 | 
            +
                    :track => 'Believe',
         | 
| 254 | 
            +
                    :limit => 10,
         | 
| 255 | 
            +
                    :page => 1)
         | 
| 256 | 
            +
                  tracks['results']['for'].should == 'Believe'
         | 
| 257 | 
            +
                  tracks['results']['totalResults'].should == '0'
         | 
| 258 | 
            +
                  tracks['results']['trackmatches']['track'].size.should == 0
         | 
| 259 | 
            +
                end
         | 
| 242 260 | 
             
              end
         | 
| 243 261 |  | 
| 244 262 | 
             
              describe '#share' do
         | 
| @@ -177,6 +177,36 @@ describe '#user' do | |
| 177 177 | 
             
                  tracks[1]['name'].should == 'Working Titles'
         | 
| 178 178 | 
             
                  tracks[1]['artist']['name'].should == 'Damien Jurado'
         | 
| 179 179 | 
             
                end
         | 
| 180 | 
            +
             | 
| 181 | 
            +
                it 'should always return an array of tracks' do
         | 
| 182 | 
            +
                  @lastfm.should_receive(:request).with('user.getLovedTracks', {
         | 
| 183 | 
            +
                    :user => 'test',
         | 
| 184 | 
            +
                    :period => nil,
         | 
| 185 | 
            +
                    :limit => nil,
         | 
| 186 | 
            +
                    :page => nil
         | 
| 187 | 
            +
                  }).and_return(make_response('user_get_loved_tracks_single_track'))
         | 
| 188 | 
            +
             | 
| 189 | 
            +
                  tracks = @lastfm.user.get_loved_tracks(:user => 'test')
         | 
| 190 | 
            +
             | 
| 191 | 
            +
                  tracks.size.should == 1
         | 
| 192 | 
            +
             | 
| 193 | 
            +
                  tracks[0]['rank'].should == nil
         | 
| 194 | 
            +
                  tracks[0]['name'].should == 'I Spy'
         | 
| 195 | 
            +
                  tracks[0]['artist']['name'].should == 'Mikhael Paskalev'
         | 
| 196 | 
            +
                end
         | 
| 197 | 
            +
             | 
| 198 | 
            +
                it 'should return an empty array when user has 0 loved tracks' do
         | 
| 199 | 
            +
                  @lastfm.should_receive(:request).with('user.getLovedTracks', {
         | 
| 200 | 
            +
                    :user => 'test',
         | 
| 201 | 
            +
                    :period => nil,
         | 
| 202 | 
            +
                    :limit => nil,
         | 
| 203 | 
            +
                    :page => nil
         | 
| 204 | 
            +
                  }).and_return(make_response('user_get_loved_tracks_no_tracks'))
         | 
| 205 | 
            +
             | 
| 206 | 
            +
                  tracks = @lastfm.user.get_loved_tracks(:user => 'test')
         | 
| 207 | 
            +
             | 
| 208 | 
            +
                  tracks.size.should == 0
         | 
| 209 | 
            +
                end
         | 
| 180 210 | 
             
              end
         | 
| 181 211 |  | 
| 182 212 | 
             
              describe '#get_friends' do
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: lastfm
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.27.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - youpy
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2015- | 
| 11 | 
            +
            date: 2015-08-06 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: xml-simple
         | 
| @@ -114,7 +114,15 @@ files: | |
| 114 114 | 
             
            - lib/lastfm/method_category/user.rb
         | 
| 115 115 | 
             
            - lib/lastfm/response.rb
         | 
| 116 116 | 
             
            - lib/lastfm/util.rb
         | 
| 117 | 
            +
            - spec/fixtures/album_get_buylinks.xml
         | 
| 117 118 | 
             
            - spec/fixtures/album_get_info.xml
         | 
| 119 | 
            +
            - spec/fixtures/album_get_shouts.xml
         | 
| 120 | 
            +
            - spec/fixtures/album_get_tags.xml
         | 
| 121 | 
            +
            - spec/fixtures/album_get_top_tags.xml
         | 
| 122 | 
            +
            - spec/fixtures/album_search.xml
         | 
| 123 | 
            +
            - spec/fixtures/album_search_no_match.xml
         | 
| 124 | 
            +
            - spec/fixtures/album_search_single_album.xml
         | 
| 125 | 
            +
            - spec/fixtures/artist_get_correction.xml
         | 
| 118 126 | 
             
            - spec/fixtures/artist_get_events.xml
         | 
| 119 127 | 
             
            - spec/fixtures/artist_get_images.xml
         | 
| 120 128 | 
             
            - spec/fixtures/artist_get_info.xml
         | 
| @@ -154,10 +162,13 @@ files: | |
| 154 162 | 
             
            - spec/fixtures/track_get_top_fans.xml
         | 
| 155 163 | 
             
            - spec/fixtures/track_get_top_tags.xml
         | 
| 156 164 | 
             
            - spec/fixtures/track_search.xml
         | 
| 165 | 
            +
            - spec/fixtures/track_search_no_match.xml
         | 
| 157 166 | 
             
            - spec/fixtures/track_search_single_track.xml
         | 
| 158 167 | 
             
            - spec/fixtures/user_get_friends.xml
         | 
| 159 168 | 
             
            - spec/fixtures/user_get_info.xml
         | 
| 160 169 | 
             
            - spec/fixtures/user_get_loved_tracks.xml
         | 
| 170 | 
            +
            - spec/fixtures/user_get_loved_tracks_no_tracks.xml
         | 
| 171 | 
            +
            - spec/fixtures/user_get_loved_tracks_single_track.xml
         | 
| 161 172 | 
             
            - spec/fixtures/user_get_neighbours.xml
         | 
| 162 173 | 
             
            - spec/fixtures/user_get_new_releases.xml
         | 
| 163 174 | 
             
            - spec/fixtures/user_get_personal_tags.xml
         | 
| @@ -218,7 +229,15 @@ signing_key: | |
| 218 229 | 
             
            specification_version: 4
         | 
| 219 230 | 
             
            summary: A ruby interface for Last.fm web services version 2.0
         | 
| 220 231 | 
             
            test_files:
         | 
| 232 | 
            +
            - spec/fixtures/album_get_buylinks.xml
         | 
| 221 233 | 
             
            - spec/fixtures/album_get_info.xml
         | 
| 234 | 
            +
            - spec/fixtures/album_get_shouts.xml
         | 
| 235 | 
            +
            - spec/fixtures/album_get_tags.xml
         | 
| 236 | 
            +
            - spec/fixtures/album_get_top_tags.xml
         | 
| 237 | 
            +
            - spec/fixtures/album_search.xml
         | 
| 238 | 
            +
            - spec/fixtures/album_search_no_match.xml
         | 
| 239 | 
            +
            - spec/fixtures/album_search_single_album.xml
         | 
| 240 | 
            +
            - spec/fixtures/artist_get_correction.xml
         | 
| 222 241 | 
             
            - spec/fixtures/artist_get_events.xml
         | 
| 223 242 | 
             
            - spec/fixtures/artist_get_images.xml
         | 
| 224 243 | 
             
            - spec/fixtures/artist_get_info.xml
         | 
| @@ -258,10 +277,13 @@ test_files: | |
| 258 277 | 
             
            - spec/fixtures/track_get_top_fans.xml
         | 
| 259 278 | 
             
            - spec/fixtures/track_get_top_tags.xml
         | 
| 260 279 | 
             
            - spec/fixtures/track_search.xml
         | 
| 280 | 
            +
            - spec/fixtures/track_search_no_match.xml
         | 
| 261 281 | 
             
            - spec/fixtures/track_search_single_track.xml
         | 
| 262 282 | 
             
            - spec/fixtures/user_get_friends.xml
         | 
| 263 283 | 
             
            - spec/fixtures/user_get_info.xml
         | 
| 264 284 | 
             
            - spec/fixtures/user_get_loved_tracks.xml
         | 
| 285 | 
            +
            - spec/fixtures/user_get_loved_tracks_no_tracks.xml
         | 
| 286 | 
            +
            - spec/fixtures/user_get_loved_tracks_single_track.xml
         | 
| 265 287 | 
             
            - spec/fixtures/user_get_neighbours.xml
         | 
| 266 288 | 
             
            - spec/fixtures/user_get_new_releases.xml
         | 
| 267 289 | 
             
            - spec/fixtures/user_get_personal_tags.xml
         |