atetracks 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +83 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/atetracks.gemspec +69 -0
- data/lib/atetracks.rb +7 -0
- data/lib/atetracks/helpers.rb +10 -0
- data/lib/atetracks/requests.rb +46 -0
- data/lib/atetracks/structures.rb +319 -0
- data/lib/atetracks/version.rb +3 -0
- metadata +179 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 75af83d3e38bed70e84576db8ebee8883aee1130
|
4
|
+
data.tar.gz: 4c377da279dd9d156b2d5912c237accc70ac5151
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 32043bb8ec8f0eae4f6e9a68c191a8595a013828daffbb6f5efc2d51f9441f963a4c63a5a52e17287b5fc1ae24b70956a965d19e57b4f3c5ed043d97c824bcf3
|
7
|
+
data.tar.gz: 4720cdeee50034c78a4109b8615445ead56f67c54c591d12ff72b506937177d7b6ce369124da33bc8a4b2a0c2d339d2d6d4bb3aa3660f5ac556aaa132531430e
|
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem 'activesupport', '~> 2.3.5'
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem 'shoulda', '~> 3.5.0', '>= 3.5.0'
|
10
|
+
gem 'rdoc', '~> 4.2.0', '>= 4.2.0'
|
11
|
+
gem 'bundler', '~> 1.7.12', '>= 1.7.12'
|
12
|
+
gem 'jeweler', '~> 2.0.1', '>= 2.0.1'
|
13
|
+
gem 'simplecov', '~> 0.9.1', '>= 0.9.1'
|
14
|
+
end
|
15
|
+
|
16
|
+
gem 'httparty', '~> 0.13.3', '>= 0.13.3'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (4.2.0)
|
5
|
+
i18n (~> 0.7)
|
6
|
+
json (~> 1.7, >= 1.7.7)
|
7
|
+
minitest (~> 5.1)
|
8
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
9
|
+
tzinfo (~> 1.1)
|
10
|
+
addressable (2.3.6)
|
11
|
+
builder (3.2.2)
|
12
|
+
descendants_tracker (0.0.4)
|
13
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
14
|
+
docile (1.1.5)
|
15
|
+
faraday (0.9.1)
|
16
|
+
multipart-post (>= 1.2, < 3)
|
17
|
+
git (1.2.9.1)
|
18
|
+
github_api (0.12.2)
|
19
|
+
addressable (~> 2.3)
|
20
|
+
descendants_tracker (~> 0.0.4)
|
21
|
+
faraday (~> 0.8, < 0.10)
|
22
|
+
hashie (>= 3.3)
|
23
|
+
multi_json (>= 1.7.5, < 2.0)
|
24
|
+
nokogiri (~> 1.6.3)
|
25
|
+
oauth2
|
26
|
+
hashie (3.3.2)
|
27
|
+
highline (1.6.21)
|
28
|
+
httparty (0.13.3)
|
29
|
+
json (~> 1.8)
|
30
|
+
multi_xml (>= 0.5.2)
|
31
|
+
i18n (0.7.0)
|
32
|
+
jeweler (2.0.1)
|
33
|
+
builder
|
34
|
+
bundler (>= 1.0)
|
35
|
+
git (>= 1.2.5)
|
36
|
+
github_api
|
37
|
+
highline (>= 1.6.15)
|
38
|
+
nokogiri (>= 1.5.10)
|
39
|
+
rake
|
40
|
+
rdoc
|
41
|
+
json (1.8.2)
|
42
|
+
jwt (1.2.0)
|
43
|
+
mini_portile (0.6.2)
|
44
|
+
minitest (5.5.1)
|
45
|
+
multi_json (1.10.1)
|
46
|
+
multi_xml (0.5.5)
|
47
|
+
multipart-post (2.0.0)
|
48
|
+
nokogiri (1.6.6.1)
|
49
|
+
mini_portile (~> 0.6.0)
|
50
|
+
oauth2 (1.0.0)
|
51
|
+
faraday (>= 0.8, < 0.10)
|
52
|
+
jwt (~> 1.0)
|
53
|
+
multi_json (~> 1.3)
|
54
|
+
multi_xml (~> 0.5)
|
55
|
+
rack (~> 1.2)
|
56
|
+
rack (1.6.0)
|
57
|
+
rake (10.4.2)
|
58
|
+
rdoc (4.2.0)
|
59
|
+
shoulda (3.5.0)
|
60
|
+
shoulda-context (~> 1.0, >= 1.0.1)
|
61
|
+
shoulda-matchers (>= 1.4.1, < 3.0)
|
62
|
+
shoulda-context (1.2.1)
|
63
|
+
shoulda-matchers (2.7.0)
|
64
|
+
activesupport (>= 3.0.0)
|
65
|
+
simplecov (0.9.1)
|
66
|
+
docile (~> 1.1.0)
|
67
|
+
multi_json (~> 1.0)
|
68
|
+
simplecov-html (~> 0.8.0)
|
69
|
+
simplecov-html (0.8.0)
|
70
|
+
thread_safe (0.3.4)
|
71
|
+
tzinfo (1.2.2)
|
72
|
+
thread_safe (~> 0.1)
|
73
|
+
|
74
|
+
PLATFORMS
|
75
|
+
ruby
|
76
|
+
|
77
|
+
DEPENDENCIES
|
78
|
+
bundler (~> 1.7.12, >= 1.7.12)
|
79
|
+
httparty (~> 0.13.3, >= 0.13.3)
|
80
|
+
jeweler (~> 2.0.1, >= 2.0.1)
|
81
|
+
rdoc (~> 4.2.0, >= 4.2.0)
|
82
|
+
shoulda (~> 3.5.0, >= 3.5.0)
|
83
|
+
simplecov (~> 0.9.1, >= 0.9.1)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2015 Scott Stamp
|
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.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= atetracks-gem
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to atetracks-gem
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
9
|
+
* Fork the project.
|
10
|
+
* Start a feature/bugfix branch.
|
11
|
+
* Commit and push until you are happy with your contribution.
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* 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.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2015 Scott Stamp. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,51 @@
|
|
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://guides.rubygems.org/specification-reference/ for more options
|
17
|
+
gem.name = 'atetracks'
|
18
|
+
gem.homepage = 'http://atetracks.info'
|
19
|
+
gem.license = 'MIT'
|
20
|
+
gem.summary = %Q{ateTracks Core}
|
21
|
+
gem.description = %Q{ateTracks Core library for use by ateTracks.info as a generic 8tracks.com API extension}
|
22
|
+
gem.email = 'scott@hypermine.com'
|
23
|
+
gem.authors = ['Scott Stamp']
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
desc 'Code coverage detail'
|
36
|
+
task :simplecov do
|
37
|
+
ENV['COVERAGE'] = 'true'
|
38
|
+
Rake::Task['test'].execute
|
39
|
+
end
|
40
|
+
|
41
|
+
task :default => :test
|
42
|
+
|
43
|
+
require 'rdoc/task'
|
44
|
+
Rake::RDocTask.new do |rdoc|
|
45
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ''
|
46
|
+
|
47
|
+
rdoc.rdoc_dir = 'rdoc'
|
48
|
+
rdoc.title = "atetracks #{version}"
|
49
|
+
rdoc.rdoc_files.include('README*')
|
50
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
51
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/atetracks.gemspec
ADDED
@@ -0,0 +1,69 @@
|
|
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
|
+
# stub: atetracks 0.1.0 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "atetracks"
|
9
|
+
s.version = "0.1.0"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
s.authors = ["Scott Stamp"]
|
14
|
+
s.date = "2015-01-23"
|
15
|
+
s.description = "ateTracks Core library for use by ateTracks.info as a generic 8tracks.com API extension"
|
16
|
+
s.email = "scott@hypermine.com"
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE.txt",
|
19
|
+
"README.rdoc"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
"Gemfile",
|
24
|
+
"Gemfile.lock",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.rdoc",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"lib/atetracks.rb",
|
30
|
+
"lib/atetracks/helpers.rb",
|
31
|
+
"lib/atetracks/requests.rb",
|
32
|
+
"lib/atetracks/structures.rb",
|
33
|
+
"lib/atetracks/version.rb",
|
34
|
+
"test/helper.rb",
|
35
|
+
"test/test_atetracks-gem.rb"
|
36
|
+
]
|
37
|
+
s.homepage = "http://atetracks.info"
|
38
|
+
s.licenses = ["MIT"]
|
39
|
+
s.rubygems_version = "2.4.5"
|
40
|
+
s.summary = "ateTracks Core"
|
41
|
+
|
42
|
+
if s.respond_to? :specification_version then
|
43
|
+
s.specification_version = 4
|
44
|
+
|
45
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
|
+
s.add_runtime_dependency(%q<httparty>, [">= 0.13.3", "~> 0.13.3"])
|
47
|
+
s.add_development_dependency(%q<shoulda>, [">= 3.5.0", "~> 3.5.0"])
|
48
|
+
s.add_development_dependency(%q<rdoc>, [">= 4.2.0", "~> 4.2.0"])
|
49
|
+
s.add_development_dependency(%q<bundler>, [">= 1.7.12", "~> 1.7.12"])
|
50
|
+
s.add_development_dependency(%q<jeweler>, [">= 2.0.1", "~> 2.0.1"])
|
51
|
+
s.add_development_dependency(%q<simplecov>, [">= 0.9.1", "~> 0.9.1"])
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<httparty>, [">= 0.13.3", "~> 0.13.3"])
|
54
|
+
s.add_dependency(%q<shoulda>, [">= 3.5.0", "~> 3.5.0"])
|
55
|
+
s.add_dependency(%q<rdoc>, [">= 4.2.0", "~> 4.2.0"])
|
56
|
+
s.add_dependency(%q<bundler>, [">= 1.7.12", "~> 1.7.12"])
|
57
|
+
s.add_dependency(%q<jeweler>, [">= 2.0.1", "~> 2.0.1"])
|
58
|
+
s.add_dependency(%q<simplecov>, [">= 0.9.1", "~> 0.9.1"])
|
59
|
+
end
|
60
|
+
else
|
61
|
+
s.add_dependency(%q<httparty>, [">= 0.13.3", "~> 0.13.3"])
|
62
|
+
s.add_dependency(%q<shoulda>, [">= 3.5.0", "~> 3.5.0"])
|
63
|
+
s.add_dependency(%q<rdoc>, [">= 4.2.0", "~> 4.2.0"])
|
64
|
+
s.add_dependency(%q<bundler>, [">= 1.7.12", "~> 1.7.12"])
|
65
|
+
s.add_dependency(%q<jeweler>, [">= 2.0.1", "~> 2.0.1"])
|
66
|
+
s.add_dependency(%q<simplecov>, [">= 0.9.1", "~> 0.9.1"])
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
data/lib/atetracks.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'httparty'
|
3
|
+
require_relative 'structures'
|
4
|
+
|
5
|
+
module AteTracks
|
6
|
+
class Requests
|
7
|
+
attr_accessor :play_token
|
8
|
+
|
9
|
+
include HTTParty
|
10
|
+
include Structures
|
11
|
+
default_params format: 'jsonh'
|
12
|
+
base_uri '8tracks.com'
|
13
|
+
|
14
|
+
def initialize(play_token=get_play_token.content.play_token)
|
15
|
+
@play_token = play_token
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_play_token
|
19
|
+
data = self.class.get('/sets/new')
|
20
|
+
Response.new(data, 'PlayToken')
|
21
|
+
end
|
22
|
+
|
23
|
+
def explore_mixes(sort='popular', scope='all', include='pagination,mixes[likes_count,user,length],details')
|
24
|
+
data = self.class.get("/explore/#{scope}/#{sort}", query: {include: include})
|
25
|
+
Response.new(data, 'MixSet')
|
26
|
+
end
|
27
|
+
|
28
|
+
def mix_info(params, by_id=false)
|
29
|
+
if by_id
|
30
|
+
data = self.class.get("/mixes/#{params[:id]}")
|
31
|
+
else
|
32
|
+
data = self.class.get("/#{params[:user]}/#{params[:mix_name]}")
|
33
|
+
end
|
34
|
+
Response.new(data, 'Mix')
|
35
|
+
end
|
36
|
+
|
37
|
+
def track(mix_id, action='play', include='track[faved,annotation,artist_details]')
|
38
|
+
data = self.class.get("/sets/#{@play_token}/#{action}", query: {include: include, mix_id: mix_id})
|
39
|
+
Response.new(data, 'Set')
|
40
|
+
end
|
41
|
+
|
42
|
+
def raw_track(mix_id, action='play', include='track[faved,annotation,artist_details]')
|
43
|
+
self.class.get("/sets/#{@play_token}/#{action}", query: {include: include, mix_id: mix_id}).body
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,319 @@
|
|
1
|
+
require_relative 'helpers'
|
2
|
+
|
3
|
+
module AteTracks
|
4
|
+
module Structures
|
5
|
+
def self.not_empty?(array)
|
6
|
+
(array.is_a?(Array) && array.length > 0)
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.populate(data, object)
|
10
|
+
data.map { |elem| object.new(elem) }
|
11
|
+
end
|
12
|
+
|
13
|
+
class Response
|
14
|
+
attr_accessor :content, :status, :errors, :notices, :logged_in, :api_version
|
15
|
+
|
16
|
+
def initialize(data, type)
|
17
|
+
class_type = Structures.const_get(type)
|
18
|
+
if class_type
|
19
|
+
@content = class_type.new(data[Helpers.underscore(type)])
|
20
|
+
@status = data['status']
|
21
|
+
@errors = data['errors']
|
22
|
+
@notices = data['notices']
|
23
|
+
@logged_in = data['logged_in']
|
24
|
+
@api_version = data['api_version']
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class PlayToken
|
30
|
+
attr_accessor :play_token
|
31
|
+
def initialize(data)
|
32
|
+
return nil if data.nil?
|
33
|
+
@play_token = data
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class Set
|
38
|
+
attr_accessor :at_beginning, :at_end, :at_last_track, :skip_allowed, :track
|
39
|
+
|
40
|
+
def initialize(data)
|
41
|
+
return nil if data.nil?
|
42
|
+
@at_beginning = data['at_beginning']
|
43
|
+
@at_end = data['at_end']
|
44
|
+
@at_last_track = data['at_last_track']
|
45
|
+
@skip_allowed = data['skip_allowed']
|
46
|
+
@track = Track.new(data['track'])
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class Track
|
51
|
+
attr_accessor :track_annotation, :artist_details, :buy_link, :buy_icon, :buy_text, :track_file_stream_url,
|
52
|
+
:stream_source, :user_id, :full_length, :id, :name, :performer, :release_name, :url, :year,
|
53
|
+
:uid, :report_delay_s, :media_type
|
54
|
+
|
55
|
+
def initialize(data)
|
56
|
+
return nil if data.nil?
|
57
|
+
@track_annotation = data['track_annotation']
|
58
|
+
@artist_details = ArtistDetails.new(data['artist_details'])
|
59
|
+
@buy_link = data['buy_link']
|
60
|
+
@buy_icon = data['buy_icon']
|
61
|
+
@buy_text = data['buy_text']
|
62
|
+
@track_file_stream_url = data['track_file_stream_url']
|
63
|
+
@stream_source = data['stream_source']
|
64
|
+
@user_id = data['user_id']
|
65
|
+
@full_length = data['full_length']
|
66
|
+
@id = data['id']
|
67
|
+
@name = data['name']
|
68
|
+
@performer = data['performer']
|
69
|
+
@release_name = data['release_name']
|
70
|
+
@url = data['url']
|
71
|
+
@year = data['year']
|
72
|
+
@uid = data['uid']
|
73
|
+
@report_delay_s = data['report_delay_s']
|
74
|
+
|
75
|
+
unless @track_file_stream_url.nil?
|
76
|
+
@media_type = (@track_file_stream_url == 'upload_v3') ? 'm4a' : 'mp3'
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
class ArtistDetails
|
82
|
+
attr_accessor :twitter_username, :official_url, :wikipedia_url, :location, :years_active, :name, :bio_intro,
|
83
|
+
:bio_url, :image_url, :imgix_url, :url, :info_source
|
84
|
+
|
85
|
+
def initialize(data)
|
86
|
+
return nil if data.nil?
|
87
|
+
@twitter_username = data['twitter_username']
|
88
|
+
@official_url = data['official_url']
|
89
|
+
@wikipedia_url = data['wikipedia_url']
|
90
|
+
@location = data['location']
|
91
|
+
@years_active = data['years_active']
|
92
|
+
@name = data['name']
|
93
|
+
@bio_intro = data['bio_intro']
|
94
|
+
@bio_url = data['bio_url']
|
95
|
+
@image_url = data['image_url']
|
96
|
+
@imgix_url = data['imgix_url']
|
97
|
+
@url = data['url']
|
98
|
+
@info_source = InfoSource.new(data['info_source'])
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
class InfoSource
|
103
|
+
attr_accessor :source, :id, :bio_source
|
104
|
+
|
105
|
+
def initialize(data)
|
106
|
+
return nil if data.nil?
|
107
|
+
@source = data['source']
|
108
|
+
@id = data['id']
|
109
|
+
@bio_source = data['bio_source']
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
class MixSet
|
114
|
+
attr_accessor :pagination, :mixes, :filters
|
115
|
+
|
116
|
+
def initialize(data)
|
117
|
+
return nil if data.nil?
|
118
|
+
@pagination = Pagination.new(data['pagination'])
|
119
|
+
@mixes = []
|
120
|
+
if Structures::not_empty?(data['mixes'])
|
121
|
+
@mixes = Structures::populate(data['mixes'], Mix)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
class Mix
|
127
|
+
attr_accessor :description_html, :likes_count, :certification, :user, :duration, :tracks_count, :nsfw,
|
128
|
+
:genres, :artists, :id, :published, :cover_urls, :description, :plays_count, :tag_list_cache,
|
129
|
+
:first_published_at, :first_published_at_timestamp, :is_promoted, :has_genres, :has_artists,
|
130
|
+
:name, :path, :web_path
|
131
|
+
|
132
|
+
def initialize(data)
|
133
|
+
return nil if data.nil?
|
134
|
+
@description_html = data['description_html']
|
135
|
+
@likes_count = data['likes_count']
|
136
|
+
@certification = data['certification']
|
137
|
+
@user = User.new(data['user'])
|
138
|
+
@duration = data['duration']
|
139
|
+
@tracks_count = data['tracks_count']
|
140
|
+
@nsfw = data['nsfw']
|
141
|
+
@genres = data['genres']
|
142
|
+
@artists = data['artists']
|
143
|
+
@id = data['id']
|
144
|
+
@published = data['published']
|
145
|
+
@cover_urls = CoverURLs.new(data['cover_urls'])
|
146
|
+
@description = data['description']
|
147
|
+
@plays_count = data['plays_count']
|
148
|
+
@tag_list_cache = data['tag_list_cache']
|
149
|
+
@first_published_at = data['first_published_at']
|
150
|
+
@first_published_at_timestamp = data['first_published_at_timestamp']
|
151
|
+
@is_promoted = data['is_promoted']
|
152
|
+
@has_genres = data['has_genres']
|
153
|
+
@has_artists = data['has_artists']
|
154
|
+
@name = data['name']
|
155
|
+
@path = data['path']
|
156
|
+
@web_path = data['web_path']
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
class User
|
161
|
+
attr_accessor :id, :login, :path, :web_path, :avatar_urls, :location, :bio_html, :website, :country,
|
162
|
+
:member_since, :bio
|
163
|
+
|
164
|
+
def initialize(data)
|
165
|
+
return nil if data.nil?
|
166
|
+
@id = data['id']
|
167
|
+
@login = data['login']
|
168
|
+
@path = data['path']
|
169
|
+
@web_path = data['web_path']
|
170
|
+
@avatar_urls = AvatarURLs.new(data['avatar_urls'])
|
171
|
+
@location = data['location']
|
172
|
+
@bio_html = data['bio_html']
|
173
|
+
@website = data['website']
|
174
|
+
@country = data['country']
|
175
|
+
@member_since = data['member_since']
|
176
|
+
@bio = data['bio']
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
class UserMixes
|
181
|
+
attr_accessor :mixes, :pagination, :smart_id, :smart_type, :path, :name, :web_path, :sort, :mix_set_id
|
182
|
+
|
183
|
+
def initialize(data)
|
184
|
+
return nil if data.nil?
|
185
|
+
@mixes = []
|
186
|
+
@pagination = Pagination.new(data['pagination'])
|
187
|
+
@smart_id = data['smart_id']
|
188
|
+
@smart_type = data['smart_type']
|
189
|
+
@path = data['path']
|
190
|
+
@name = data['name']
|
191
|
+
@web_path = data['web_path']
|
192
|
+
@sort = data['sort']
|
193
|
+
@mix_set_id = data['mix_set_id']
|
194
|
+
|
195
|
+
if Structures::not_empty?(data['mixes'])
|
196
|
+
@mixes = Structures::populate(data['mixes'], Mix)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
class SimilarMixes
|
202
|
+
attr_accessor :mixes, :smart_id
|
203
|
+
|
204
|
+
def initialize(data)
|
205
|
+
return nil if data.nil?
|
206
|
+
@mixes = []
|
207
|
+
@smart_id = data['smart_id']
|
208
|
+
|
209
|
+
if Structures::not_empty?(data['mixes'])
|
210
|
+
@mixes = Structures::populate(data['mixes'], Mix)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
class RelatedCollections
|
216
|
+
attr_accessor :collections
|
217
|
+
|
218
|
+
def initialize(data)
|
219
|
+
return nil if data.nil?
|
220
|
+
@collections = []
|
221
|
+
|
222
|
+
if Structures::not_empty?(data['collections'])
|
223
|
+
@collections = Structures::populate(data['@collections'], Collection)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
class Pagination
|
229
|
+
attr_accessor :current_page, :per_page, :offset_by, :next_page, :previous_page, :total_entries,
|
230
|
+
:total_pages, :next_page_path
|
231
|
+
|
232
|
+
def initialize(data)
|
233
|
+
return nil if data.nil?
|
234
|
+
@current_page = data['current_page']
|
235
|
+
@per_page = data['per_page']
|
236
|
+
@offset_by = data['offset_by']
|
237
|
+
@next_page = data['next_page']
|
238
|
+
@previous_page = data['previous_page']
|
239
|
+
@total_entries = data['total_entries']
|
240
|
+
@total_pages = data['total_pages']
|
241
|
+
@next_page_path = data['next_page_path']
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
class Filter
|
246
|
+
attr_accessor :color1, :color2, :name
|
247
|
+
|
248
|
+
def initialize(data)
|
249
|
+
return nil if data.nil?
|
250
|
+
@color1 = data['color1']
|
251
|
+
@color2 = data['color2']
|
252
|
+
@name = data['name']
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
class Collection
|
257
|
+
attr_accessor :tag_list_cache, :cover_urls, :duration, :user, :id, :smart_id, :name, :slug, :mixes_count,
|
258
|
+
:web_path, :description, :updated_at
|
259
|
+
|
260
|
+
def initialize(data)
|
261
|
+
return nil if data.nil?
|
262
|
+
@tag_list_cache = data['tag_list_cache']
|
263
|
+
@cover_urls = data['cover_urls']
|
264
|
+
@duration = data['duration']
|
265
|
+
@user = data['user']
|
266
|
+
@id = data['id']
|
267
|
+
@smart_id = data['smart_id']
|
268
|
+
@name = data['name']
|
269
|
+
@slug = data['slug']
|
270
|
+
@mixes_count = data['mixes_count']
|
271
|
+
@web_path = data['web_path']
|
272
|
+
@description = data['description']
|
273
|
+
@updated_at = data['updated_at']
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
class AvatarURLs
|
278
|
+
attr_accessor :original, :original_imgix_url, :static_cropped_imgix_url, :cropped_imgix_url, :sq56, :sq72,
|
279
|
+
:sq100, :max200, :max250w, :discourse, :animated
|
280
|
+
|
281
|
+
def initialize(data)
|
282
|
+
return nil if data.nil?
|
283
|
+
@original = data['original']
|
284
|
+
@original_imgix_url = data['original_imgix_url']
|
285
|
+
@static_cropped_imgix_url = data['static_cropped_imgix_url']
|
286
|
+
@cropped_imgix_url = data['cropped_imgix_url']
|
287
|
+
@sq56 = data['sq56']
|
288
|
+
@sq72 = data['sq72']
|
289
|
+
@sq100 = data['sq100']
|
290
|
+
@max200 = data['max200']
|
291
|
+
@max250w = data['max250w']
|
292
|
+
@discourse = data['discourse']
|
293
|
+
@animated = data['animated']
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
class CoverURLs
|
298
|
+
attr_accessor :original, :original_imgix_url, :static_cropped_imgix_url, :cropped_imgix_url, :sq56, :sq72,
|
299
|
+
:sq100, :sq133, :max133w, :max200, :sq250, :sq500, :max1024
|
300
|
+
|
301
|
+
def initialize(data)
|
302
|
+
return nil if data.nil?
|
303
|
+
@original = data['original']
|
304
|
+
@original_imgix_url = data['original_imgix_url']
|
305
|
+
@static_cropped_imgix_url = data['static_cropped_imgix_url']
|
306
|
+
@cropped_imgix_url = data['cropped_imgix_url']
|
307
|
+
@sq56 = data['sq56']
|
308
|
+
@sq72 = data['sq72']
|
309
|
+
@sq100 = data['sq100']
|
310
|
+
@sq133 = data['sq133']
|
311
|
+
@max133w = data['max133w']
|
312
|
+
@max200 = data['max200']
|
313
|
+
@sq250 = data['sq250']
|
314
|
+
@sq500 = data['sq500']
|
315
|
+
@max1024 = data['max1024']
|
316
|
+
end
|
317
|
+
end
|
318
|
+
end
|
319
|
+
end
|
metadata
ADDED
@@ -0,0 +1,179 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: atetracks
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Scott Stamp
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.13.3
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.13.3
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.13.3
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.13.3
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: shoulda
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 3.5.0
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 3.5.0
|
43
|
+
type: :development
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 3.5.0
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 3.5.0
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: rdoc
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 4.2.0
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 4.2.0
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 4.2.0
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 4.2.0
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
name: bundler
|
75
|
+
requirement: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 1.7.12
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.7.12
|
83
|
+
type: :development
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.7.12
|
90
|
+
- - "~>"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 1.7.12
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: jeweler
|
95
|
+
requirement: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 2.0.1
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 2.0.1
|
103
|
+
type: :development
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 2.0.1
|
110
|
+
- - "~>"
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 2.0.1
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: simplecov
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: 0.9.1
|
120
|
+
- - "~>"
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 0.9.1
|
123
|
+
type: :development
|
124
|
+
prerelease: false
|
125
|
+
version_requirements: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: 0.9.1
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 0.9.1
|
133
|
+
description: ateTracks Core library for use by ateTracks.info as a generic 8tracks.com
|
134
|
+
API extension
|
135
|
+
email: scott@hypermine.com
|
136
|
+
executables: []
|
137
|
+
extensions: []
|
138
|
+
extra_rdoc_files:
|
139
|
+
- LICENSE.txt
|
140
|
+
- README.rdoc
|
141
|
+
files:
|
142
|
+
- ".document"
|
143
|
+
- Gemfile
|
144
|
+
- Gemfile.lock
|
145
|
+
- LICENSE.txt
|
146
|
+
- README.rdoc
|
147
|
+
- Rakefile
|
148
|
+
- VERSION
|
149
|
+
- atetracks.gemspec
|
150
|
+
- lib/atetracks.rb
|
151
|
+
- lib/atetracks/helpers.rb
|
152
|
+
- lib/atetracks/requests.rb
|
153
|
+
- lib/atetracks/structures.rb
|
154
|
+
- lib/atetracks/version.rb
|
155
|
+
homepage: http://atetracks.info
|
156
|
+
licenses:
|
157
|
+
- MIT
|
158
|
+
metadata: {}
|
159
|
+
post_install_message:
|
160
|
+
rdoc_options: []
|
161
|
+
require_paths:
|
162
|
+
- lib
|
163
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
173
|
+
requirements: []
|
174
|
+
rubyforge_project:
|
175
|
+
rubygems_version: 2.4.5
|
176
|
+
signing_key:
|
177
|
+
specification_version: 4
|
178
|
+
summary: ateTracks Core
|
179
|
+
test_files: []
|