rspotify 1.18.0 → 1.19.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: d1ea05cdf97229f89e4289ab13ffb98e69c9c83d
4
- data.tar.gz: 51189c1a34623a092bbf00228dde6f74f01602ad
3
+ metadata.gz: c38e76877f674bd0d2b288bcb718bd9ceeb6c1c4
4
+ data.tar.gz: 6f278aeac2bc1e6c7af4c4b4fb0e25b6435cfbb6
5
5
  SHA512:
6
- metadata.gz: 2f3606c24acaaaa73c3bb63b4686e763517f5b75f302dec396f32389efb85d9eaba23c7fe8d06acdc21fd2d30f38a0804ba464e33e09c5dc0d3a43623fba5de3
7
- data.tar.gz: c02ebfec2b609bcabf1b06647db8d23dba3706d63cb77d8609afa4ecb989e4d5d7ef43f06e776c83c662f2777691cb66fd24eac2c0493e9e9e4d8b45abb2d1f3
6
+ metadata.gz: 843549feffdc3a350760d2a3348c4d8b5790b5be60bfd00437ea12ee57eb4dd95c0ecb968c2c798486cfaeed34ac4e0f025bcee3540ace68be64a96b3110476f
7
+ data.tar.gz: 077a6a37500bb4966db1fccee08e7119b23ce9839747153380b4728c85e4dd9b890286cb880e033414a1435ebc642cb7ef6d9bb33ee30b73136aaeba3b394a89
@@ -4,8 +4,6 @@ notifications:
4
4
  email: false
5
5
 
6
6
  rvm:
7
- - 2.0
8
- - 2.1
9
7
  - ruby-head
10
8
 
11
9
  script:
data/README.md CHANGED
@@ -135,7 +135,7 @@ recommendations.tracks #=> (Track array)
135
135
 
136
136
  You might want your application to access a user's Spotify account.
137
137
 
138
- For instance, suppose you want your app to create playlists for the user based on his taste, or to add a feature that syncs user's playlists with some external app.
138
+ For instance, suppose you want your app to create playlists for the user based on their taste, or to add a feature that syncs user's playlists with some external app.
139
139
 
140
140
  If so, add the following to your application (Remember to [get your credentials](https://developer.spotify.com/my-applications))
141
141
 
@@ -187,7 +187,7 @@ module RSpotify
187
187
  # track.instance_variable_get("@popularity") #=> 62
188
188
  def method_missing(method_name, *args)
189
189
  attr = "@#{method_name}"
190
- super unless instance_variable_defined? attr
190
+ return super if method_name.match(/[\?!]$/) || !instance_variable_defined?(attr)
191
191
 
192
192
  attr_value = instance_variable_get attr
193
193
  return attr_value if !attr_value.nil? || @id.nil?
@@ -199,8 +199,8 @@ module RSpotify
199
199
  # Overrides Object#respond_to? to also consider methods dynamically generated by {#method_missing}
200
200
  def respond_to?(method_name, include_private_methods = false)
201
201
  attr = "@#{method_name}"
202
- return true if instance_variable_defined? attr
203
- super
202
+ return super if method_name.match(/[\?!]$/) || !instance_variable_defined?(attr)
203
+ true
204
204
  end
205
205
 
206
206
  protected
@@ -115,7 +115,7 @@ module RSpotify
115
115
  # Adds one or more tracks to a playlist in user's Spotify account. This method is only available when the
116
116
  # current user has granted access to the *playlist-modify-public* and *playlist-modify-private* scopes.
117
117
  #
118
- # @param tracks [Array<Track>] Tracks to be added. Maximum: 100 per request
118
+ # @param tracks [Array<Track>, Array<String>] Tracks to be added. Either array of Tracks or strings where each string is a valid spotify track uri. Maximum: 100 per request
119
119
  # @param position [Integer, NilClass] The position to insert the tracks, a zero-based index. Default: tracks are appended to the playlist
120
120
  # @return [Array<Track>] The tracks added
121
121
  #
@@ -130,7 +130,12 @@ module RSpotify
130
130
  # playlist.add_tracks!(tracks, position: 20)
131
131
  # playlist.tracks[20].name #=> "Somebody That I Used To Know"
132
132
  def add_tracks!(tracks, position: nil)
133
- track_uris = tracks.map(&:uri).join(',')
133
+ track_uris = nil
134
+ if tracks.first.is_a? String
135
+ track_uris = tracks.join(',')
136
+ else
137
+ track_uris = tracks.map(&:uri).join(',')
138
+ end
134
139
  url = "#{@path}/tracks?uris=#{track_uris}"
135
140
  url << "&position=#{position}" if position
136
141
 
@@ -168,7 +168,7 @@ module RSpotify
168
168
 
169
169
  response = User.oauth_get(@id, url)
170
170
  return response if RSpotify.raw_response
171
- response["#{type}s"]['items'].map { |i| type_class.new i }
171
+ response["#{type}s"]['items'].compact.map { |i| type_class.new i }
172
172
  end
173
173
 
174
174
  # Check if the current user is following one or more artists or other Spotify users. This method
@@ -1,3 +1,3 @@
1
1
  module RSpotify
2
- VERSION = '1.18.0'
2
+ VERSION = '1.19.0'
3
3
  end
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.require_paths = ['lib']
18
18
 
19
19
  spec.add_dependency 'omniauth-oauth2', '~> 1.3.1'
20
- spec.add_dependency 'rest-client', '~> 1.7'
20
+ spec.add_dependency 'rest-client', '~> 1.8'
21
21
 
22
22
  spec.add_development_dependency 'bundler'
23
23
  spec.add_development_dependency 'fakeweb', '~> 1.3'
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: 1.18.0
4
+ version: 1.19.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: 2016-04-19 00:00:00.000000000 Z
11
+ date: 2016-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.7'
33
+ version: '1.8'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.7'
40
+ version: '1.8'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement