monstercat 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6c3f4bf3f3421a4601783418270be1131fb04977
4
+ data.tar.gz: 82ce8aa1c40356c91a5a754bb089c514ed7e5119
5
+ SHA512:
6
+ metadata.gz: 236a6eb0d9ca0df3e25d06f2012d9d17010649ca3f7b5c4aeed0533190e340e6aca06df385319130bda3cacad58218b41b07e6c2717184e9418d70aaff60c5eb
7
+ data.tar.gz: 29f6b2ad7666215a69ba4494deda3825aa6f86db62b103b91ebde10c99906317bcb588a4a7bd7e3fcd6b2733cc465c14b304df3db9dab82144e38f3d18b70c55
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,13 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.0
5
+ before_install: gem install bundler -v 1.14.6
6
+ deploy:
7
+ provider: rubygems
8
+ api_key:
9
+ secure: PFjTjZZBdqtY+/RU+Nh4LRrnk6IFhJDfYLaLg9EVvbm5+bT2MO9xkv54TteCk91fgOiz2i9rIIpUTR8r0Vzux9/hkq6t6wZ7q5TausoiF9VHpfdI8Z60tsVACKbNo8Ui3hTZ8p2YU+VfKl0HBFQbrQUiP660XQcYMoJ0z12Grezs/P3w7agpqo++HWmWmCePeJztfOJT/gxL3zrFCDihC75muG2qv1hILH/N+FVHfT7TofsLPiNBHMNQo2mCGp10LVZzeCb+d/ECJWDCMdrDzWJgnxLAFe4CyLKPVJrMnDxHzOIyOTea44Q7V7GGimH1N7wamUPjfaBarreXHTtR4MoeGqes1vswAANbnez/4mRkOjsh9bmd8dB67PQoLOKJAFbOJaTOGy/ex0le78WQRR9rORLbsYwHBfNh4QgyHSYOG/cExHbsZSxeQ1vK9sOlqKv0Ck1jmE2ixOeW6SB0CYUTL6e0u777zrMxyKPClyZG87KJC8pKB562fGFNli7w5meshfSiv9t/DX2d4MhE5assJ0Oaw3aRqSJHYSRfup8Gtz9940vmrHzfcXf+bfCITcuKGJnNI9XD/a3dS1wruq3nPUwkV/UvWG9NwRWbtjzEyMN7FpOXL5/+f9Vx/HSTVoaRnJ6OdNmyjJfak+kFybvcvkKFBVyQfUG3D8f70jg=
10
+ gem: monstercat
11
+ on:
12
+ tags: true
13
+ repo: cameronbroe/monstercat
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in monstercat-api.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Cameron Roe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,41 @@
1
+ [![Build Status](https://travis-ci.org/cameronbroe/monstercat.svg?branch=master)](https://travis-ci.org/cameronbroe/monstercat)
2
+
3
+ # Monstercat
4
+
5
+ A simple to use Ruby gem for accessing the Monstercat Connect API.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'monstercat'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install monstercat
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`.
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/cameronbroe/monstercat.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "monstercat"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ require "pry"
11
+ Pry.start
12
+
13
+ #require "irb"
14
+ #IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,7 @@
1
+ require 'monstercat/version'
2
+ require 'monstercat/client'
3
+
4
+ require 'monstercat/catalog'
5
+ require 'monstercat/catalog/track'
6
+ require 'monstercat/catalog/release'
7
+ require 'monstercat/catalog/artist'
@@ -0,0 +1,9 @@
1
+ module Monstercat
2
+ module Catalog
3
+ @client = Client.new("catalog")
4
+
5
+ def self.client
6
+ @client
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,21 @@
1
+ module Monstercat
2
+ module Catalog
3
+ class Artist
4
+ def initialize
5
+ @client = Monstercat::Catalog.client
6
+ end
7
+
8
+ def all(options = {})
9
+ @client.class.get("#{@client.endpoint}/artist", @client.process_options(options))
10
+ end
11
+
12
+ def find(id, options = {})
13
+ @client.class.get("#{@client.endpoint}/artist/#{id}", @client.process_options(options))
14
+ end
15
+
16
+ def releases(id, options = {})
17
+ @client.class.get("#{@client.endpoint}/artist/#{id}/releases", @client.process_options(options))
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ module Monstercat
2
+ module Catalog
3
+ class Release
4
+ def initialize
5
+ @client = Monstercat::Catalog.client
6
+ end
7
+
8
+ def all(options = {})
9
+ @client.class.get("#{@client.endpoint}/release", @client.process_options(options))
10
+ end
11
+
12
+ def find(id, options = {})
13
+ @client.class.get("#{@client.endpoint}/release/#{id}", @client.process_options(options))
14
+ end
15
+
16
+ def tracks(id, options = {})
17
+ @client.class.get("#{@client.endpoint}/release/#{id}/tracks", @client.process_options(options))
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,17 @@
1
+ module Monstercat
2
+ module Catalog
3
+ class Track
4
+ def initialize
5
+ @client = Monstercat::Catalog.client
6
+ end
7
+
8
+ def all(options = {})
9
+ @client.class.get("#{@client.endpoint}/track", @client.process_options(options))
10
+ end
11
+
12
+ def find(id, options={})
13
+ @client.class.get("#{@client.endpoint}/track/#{id}", @client.process_options(options))
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,50 @@
1
+ require 'httparty'
2
+ module Monstercat
3
+ class Client
4
+ include HTTParty
5
+ base_uri 'connect.monstercat.com'
6
+
7
+ API_PREFIX = "api"
8
+
9
+ def initialize(endpoint=nil)
10
+ @endpoint ||= endpoint
11
+ end
12
+
13
+ def endpoint(endpoint=nil)
14
+ @endpoint ||= endpoint if endpoint
15
+
16
+ unless endpoint then
17
+ "/#{API_PREFIX}/#{@endpoint}"
18
+ end
19
+ end
20
+
21
+ def process_options(options = {})
22
+ new_options = options
23
+ if options.has_key? :fields then
24
+ if options[:fields].class == Array then
25
+ new_options[:fields] = options[:fields].join(",")
26
+ end
27
+ end
28
+
29
+ if options.has_key? :ids then
30
+ if options[:ids].class == Array then
31
+ new_options[:ids] = options[:ids].join(",")
32
+ end
33
+ end
34
+
35
+ if options.has_key? :fuzzy then
36
+ if options[:fuzzy].class == Hash then
37
+ new_options[:fuzzy] = options[:fuzzy].to_a.flatten.join(",")
38
+ end
39
+ end
40
+
41
+ if options.has_key? :filter then
42
+ if options[:filter].class == Hash then
43
+ new_options[:filter] = options[:filter].to_a.flatten.join(",")
44
+ end
45
+ end
46
+
47
+ return { query: new_options }
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,3 @@
1
+ module Monstercat
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'monstercat/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "monstercat"
8
+ spec.version = Monstercat::VERSION
9
+ spec.authors = ["Cameron Roe"]
10
+ spec.email = ["cameron@cameronbroe.com"]
11
+
12
+ spec.summary = %q{A simple Ruby gem for accessing Monstercat's Connect API}
13
+ spec.homepage = "http://cameronbroe.com"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_dependency "httparty", "~> 0.14"
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.14"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "rspec", "~> 3.0"
28
+ spec.add_development_dependency "pry"
29
+ end
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: monstercat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Cameron Roe
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-05-09 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.14'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.14'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.14'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.14'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description:
84
+ email:
85
+ - cameron@cameronbroe.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".travis.yml"
93
+ - Gemfile
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - bin/console
98
+ - bin/setup
99
+ - lib/monstercat.rb
100
+ - lib/monstercat/catalog.rb
101
+ - lib/monstercat/catalog/artist.rb
102
+ - lib/monstercat/catalog/release.rb
103
+ - lib/monstercat/catalog/track.rb
104
+ - lib/monstercat/client.rb
105
+ - lib/monstercat/version.rb
106
+ - monstercat.gemspec
107
+ homepage: http://cameronbroe.com
108
+ licenses:
109
+ - MIT
110
+ metadata: {}
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 2.6.12
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: A simple Ruby gem for accessing Monstercat's Connect API
131
+ test_files: []