beatport 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 293e6fe3ee49db40dddf771ada2ad95f327d2ab3
4
- data.tar.gz: fe0baee99ae499d6c30886a4dd4332eb0d46ac58
3
+ metadata.gz: 40841bbaa108271d99fd746a49168fd67216b3aa
4
+ data.tar.gz: 52ebad0fdd2d89495a0e6690ece6a3ca26b7f901
5
5
  SHA512:
6
- metadata.gz: 41f2908f24e8cf1829034681b36ae20d2b3f5ce03bd793b86f5f857bdbeb74d8d0a49a58021f1f03bfc7858bd37305728c259a4b8be112ede0bc8e8eb3922bd6
7
- data.tar.gz: 67aec17f1017a71b81fc8838e28b7a610232917c215c738882f3acfa1537957ad818ee1f87e98512891e0a0f6ef1efa64780b08cffaf05d2ebbbfca50777fa98
6
+ metadata.gz: 4b882af42cd0c68704b4b38134199d08b472dc0a2874253549cd96c5ac430a67aa79654837cd273c16cb56b5f9b1b4841fe745e0ce7bd094190e92505d6c9d48
7
+ data.tar.gz: 50df7cfbb72e1abbe2d3c2cac3bb4ed89cfca4a7df59434bc76c8550996d607ab02651153a9c03ac998de03875cee7e5e4c600dbef9f1316538f4be9b4511339
data/Gemfile CHANGED
@@ -6,17 +6,17 @@ source "http://rubygems.org"
6
6
  gem 'addressable'
7
7
  gem 'signet'
8
8
  gem 'faraday', '~> 0.8.8'
9
- gem 'money', '~> 6.7.1' # https://github.com/RubyMoney/money
9
+ gem 'money', '~> 6.8' # https://github.com/RubyMoney/money
10
10
 
11
11
  # Add dependencies to develop your gem here.
12
12
  # Include everything needed to run rake, tests, features, etc.
13
13
  group :development do
14
- gem 'bundler'
14
+ gem 'bundler', '~> 1.14.6'
15
15
  gem 'webmock', '~> 1.20.4'
16
- gem 'jeweler', '~> 2.1.1'
16
+ gem 'jeweler', '~> 2.3.3'
17
17
  gem 'log_buddy', '~> 0.7.0'
18
- gem 'rspec', '~> 3.1.0'
19
- gem 'rspec-its', '~> 1.0.1'
18
+ gem 'rspec', '~> 3.5.0'
19
+ gem 'rspec-its', '~> 1.2.0'
20
20
  gem 'yard', '~> 0.8.7'
21
21
  gem 'vcr', '~> 2.9.3'
22
22
  end
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Dependency Status](https://gemnasium.com/mateomurphy/beatport.png)](https://gemnasium.com/mateomurphy/beatport)
4
4
 
5
- A ruby gem for accessing the Beatport API; currently incomplete and only supports the Catalog API, but under development.
5
+ A ruby gem for accessing the Beatport API; currently incomplete and only supports the Catalog API, but under development.
6
6
 
7
7
  https://oauth-api.beatport.com/docs/
8
8
 
@@ -30,10 +30,10 @@ Many queries to beatport support facets, but they aren't properly documentated o
30
30
 
31
31
  ```ruby
32
32
  require 'beatport'
33
-
33
+
34
34
  # Search using the query "Mord Fustang" on Beatport
35
35
  query = Beatport::Catalog::Search.query("Mord Fustang")
36
-
36
+
37
37
  query.class # => returns a Beatport::Collection object
38
38
 
39
39
  query[0].class # => first result is a Beatport::Catalog::Artist object
@@ -51,9 +51,9 @@ Many queries to beatport support facets, but they aren't properly documentated o
51
51
  genres.each do |genre|
52
52
  puts "Genre: #{genre.name} slug: #{genre.slug}"
53
53
  end
54
-
54
+
55
55
  # find the top 10 downloads for the genre Electro House
56
- electro_house_genre = Beatport::Catalog::Genre.find('electro-house')
56
+ electro_house_genre = Beatport::Catalog::Genre.find('electro-house')
57
57
  # => create Electro House Genre object by searching by slug
58
58
 
59
59
  electro_house_top_10 = trance_genre.top_downloads
@@ -72,7 +72,7 @@ To run specs, you'll need to create a file with your oauth credentials in `spec/
72
72
  will be loaded by `spec/spec_helper.rb`
73
73
 
74
74
  ## Contributing to beatport
75
-
75
+
76
76
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
77
77
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
78
78
  * Fork the project
@@ -83,6 +83,6 @@ will be loaded by `spec/spec_helper.rb`
83
83
 
84
84
  ## Copyright
85
85
 
86
- Copyright (c) 2011-2013 Mateo Murphy. See LICENSE.txt for
86
+ Copyright (c) 2011-present Mateo Murphy. See LICENSE.txt for
87
87
  further details.
88
88
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.0
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: beatport 0.3.0 ruby lib
5
+ # stub: beatport 0.4.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "beatport"
9
- s.version = "0.3.0"
9
+ s.version = "0.4.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Mateo Murphy"]
14
- s.date = "2016-09-13"
14
+ s.date = "2017-03-20"
15
15
  s.description = "A ruby gem for accessing the beatport api"
16
16
  s.email = "mateo.murphy@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -112,26 +112,26 @@ Gem::Specification.new do |s|
112
112
  s.add_runtime_dependency(%q<addressable>, [">= 0"])
113
113
  s.add_runtime_dependency(%q<signet>, [">= 0"])
114
114
  s.add_runtime_dependency(%q<faraday>, ["~> 0.8.8"])
115
- s.add_runtime_dependency(%q<money>, ["~> 6.7.1"])
116
- s.add_development_dependency(%q<bundler>, [">= 0"])
115
+ s.add_runtime_dependency(%q<money>, ["~> 6.8"])
116
+ s.add_development_dependency(%q<bundler>, ["~> 1.14.6"])
117
117
  s.add_development_dependency(%q<webmock>, ["~> 1.20.4"])
118
- s.add_development_dependency(%q<jeweler>, ["~> 2.1.1"])
118
+ s.add_development_dependency(%q<jeweler>, ["~> 2.3.3"])
119
119
  s.add_development_dependency(%q<log_buddy>, ["~> 0.7.0"])
120
- s.add_development_dependency(%q<rspec>, ["~> 3.1.0"])
121
- s.add_development_dependency(%q<rspec-its>, ["~> 1.0.1"])
120
+ s.add_development_dependency(%q<rspec>, ["~> 3.5.0"])
121
+ s.add_development_dependency(%q<rspec-its>, ["~> 1.2.0"])
122
122
  s.add_development_dependency(%q<yard>, ["~> 0.8.7"])
123
123
  s.add_development_dependency(%q<vcr>, ["~> 2.9.3"])
124
124
  else
125
125
  s.add_dependency(%q<addressable>, [">= 0"])
126
126
  s.add_dependency(%q<signet>, [">= 0"])
127
127
  s.add_dependency(%q<faraday>, ["~> 0.8.8"])
128
- s.add_dependency(%q<money>, ["~> 6.7.1"])
129
- s.add_dependency(%q<bundler>, [">= 0"])
128
+ s.add_dependency(%q<money>, ["~> 6.8"])
129
+ s.add_dependency(%q<bundler>, ["~> 1.14.6"])
130
130
  s.add_dependency(%q<webmock>, ["~> 1.20.4"])
131
- s.add_dependency(%q<jeweler>, ["~> 2.1.1"])
131
+ s.add_dependency(%q<jeweler>, ["~> 2.3.3"])
132
132
  s.add_dependency(%q<log_buddy>, ["~> 0.7.0"])
133
- s.add_dependency(%q<rspec>, ["~> 3.1.0"])
134
- s.add_dependency(%q<rspec-its>, ["~> 1.0.1"])
133
+ s.add_dependency(%q<rspec>, ["~> 3.5.0"])
134
+ s.add_dependency(%q<rspec-its>, ["~> 1.2.0"])
135
135
  s.add_dependency(%q<yard>, ["~> 0.8.7"])
136
136
  s.add_dependency(%q<vcr>, ["~> 2.9.3"])
137
137
  end
@@ -139,13 +139,13 @@ Gem::Specification.new do |s|
139
139
  s.add_dependency(%q<addressable>, [">= 0"])
140
140
  s.add_dependency(%q<signet>, [">= 0"])
141
141
  s.add_dependency(%q<faraday>, ["~> 0.8.8"])
142
- s.add_dependency(%q<money>, ["~> 6.7.1"])
143
- s.add_dependency(%q<bundler>, [">= 0"])
142
+ s.add_dependency(%q<money>, ["~> 6.8"])
143
+ s.add_dependency(%q<bundler>, ["~> 1.14.6"])
144
144
  s.add_dependency(%q<webmock>, ["~> 1.20.4"])
145
- s.add_dependency(%q<jeweler>, ["~> 2.1.1"])
145
+ s.add_dependency(%q<jeweler>, ["~> 2.3.3"])
146
146
  s.add_dependency(%q<log_buddy>, ["~> 0.7.0"])
147
- s.add_dependency(%q<rspec>, ["~> 3.1.0"])
148
- s.add_dependency(%q<rspec-its>, ["~> 1.0.1"])
147
+ s.add_dependency(%q<rspec>, ["~> 3.5.0"])
148
+ s.add_dependency(%q<rspec-its>, ["~> 1.2.0"])
149
149
  s.add_dependency(%q<yard>, ["~> 0.8.7"])
150
150
  s.add_dependency(%q<vcr>, ["~> 2.9.3"])
151
151
  end
@@ -4,21 +4,21 @@ module Beatport
4
4
  class Collection
5
5
  include Enumerable
6
6
  extend Forwardable
7
-
7
+
8
8
  def_delegators :@results, :each, :'<=>', :length, :==, :===, :[], :to_a
9
-
9
+
10
10
  attr_reader :host, :path, :query, :next_query
11
11
  attr_reader :per_page_options, :page, :per_page, :total_pages, :count
12
12
  attr_reader :facets, :applied_facets, :spellcheck
13
13
  attr_reader :date_filters, :applied_date_filters
14
-
14
+
15
15
  def initialize(klass, data)
16
- raise ArgumentError, "Invalid data passed to Collection.new" unless data['results'].is_a?(Array)
17
-
16
+ raise ArgumentError, "Invalid data passed to Collection.new" unless data.is_a?(Hash) && data['results'].is_a?(Array)
17
+
18
18
  data['metadata'].each do |k, v|
19
19
  instance_variable_set(:"@#{k}", v)
20
20
  end
21
-
21
+
22
22
  @results = if klass == :auto
23
23
  data['results'].map do |r|
24
24
  item_klass = Support::Inflector.constantize("Beatport::Catalog::#{r['type'].capitalize}")
@@ -28,10 +28,10 @@ module Beatport
28
28
  data['results'].map { |r| klass.new(r) }
29
29
  end
30
30
  end
31
-
31
+
32
32
  def grouped
33
33
  group_by { |i| i.type.capitalize }
34
34
  end
35
-
35
+
36
36
  end
37
- end
37
+ end
@@ -8,9 +8,9 @@ describe Beatport do
8
8
  track.should be_a(Beatport::Catalog::Track)
9
9
  end
10
10
  end
11
-
11
+
12
12
  it "raises an NameError if the constant doesn't exist with Catalog" do
13
13
  lambda { Beatport::Foo.new }.should raise_error(NameError, "uninitialized constant Beatport::Foo")
14
14
  end
15
15
  end
16
- end
16
+ end
@@ -24,9 +24,9 @@ module Beatport::Catalog
24
24
  its (:'genres.length') { should be > 1 }
25
25
  its (:'sub_genres.length') { should be > 1 }
26
26
  its (:'top_downloads.length') { should be > 1 }
27
- its (:'images.small.url') { should == "http://geo-media.beatport.com/image/491527.jpg" }
28
- its (:'images.medium.url') { should == "http://geo-media.beatport.com/image/491530.jpg" }
29
- its (:'images.large.url') { should == "http://geo-media.beatport.com/image/10529942.jpg" }
27
+ its (:'images.small.url') { should == "https://geo-media.beatport.com/image/491527.jpg" }
28
+ its (:'images.medium.url') { should == "https://geo-media.beatport.com/image/491530.jpg" }
29
+ its (:'images.large.url') { should == "https://geo-media.beatport.com/image/10529942.jpg" }
30
30
  # its (:'featured_releases.length') { should be > 1 }
31
31
  end
32
32
 
@@ -26,9 +26,9 @@ module Beatport::Catalog
26
26
  its (:'audio_format_fee.wav.to_s') { should == "6.00" }
27
27
  its (:'audio_format_fee.aiff.to_s') { should == "6.00" }
28
28
  specify { subject.genres.map(&:name).should == ["Trance"] }
29
- its (:'images.small.url') { should == "http://geo-media.beatport.com/image/491534.jpg"}
30
- its (:'images.medium.url') { should == "http://geo-media.beatport.com/image/412921.jpg"}
31
- its (:'images.large.url') { should == "http://geo-media.beatport.com/image/412922.jpg"}
29
+ its (:'images.small.url') { should == "https://geo-media.beatport.com/image/491534.jpg"}
30
+ its (:'images.medium.url') { should == "https://geo-media.beatport.com/image/412921.jpg"}
31
+ its (:'images.large.url') { should == "https://geo-media.beatport.com/image/412922.jpg"}
32
32
  its (:'tracks.length') { should == 8 }
33
33
  end
34
34
 
@@ -27,9 +27,9 @@ module Beatport::Catalog
27
27
  its (:'genres.length') { should be > 1 }
28
28
  its (:'sub_genres.length') { should be > 0 }
29
29
  # its (:display_level) { should == 1 }
30
- its (:'images.small.url') { should == "http://geo-media.beatport.com/image/491531.jpg"}
31
- its (:'images.medium.url') { should == "http://geo-media.beatport.com/image/14195881.jpg"}
32
- its (:'images.banner.url') { should == "http://geo-media.beatport.com/image/345152.jpg"}
30
+ its (:'images.small.url') { should == "https://geo-media.beatport.com/image/491531.jpg"}
31
+ its (:'images.medium.url') { should == "https://geo-media.beatport.com/image/14195881.jpg"}
32
+ its (:'images.banner.url') { should == "https://geo-media.beatport.com/image/345152.jpg"}
33
33
  # its (:'top_downloads.length') { should be > 1 }
34
34
  # its (:'featured_releases.length') { should be > 1 }
35
35
  # its (:'most_popular_releases.length') { should be > 1 }
@@ -33,9 +33,9 @@ module Beatport::Catalog
33
33
  its (:'label.id') { should == 804 }
34
34
  specify { subject.artists.map(&:name).should include("Paul Keeley") }
35
35
  specify { subject.genres.map(&:name).sort.should == ["Progressive House", "Trance"] }
36
- its (:'images.small.url') { should == "http://geo-media.beatport.com/image/392700.jpg" }
37
- its (:'images.medium.url') { should == "http://geo-media.beatport.com/image/14195879.jpg" }
38
- its (:'images.large.url') { should == "http://geo-media.beatport.com/image/392701.jpg" }
36
+ its (:'images.small.url') { should == "https://geo-media.beatport.com/image/392700.jpg" }
37
+ its (:'images.medium.url') { should == "https://geo-media.beatport.com/image/14195879.jpg" }
38
+ its (:'images.large.url') { should == "https://geo-media.beatport.com/image/392701.jpg" }
39
39
  its (:'discount.to_s') { should == "33.22" }
40
40
  # its (:'recommendations.releases.length') { should > 1 }
41
41
  end
@@ -48,10 +48,10 @@ module Beatport::Catalog
48
48
  its (:'charts.count') { should > 0 }
49
49
  its (:'release.id') { should == 245137 }
50
50
  its (:'label.id') { should == 495}
51
- its (:'images.small.url') { should == 'http://geo-media.beatport.com/image/674759.jpg' }
52
- its (:'images.medium.url') { should == 'http://geo-media.beatport.com/image/674760.jpg' }
53
- its (:'images.large.url') { should == 'http://geo-media.beatport.com/image/674761.jpg' }
54
- its (:'images.waveform.url') { should == 'http://geo-media.beatport.com/image/1268229.png' }
51
+ its (:'images.small.url') { should == 'https://geo-media.beatport.com/image/674759.jpg' }
52
+ its (:'images.medium.url') { should == 'https://geo-media.beatport.com/image/674760.jpg' }
53
+ its (:'images.large.url') { should == 'https://geo-media.beatport.com/image/674761.jpg' }
54
+ its (:'images.waveform.url') { should == 'https://geo-media.beatport.com/image/1268229.png' }
55
55
  its (:'dynamic_images.main.url') { should == '//geo-media.beatport.com/image_size{hq}/{w}x{h}/674761.jpg' }
56
56
 
57
57
  it "should render a dynamic url of the right size" do
@@ -20,8 +20,8 @@ module Beatport
20
20
 
21
21
  describe '.new' do
22
22
  it "should raise an error when given invalid data" do
23
- expect { Collection.new(Item, 1) }.to raise_exception
23
+ expect { Collection.new(Item, 1) }.to raise_exception(ArgumentError)
24
24
  end
25
25
  end
26
26
  end
27
- end
27
+ end
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Beatport
3
+ module Beatport
4
4
  describe Item do
5
5
  describe '.new' do
6
6
  it "should raise an error when given invalid data" do
7
- expect { Item.new(1) }.to raise_exception
7
+ expect { Item.new(1) }.to raise_exception(ArgumentError)
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beatport
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mateo Murphy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-13 00:00:00.000000000 Z
11
+ date: 2017-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 6.7.1
61
+ version: '6.8'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 6.7.1
68
+ version: '6.8'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 1.14.6
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 1.14.6
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: webmock
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 2.1.1
103
+ version: 2.3.3
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 2.1.1
110
+ version: 2.3.3
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: log_buddy
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -128,28 +128,28 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 3.1.0
131
+ version: 3.5.0
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 3.1.0
138
+ version: 3.5.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rspec-its
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 1.0.1
145
+ version: 1.2.0
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 1.0.1
152
+ version: 1.2.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: yard
155
155
  requirement: !ruby/object:Gem::Requirement