spotify-ruby 0.2.3 → 0.2.4

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: 118af1b2f6ab08785aa78c8028bf7927003154a1
4
- data.tar.gz: 2d655193db96272b01a9f90aef9964c5a482e324
3
+ metadata.gz: 75f97a2dfbc52f0a0aced0874048df14cf32f1d2
4
+ data.tar.gz: 2071351feb0057354dd40bbc2a44d9d4c5054cff
5
5
  SHA512:
6
- metadata.gz: b6f4a4f4018790a020e3ebd1b926b6ceda2ce0fe8a5fc3d807cd2da87b81489ae19a68d1b3236eb59cb9bf1ecdbb74b51fe1a71900486b93719eaa490df63714
7
- data.tar.gz: b2e0da362c7786da52a7eee27f1a1277f5f953fa499c82b7d615b97745f27e9aaf043229cbdfea02ba3d91c896e06caa4375e75b9049aff2cbb385084b27fe10
6
+ metadata.gz: b73965a3d6c73490ceaf513921596f7c8cac65b5a849bfc6d4345841331ac493fdc0b2fff9a7f11023a8eba3e472040271b6c8832bfd6e1b6f9848b1b51f0e36
7
+ data.tar.gz: b9646f1e3222f601010059a1330c7d31b18c9baac520460d1696d3ea5ea1f33d7cabe633223b609a47a2195c9211df3b2e96d9eae8cc067dd1af09b3718dfc0c
@@ -0,0 +1,3 @@
1
+ 👍🎉 First off, thanks for taking the time to contribute! 🎉👍
2
+
3
+ Please refer to these [guidelines](https://bih.github.io/spotify-ruby/documentation/contributing/) for details.
@@ -0,0 +1,27 @@
1
+ *Before you log an issue, please, make sure
2
+ that the problem you're reporting
3
+ hasn't been reported (and potentially fixed) already.*
4
+
5
+ *Please provide an unambiguous title for the issue.
6
+ Be clear and precise in your description of the problem.
7
+ Use the template below when reporting bugs*
8
+
9
+ *Before filing the ticket you should replace all text above the horizontal
10
+ rule with your own words.*
11
+
12
+ --------
13
+
14
+ ## Expected behavior
15
+
16
+ Describe here how you expected spotify-ruby to behave in this particular situation.
17
+
18
+ ## Actual behavior
19
+
20
+ Describe here what actually happened.
21
+
22
+ ## Steps to reproduce the problem
23
+
24
+ This is extremely important! Providing us with a reliable way to reproduce
25
+ a problem will expedite its solution.
26
+
27
+ ## Spotify-ruby version
@@ -14,7 +14,7 @@ Metrics/LineLength:
14
14
  # Too short methods lead to extraction of single-use methods, which can make
15
15
  # the code easier to read (by naming things), but can also clutter the class
16
16
  Metrics/MethodLength:
17
- Max: 20
17
+ Max: 25
18
18
 
19
19
  # The guiding principle of classes is SRP, SRP can't be accurately measured by LoC
20
20
  Metrics/ClassLength:
@@ -76,37 +76,65 @@ module Spotify
76
76
  #
77
77
  # # Play from a playlist, album from a specific index in that list.
78
78
  # # For example, play the 9th item on X playlist.
79
- # device.play!(index: 5, context: "spotify:album:5ht7ItJgpBH7W6vJ5BqpPr")
79
+ # device.play!(
80
+ # index: 5,
81
+ # context: "spotify:album:5ht7ItJgpBH7W6vJ5BqpPr",
82
+ # position_ms: 0
83
+ # )
80
84
  #
81
85
  # # Play any Spotify URI. Albums, artists, tracks, playlists, and more.
82
- # device.play!(uri: "spotify:track:5MqkZd7a7u7N7hKMqquL2U")
86
+ # device.play!(
87
+ # uri: "spotify:track:5MqkZd7a7u7N7hKMqquL2U",
88
+ # position_ms: 0
89
+ # )
83
90
  #
84
91
  # # Similar to just uri, but you can define the context.
85
92
  # # Useful for playing a track that is part of a playlist, and you want the next
86
93
  # # songs to play from that particular context.
87
- # device.play!(uri: "spotify:track:5MqkZd7a7u7N7hKMqquL2U", context: "spotify:album:5ht7ItJgpBH7W6vJ5BqpPr")
94
+ # device.play!(
95
+ # uri: "spotify:track:5MqkZd7a7u7N7hKMqquL2U",
96
+ # context: "spotify:album:5ht7ItJgpBH7W6vJ5BqpPr",
97
+ # position_ms: 0
98
+ # )
99
+ #
100
+ # # Play a track, and immediately seek to 60 seconds.
101
+ # device.play!(
102
+ # index: 5,
103
+ # context: "spotify:album:5ht7ItJgpBH7W6vJ5BqpPr",
104
+ # position_ms: 60 * 1000
105
+ # )
88
106
  #
89
107
  # @see https://developer.spotify.com/console/put-play/
90
108
  #
91
109
  # @param [Hash] config The play config you'd like to set. See code examples.
92
110
  # @return [Spotify::SDK::Connect::Device] self Return itself, so chained methods can be supported.
93
111
  #
112
+ # rubocop:disable AbcSize
94
113
  def play!(config)
95
114
  payload = case config.keys
96
- when %i[index context]
97
- {context_uri: config[:context], offset: {position: config[:index]}}
98
- when %i[uri]
99
- {uris: [config[:uri]]}
100
- when %i[uri context]
101
- {context_uri: config[:context], offset: {uri: config[:uri]}}
115
+ when %i[index context position_ms]
116
+ {context_uri: config[:context],
117
+ offset: {position: config[:index]},
118
+ position_ms: config[:position_ms]}
119
+ when %i[uri position_ms]
120
+ {uris: [config[:uri]],
121
+ position_ms: config[:position_ms]}
122
+ when %i[uri context position_ms]
123
+ {context_uri: config[:context],
124
+ offset: {uri: config[:uri]},
125
+ position_ms: config[:position_ms]}
102
126
  else
103
- raise "Unrecognized play instructions. See documentation for details."
127
+ raise <<-ERROR.strip_heredoc.strip
128
+ Unrecognized play instructions.
129
+ See https://www.rubydoc.info/github/bih/spotify-ruby/Spotify/SDK/Connect/Device#play!-instance_method for details.
130
+ ERROR
104
131
  end
105
132
 
106
133
  parent.send_http_request(:put, "/v1/me/player/play?device_id=%s" % id, http_options: {expect_nil: true},
107
134
  body: payload.to_json)
108
135
  self
109
136
  end
137
+ # rubocop:enable AbcSize
110
138
 
111
139
  ##
112
140
  # Resume the currently playing track on device.
@@ -12,5 +12,5 @@ module Spotify
12
12
  # MINOR version when you add functionality in a backwards-compatible manner, and
13
13
  # PATCH version when you make backwards-compatible bug fixes.
14
14
  #
15
- VERSION = "0.2.3"
15
+ VERSION = "0.2.4"
16
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spotify-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bilawal Hameed
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-06 00:00:00.000000000 Z
11
+ date: 2018-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -226,6 +226,8 @@ executables: []
226
226
  extensions: []
227
227
  extra_rdoc_files: []
228
228
  files:
229
+ - ".github/CONTRIBUTING.md"
230
+ - ".github/ISSUE_TEMPLATE.md"
229
231
  - ".gitignore"
230
232
  - ".rspec"
231
233
  - ".rubocop.yml"
@@ -282,4 +284,3 @@ signing_key:
282
284
  specification_version: 4
283
285
  summary: The developer-friendly, opinionated Ruby SDK for Spotify.
284
286
  test_files: []
285
- has_rdoc: