beatport 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +18 -0
  4. data/Gemfile.lock +44 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.rdoc +23 -0
  7. data/Rakefile +55 -0
  8. data/VERSION +1 -0
  9. data/beatport.gemspec +129 -0
  10. data/lib/beatport.rb +15 -0
  11. data/lib/beatport/catalog.rb +93 -0
  12. data/lib/beatport/catalog/account_type.rb +11 -0
  13. data/lib/beatport/catalog/artist.rb +20 -0
  14. data/lib/beatport/catalog/audio_format.rb +10 -0
  15. data/lib/beatport/catalog/audio_format_fee.rb +8 -0
  16. data/lib/beatport/catalog/autocomplete.rb +11 -0
  17. data/lib/beatport/catalog/chart.rb +27 -0
  18. data/lib/beatport/catalog/chart_overview.rb +12 -0
  19. data/lib/beatport/catalog/country.rb +16 -0
  20. data/lib/beatport/catalog/currency.rb +9 -0
  21. data/lib/beatport/catalog/feature.rb +16 -0
  22. data/lib/beatport/catalog/genre.rb +32 -0
  23. data/lib/beatport/catalog/home.rb +13 -0
  24. data/lib/beatport/catalog/image.rb +7 -0
  25. data/lib/beatport/catalog/images.rb +13 -0
  26. data/lib/beatport/catalog/item_type.rb +9 -0
  27. data/lib/beatport/catalog/key.rb +7 -0
  28. data/lib/beatport/catalog/keys.rb +7 -0
  29. data/lib/beatport/catalog/label.rb +29 -0
  30. data/lib/beatport/catalog/list.rb +7 -0
  31. data/lib/beatport/catalog/mixed.rb +9 -0
  32. data/lib/beatport/catalog/recommendations.rb +7 -0
  33. data/lib/beatport/catalog/release.rb +32 -0
  34. data/lib/beatport/catalog/search.rb +11 -0
  35. data/lib/beatport/catalog/slide.rb +17 -0
  36. data/lib/beatport/catalog/slideshow.rb +30 -0
  37. data/lib/beatport/catalog/source_type.rb +9 -0
  38. data/lib/beatport/catalog/state.rb +7 -0
  39. data/lib/beatport/catalog/track.rb +43 -0
  40. data/lib/beatport/client.rb +22 -0
  41. data/lib/beatport/collection.rb +37 -0
  42. data/lib/beatport/inflector.rb +44 -0
  43. data/lib/beatport/item.rb +81 -0
  44. data/lib/beatport/parser.rb +8 -0
  45. data/lib/beatport/price.rb +8 -0
  46. data/lib/beatport/query_builder.rb +74 -0
  47. data/spec/catalog/account_type_spec.rb +16 -0
  48. data/spec/catalog/artist_spec.rb +83 -0
  49. data/spec/catalog/audio_format_spec.rb +14 -0
  50. data/spec/catalog/autocomplete_spec.rb +25 -0
  51. data/spec/catalog/chart_overview_spec.rb +15 -0
  52. data/spec/catalog/chart_spec.rb +96 -0
  53. data/spec/catalog/country_spec.rb +22 -0
  54. data/spec/catalog/currency_spec.rb +13 -0
  55. data/spec/catalog/genre_spec.rb +118 -0
  56. data/spec/catalog/home_spec.rb +16 -0
  57. data/spec/catalog/item_type_spec.rb +11 -0
  58. data/spec/catalog/label_spec.rb +103 -0
  59. data/spec/catalog/mixed_spec.rb +26 -0
  60. data/spec/catalog/release_spec.rb +138 -0
  61. data/spec/catalog/search_spec.rb +24 -0
  62. data/spec/catalog/slide_spec.rb +45 -0
  63. data/spec/catalog/source_type_spec.rb +11 -0
  64. data/spec/catalog/track_spec.rb +173 -0
  65. data/spec/collection_spec.rb +11 -0
  66. data/spec/inflector_spec.rb +34 -0
  67. data/spec/item_spec.rb +11 -0
  68. data/spec/query_builder_spec.rb +100 -0
  69. data/spec/spec_helper.rb +19 -0
  70. metadata +251 -0
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ gem 'httparty'
7
+ gem 'money' # https://github.com/aflatter/money
8
+
9
+ # Add dependencies to develop your gem here.
10
+ # Include everything needed to run rake, tests, features, etc.
11
+ group :development do
12
+ gem "rspec", ">= 0"
13
+ gem "bundler", "~> 1.0.0"
14
+ gem "jeweler", "~> 1.6.3"
15
+ gem "rcov", ">= 0"
16
+ gem 'yard', '>=0'
17
+ gem 'log_buddy'
18
+ end
@@ -0,0 +1,44 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.3)
5
+ git (1.2.5)
6
+ httparty (0.8.1)
7
+ multi_json
8
+ multi_xml
9
+ i18n (0.6.0)
10
+ jeweler (1.6.4)
11
+ bundler (~> 1.0)
12
+ git (>= 1.2.5)
13
+ rake
14
+ json (1.6.3)
15
+ log_buddy (0.6.0)
16
+ money (4.0.1)
17
+ i18n (~> 0.4)
18
+ json
19
+ multi_json (1.0.4)
20
+ multi_xml (0.4.1)
21
+ rake (0.9.2.2)
22
+ rcov (0.9.11)
23
+ rspec (2.7.0)
24
+ rspec-core (~> 2.7.0)
25
+ rspec-expectations (~> 2.7.0)
26
+ rspec-mocks (~> 2.7.0)
27
+ rspec-core (2.7.1)
28
+ rspec-expectations (2.7.0)
29
+ diff-lcs (~> 1.1.2)
30
+ rspec-mocks (2.7.0)
31
+ yard (0.7.3)
32
+
33
+ PLATFORMS
34
+ ruby
35
+
36
+ DEPENDENCIES
37
+ bundler (~> 1.0.0)
38
+ httparty
39
+ jeweler (~> 1.6.3)
40
+ log_buddy
41
+ money
42
+ rcov
43
+ rspec
44
+ yard
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Mateo Murphy
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,23 @@
1
+ = Beatport
2
+
3
+ A ruby gem for accessing the Beatport API
4
+
5
+ http://api.beatport.com
6
+
7
+ Currently incomplete, but under active development.
8
+
9
+ == Contributing to beatport
10
+
11
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
12
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
13
+ * Fork the project
14
+ * Start a feature/bugfix branch
15
+ * Commit and push until you are happy with your contribution
16
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
17
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
18
+
19
+ == Copyright
20
+
21
+ Copyright (c) 2011 Mateo Murphy. See LICENSE.txt for
22
+ further details.
23
+
@@ -0,0 +1,55 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "beatport"
18
+ gem.homepage = "http://github.com/mateomurphy/beatport"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{ruby gem for accessing the beatport api}
21
+ gem.description = %Q{A ruby gem for accessing the beatport api}
22
+ gem.email = "mateo.murphy@gmail.com"
23
+ gem.authors = ["Mateo Murphy"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ #task :default => :test
29
+
30
+ require 'rcov/rcovtask'
31
+ Rcov::RcovTask.new do |test|
32
+ test.libs << 'test'
33
+ test.pattern = 'test/**/test_*.rb'
34
+ test.verbose = true
35
+ test.rcov_opts << '--exclude "gems/*"'
36
+ end
37
+
38
+
39
+
40
+ require 'rake/rdoctask'
41
+ Rake::RDocTask.new do |rdoc|
42
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
43
+
44
+ rdoc.rdoc_dir = 'rdoc'
45
+ rdoc.title = "beatport #{version}"
46
+ rdoc.rdoc_files.include('README*')
47
+ rdoc.rdoc_files.include('lib/**/*.rb')
48
+ end
49
+
50
+ require 'rspec/core/rake_task'
51
+
52
+ RSpec::Core::RakeTask.new('spec')
53
+
54
+ # If you want to make this the default task
55
+ task :default => :spec
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.1
@@ -0,0 +1,129 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{beatport}
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Mateo Murphy"]
12
+ s.date = %q{2011-12-18}
13
+ s.description = %q{A ruby gem for accessing the beatport api}
14
+ s.email = %q{mateo.murphy@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "beatport.gemspec",
29
+ "lib/beatport.rb",
30
+ "lib/beatport/catalog.rb",
31
+ "lib/beatport/catalog/account_type.rb",
32
+ "lib/beatport/catalog/artist.rb",
33
+ "lib/beatport/catalog/audio_format.rb",
34
+ "lib/beatport/catalog/audio_format_fee.rb",
35
+ "lib/beatport/catalog/autocomplete.rb",
36
+ "lib/beatport/catalog/chart.rb",
37
+ "lib/beatport/catalog/chart_overview.rb",
38
+ "lib/beatport/catalog/country.rb",
39
+ "lib/beatport/catalog/currency.rb",
40
+ "lib/beatport/catalog/feature.rb",
41
+ "lib/beatport/catalog/genre.rb",
42
+ "lib/beatport/catalog/home.rb",
43
+ "lib/beatport/catalog/image.rb",
44
+ "lib/beatport/catalog/images.rb",
45
+ "lib/beatport/catalog/item_type.rb",
46
+ "lib/beatport/catalog/key.rb",
47
+ "lib/beatport/catalog/keys.rb",
48
+ "lib/beatport/catalog/label.rb",
49
+ "lib/beatport/catalog/list.rb",
50
+ "lib/beatport/catalog/mixed.rb",
51
+ "lib/beatport/catalog/recommendations.rb",
52
+ "lib/beatport/catalog/release.rb",
53
+ "lib/beatport/catalog/search.rb",
54
+ "lib/beatport/catalog/slide.rb",
55
+ "lib/beatport/catalog/slideshow.rb",
56
+ "lib/beatport/catalog/source_type.rb",
57
+ "lib/beatport/catalog/state.rb",
58
+ "lib/beatport/catalog/track.rb",
59
+ "lib/beatport/client.rb",
60
+ "lib/beatport/collection.rb",
61
+ "lib/beatport/inflector.rb",
62
+ "lib/beatport/item.rb",
63
+ "lib/beatport/parser.rb",
64
+ "lib/beatport/price.rb",
65
+ "lib/beatport/query_builder.rb",
66
+ "spec/catalog/account_type_spec.rb",
67
+ "spec/catalog/artist_spec.rb",
68
+ "spec/catalog/audio_format_spec.rb",
69
+ "spec/catalog/autocomplete_spec.rb",
70
+ "spec/catalog/chart_overview_spec.rb",
71
+ "spec/catalog/chart_spec.rb",
72
+ "spec/catalog/country_spec.rb",
73
+ "spec/catalog/currency_spec.rb",
74
+ "spec/catalog/genre_spec.rb",
75
+ "spec/catalog/home_spec.rb",
76
+ "spec/catalog/item_type_spec.rb",
77
+ "spec/catalog/label_spec.rb",
78
+ "spec/catalog/mixed_spec.rb",
79
+ "spec/catalog/release_spec.rb",
80
+ "spec/catalog/search_spec.rb",
81
+ "spec/catalog/slide_spec.rb",
82
+ "spec/catalog/source_type_spec.rb",
83
+ "spec/catalog/track_spec.rb",
84
+ "spec/collection_spec.rb",
85
+ "spec/inflector_spec.rb",
86
+ "spec/item_spec.rb",
87
+ "spec/query_builder_spec.rb",
88
+ "spec/spec_helper.rb"
89
+ ]
90
+ s.homepage = %q{http://github.com/mateomurphy/beatport}
91
+ s.licenses = ["MIT"]
92
+ s.require_paths = ["lib"]
93
+ s.rubygems_version = %q{1.5.2}
94
+ s.summary = %q{ruby gem for accessing the beatport api}
95
+
96
+ if s.respond_to? :specification_version then
97
+ s.specification_version = 3
98
+
99
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
100
+ s.add_runtime_dependency(%q<httparty>, [">= 0"])
101
+ s.add_runtime_dependency(%q<money>, [">= 0"])
102
+ s.add_development_dependency(%q<rspec>, [">= 0"])
103
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
104
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.3"])
105
+ s.add_development_dependency(%q<rcov>, [">= 0"])
106
+ s.add_development_dependency(%q<yard>, [">= 0"])
107
+ s.add_development_dependency(%q<log_buddy>, [">= 0"])
108
+ else
109
+ s.add_dependency(%q<httparty>, [">= 0"])
110
+ s.add_dependency(%q<money>, [">= 0"])
111
+ s.add_dependency(%q<rspec>, [">= 0"])
112
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
113
+ s.add_dependency(%q<jeweler>, ["~> 1.6.3"])
114
+ s.add_dependency(%q<rcov>, [">= 0"])
115
+ s.add_dependency(%q<yard>, [">= 0"])
116
+ s.add_dependency(%q<log_buddy>, [">= 0"])
117
+ end
118
+ else
119
+ s.add_dependency(%q<httparty>, [">= 0"])
120
+ s.add_dependency(%q<money>, [">= 0"])
121
+ s.add_dependency(%q<rspec>, [">= 0"])
122
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
123
+ s.add_dependency(%q<jeweler>, ["~> 1.6.3"])
124
+ s.add_dependency(%q<rcov>, [">= 0"])
125
+ s.add_dependency(%q<yard>, [">= 0"])
126
+ s.add_dependency(%q<log_buddy>, [">= 0"])
127
+ end
128
+ end
129
+
@@ -0,0 +1,15 @@
1
+ # http://api.beatport.com/index.html
2
+ require 'ostruct'
3
+ require 'httparty'
4
+ require 'money'
5
+
6
+ module Beatport
7
+ autoload :Catalog, 'beatport/catalog'
8
+ autoload :Client, 'beatport/client'
9
+ autoload :Collection, 'beatport/collection'
10
+ autoload :Inflector, 'beatport/inflector'
11
+ autoload :Item, 'beatport/item'
12
+ autoload :Parser, 'beatport/parser'
13
+ autoload :Price, 'beatport/price'
14
+ autoload :QueryBuilder, 'beatport/query_builder'
15
+ end
@@ -0,0 +1,93 @@
1
+ module Beatport
2
+ module Catalog
3
+ autoload :AccountType, 'beatport/catalog/account_type'
4
+ autoload :Artist, 'beatport/catalog/artist'
5
+ autoload :AudioFormat, 'beatport/catalog/audio_format'
6
+ autoload :AudioFormatFee, 'beatport/catalog/audio_format_fee'
7
+ autoload :Autocomplete, 'beatport/catalog/autocomplete'
8
+ autoload :Chart, 'beatport/catalog/chart'
9
+ autoload :ChartOverview, 'beatport/catalog/chart_overview'
10
+ autoload :Country, 'beatport/catalog/country'
11
+ autoload :Currency, 'beatport/catalog/currency'
12
+ autoload :Feature, 'beatport/catalog/feature'
13
+ autoload :Genre, 'beatport/catalog/genre'
14
+ autoload :Home, 'beatport/catalog/home'
15
+ autoload :ItemType, 'beatport/catalog/item_type'
16
+ autoload :Image, 'beatport/catalog/image'
17
+ autoload :Images, 'beatport/catalog/images'
18
+ autoload :Key, 'beatport/catalog/key'
19
+ autoload :Keys, 'beatport/catalog/keys'
20
+ autoload :Label, 'beatport/catalog/label'
21
+ autoload :List, 'beatport/catalog/list'
22
+ autoload :Mixed, 'beatport/catalog/mixed'
23
+ autoload :Recommendations, 'beatport/catalog/recommendations'
24
+ autoload :Release, 'beatport/catalog/release'
25
+ autoload :Search, 'beatport/catalog/search'
26
+ autoload :State, 'beatport/catalog/state'
27
+ autoload :Slide, 'beatport/catalog/slide'
28
+ autoload :Slideshow, 'beatport/catalog/slideshow'
29
+ autoload :SourceType, 'beatport/catalog/source_type'
30
+ autoload :Track, 'beatport/catalog/track'
31
+
32
+ def self.artist(id)
33
+ Artist.find(id)
34
+ end
35
+
36
+ def self.artists(*args)
37
+ Artist.all(*args)
38
+ end
39
+
40
+ def self.chart(id)
41
+ Chart.find(id)
42
+ end
43
+
44
+ def self.chart_overview(*args)
45
+ ChartOverview.get
46
+ end
47
+
48
+ def self.charts(*args)
49
+ Chart.all
50
+ end
51
+
52
+ def self.genre(key)
53
+ Genre.find(key)
54
+ end
55
+
56
+ def self.genre_overview
57
+ Genre.overview
58
+ end
59
+
60
+ def self.genres(*args)
61
+ Genre.all(*args)
62
+ end
63
+
64
+ def self.home
65
+ Home.get
66
+ end
67
+
68
+ def self.label(id)
69
+ Label.find(id)
70
+ end
71
+
72
+ def self.labels(*args)
73
+ Label.all(*args)
74
+ end
75
+
76
+ def self.release(id)
77
+ Release.find(id)
78
+ end
79
+
80
+ def self.releases(*args)
81
+ Release.all(*args)
82
+ end
83
+
84
+ def self.track(id)
85
+ Track.find(id)
86
+ end
87
+
88
+ def self.tracks(*args)
89
+ Track.all(*args)
90
+ end
91
+
92
+ end
93
+ end
@@ -0,0 +1,11 @@
1
+ module Beatport
2
+ module Catalog
3
+ class AccountType < Item
4
+ has_one :images, Images
5
+
6
+ def self.all
7
+ Client.retrieve 'account-types', AccountType
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,20 @@
1
+ module Beatport
2
+ module Catalog
3
+ class Artist < Item
4
+ has_many :genres, Genre
5
+ has_many :subgenres, Genre
6
+ has_one :images, Images
7
+ has_many :top_downloads, Track
8
+ has_many :featured_releases, Release
9
+
10
+ def self.find(id)
11
+ Client.retrieve('artists/detail', Artist, :id => id)
12
+ end
13
+
14
+ def self.all(*args)
15
+ Client.retrieve 'artists', Artist, *args
16
+ end
17
+
18
+ end
19
+ end
20
+ end