rspotify 0.3.1 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 925839b54c713a9ec76dcabd826b96a2b05e8a5a
4
- data.tar.gz: 69d15be0e45516a0512a9f69a55bde3455c547e9
3
+ metadata.gz: a0f489f7b6248799f9c52fab33efa35debd4933a
4
+ data.tar.gz: c235ab00785d39e994950485cee2b994b2d2addb
5
5
  SHA512:
6
- metadata.gz: d69cee2e26d3c4e58682399d9ef585462c01d588554094effbdc88d44a12abea321b61026de7243b47958e06188eefb41ddb0d548961164838640d9d3ebf3c46
7
- data.tar.gz: ced2a7e6a1cabf0c94718cc438a4ea8b30b0c552d6270b8a031abf69cb0095af6635568a9252bef757cb12114f66e613902cbf575ea86d67c53ad564e9d877d6
6
+ metadata.gz: 04b88d2a1bff87009cbbb22139c9c8290a0a6880cd3edd587013f8d2e6ad0f078c6299fd7688c242426dc5439212e58676546948e735fa88a93606d780b1262f
7
+ data.tar.gz: 50b468779d68fdab5b7f3bf430a485570831dc231477c899a02a28ad10a5512b5e216e1603b1223ba42a01c8a023491a5367c184fe97d3eb5da2ffeccbf30e46
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+
3
+ notifications:
4
+ email: false
5
+
6
+ rvm:
7
+ - 2.0
8
+ - 2.1
9
+ - ruby-head
10
+
11
+ script:
12
+ - "bundle exec rspec"
@@ -2,9 +2,6 @@ module RSpotify
2
2
 
3
3
  class Album < Base
4
4
 
5
- attr_accessor :album_type, :artists, :available_markets, :external_ids, :genres, :images,
6
- :name, :popularity, :release_date, :release_date_precision, :tracks
7
-
8
5
  def self.find(id)
9
6
  super(id, 'album')
10
7
  end
@@ -36,6 +33,5 @@ module RSpotify
36
33
 
37
34
  super(options)
38
35
  end
39
-
40
36
  end
41
37
  end
@@ -2,8 +2,6 @@ module RSpotify
2
2
 
3
3
  class Artist < Base
4
4
 
5
- attr_accessor :genres, :images, :name, :popularity
6
-
7
5
  def self.find(id)
8
6
  super(id, 'artist')
9
7
  end
@@ -20,6 +18,5 @@ module RSpotify
20
18
 
21
19
  super(options)
22
20
  end
23
-
24
21
  end
25
22
  end
data/lib/rspotify/base.rb CHANGED
@@ -2,8 +2,6 @@ module RSpotify
2
2
 
3
3
  class Base
4
4
 
5
- attr_accessor :external_urls, :href, :id, :type, :uri
6
-
7
5
  def self.find(id, type)
8
6
  pluralized_type = "#{type}s"
9
7
  type_class = eval type.capitalize
@@ -18,9 +16,9 @@ module RSpotify
18
16
 
19
17
  json = RSpotify.get 'search',
20
18
  params: {
21
- q: query,
22
- type: type,
23
- limit: limit,
19
+ q: query,
20
+ type: type,
21
+ limit: limit,
24
22
  offset: offset
25
23
  }
26
24
 
@@ -36,5 +34,26 @@ module RSpotify
36
34
  @uri = options['uri']
37
35
  end
38
36
 
37
+ def complete_object!
38
+ pluralized_type = "#{type}s"
39
+ initialize RSpotify.get("#{pluralized_type}/#{@id}")
40
+ end
41
+
42
+ def method_missing(method_name, *args)
43
+ attr = "@#{method_name}".to_sym
44
+ super unless instance_variables.include? attr
45
+
46
+ attr_value = instance_variable_get attr
47
+ return attr_value unless attr_value.nil?
48
+
49
+ complete_object!
50
+ instance_variable_get attr
51
+ end
52
+
53
+ def respond_to?(method_name)
54
+ attr = "@#{method_name}".to_sym
55
+ return true if instance_variables.include? attr
56
+ super
57
+ end
39
58
  end
40
59
  end
@@ -2,9 +2,6 @@ module RSpotify
2
2
 
3
3
  class Playlist < Base
4
4
 
5
- attr_accessor :collaborative, :description, :followers,
6
- :images, :name, :owner, :public, :tracks
7
-
8
5
  def self.find(user_id, id)
9
6
  json = RSpotify.auth_get("users/#{user_id}/playlists/#{id}")
10
7
  Playlist.new json
@@ -34,5 +31,8 @@ module RSpotify
34
31
  super(options)
35
32
  end
36
33
 
34
+ def complete_object!
35
+ initialize RSpotify.auth_get("users/#{@owner.id}/playlists/#{@id}")
36
+ end
37
37
  end
38
38
  end
@@ -2,9 +2,6 @@ module RSpotify
2
2
 
3
3
  class Track < Base
4
4
 
5
- attr_accessor :album, :artists, :available_markets, :disc_number, :duration_ms, :explicit,
6
- :external_ids, :name, :popularity, :preview_url, :track_number
7
-
8
5
  def self.find(id)
9
6
  super(id, 'track')
10
7
  end
@@ -35,6 +32,5 @@ module RSpotify
35
32
 
36
33
  super(options)
37
34
  end
38
-
39
35
  end
40
36
  end
data/lib/rspotify/user.rb CHANGED
@@ -18,6 +18,5 @@ module RSpotify
18
18
  playlists = RSpotify.auth_get("users/#{@id}/playlists")['items']
19
19
  playlists.map { |p| Playlist.new p }
20
20
  end
21
-
22
21
  end
23
22
  end
@@ -1,3 +1,3 @@
1
1
  module RSpotify
2
- VERSION = '0.3.1'
2
+ VERSION = '0.4.0'
3
3
  end
data/lib/rspotify.rb CHANGED
@@ -39,6 +39,5 @@ module RSpotify
39
39
  params << auth_header
40
40
  send(verb, path, *params)
41
41
  end
42
-
43
42
  end
44
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspotify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guilherme Sad
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-21 00:00:00.000000000 Z
11
+ date: 2014-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest_client
@@ -89,6 +89,7 @@ extra_rdoc_files: []
89
89
  files:
90
90
  - ".gitignore"
91
91
  - ".rspec"
92
+ - ".travis.yml"
92
93
  - Gemfile
93
94
  - LICENSE.txt
94
95
  - README.md