setlistfm 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.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.rubocop.yml +9 -0
- data/.travis.yml +9 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +88 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/setlistfm/api_method.rb +61 -0
- data/lib/setlistfm/request.rb +25 -0
- data/lib/setlistfm/version.rb +11 -0
- data/lib/setlistfm.rb +18 -0
- data/setlistfm.gemspec +33 -0
- metadata +171 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1a39d918809d71426702a5101a77abce087c2160
|
4
|
+
data.tar.gz: 7f226bf629447d2095514fc193b5d20ef0d0bf5b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 01dce6aa3e9d3dfe8918153d07fbbd474b7f8fb654b79fc2ac70340bac61af3a719f4b4c829330ecac9062988321d8b77c849e0faf41ecf2e42e54a65d582509
|
7
|
+
data.tar.gz: 66def2dac41d8e1940a67cc04bad7af1b1db9f54d56353d062fbc1d2b1e8431c70028dc7c297c783717518f8cfbede5b234df8b226871a132d27dbc8dae37ef0
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
sudo: false
|
2
|
+
language: ruby
|
3
|
+
rvm:
|
4
|
+
- 2.4.2
|
5
|
+
- 2.3.0
|
6
|
+
before_install: gem install bundler -v 1.15.4
|
7
|
+
notifications:
|
8
|
+
slack:
|
9
|
+
secure: mCTEIgsHvHbsXl9BwJkD0RXMb/tPvw0dBKec0E1DCe0ek6ksx0r0VLvYM+9R/PuYHs0JTCOTWD/onWwwjZ0JYjqPca5AuEM7hRW2ZOHW+5PMLzKRcG5moOoUcnNAA8qKba3iqCnWLS7N2nwbo2m4xLPbQ70KIMFfzocjymbH1/38NKYn7h6ekQO5zQSQY1eEpgoK5xMCevwxZKIDuGM7DDxJOZBaPchOYi00ecj+cq/afgCce16Aib9vhiDcyivXSxynFQwq78ipnnuG2lORiteZbMK/IoHGP21eT7GdHi7stDg6Ia1BNm4rPqa5dh549AzD+FIhnEcUMID98A354xc+S7kaSv1G0fe0jXoL+9DDsPl1aBZ0I/zLMP1delazKVS7WZD+UsRCme80aFeMEQlbMw8+qhigeA275w83mWdNTYEvFGBfyzIB0ShpwNfiW06M8yM+GLusoXTKjuxMPG1oUKpb5xdkNN5zOM42MqufL0Sj6il0dxr7jBN7nJ/+fgpIuBUeDuFJt2iQ1ycU1yI/T/wE25ox6HQc8teyJUrdOW9WbGh8O736SsHrqCCJFBhzNOtYixqNWlFaamJXAZ83oiW5oR2gcxbRbU4rjQ8WIhBwZ9RrWnZntj/mpzQePrteSaQZAFdYhBdoRw2CfRfvlXLtJ58eBNvh+/SkIS8=
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Hondallica
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
# Setlistfm [](https://travis-ci.org/hondallica/ruby-setlistfm)
|
2
|
+
|
3
|
+
setlist.fm API client library.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install setlistfm
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'setlistfm'
|
13
|
+
```
|
14
|
+
|
15
|
+
### Setting API key
|
16
|
+
You must set the API key.
|
17
|
+
|
18
|
+
Please refer to the [official API documentation](https://api.setlist.fm/docs/1.0/index.html) on how to get API key.
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
setlistfm = Setlistfm.new('your_api_key')
|
22
|
+
```
|
23
|
+
|
24
|
+
If environment variable SETLISTFM_API_KEY is set in .bash_profile etc, no argument is necessary.
|
25
|
+
|
26
|
+
export SETLISTFM_API_KEY=your_api_key
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
setlistfm = Setlistfm.new
|
30
|
+
```
|
31
|
+
|
32
|
+
### change API key
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
setlistfm.api_key = 'new_api_key'
|
36
|
+
```
|
37
|
+
|
38
|
+
## API URL
|
39
|
+
### get API URL
|
40
|
+
```ruby
|
41
|
+
setlistfm.url # https://api.setlist.fm
|
42
|
+
```
|
43
|
+
|
44
|
+
### change API URL
|
45
|
+
```ruby
|
46
|
+
setlistfm.url = 'http://example.com'
|
47
|
+
```
|
48
|
+
|
49
|
+
## API version
|
50
|
+
### get API version
|
51
|
+
```ruby
|
52
|
+
setlistfm.api_version # 1.0
|
53
|
+
```
|
54
|
+
|
55
|
+
### change API version
|
56
|
+
Usually you do not need to change. Use it if the API version is up.
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
setlistfm.api_version = '1.1'
|
60
|
+
```
|
61
|
+
|
62
|
+
### API Resources
|
63
|
+
It supports resources of setlist.fm API version 1.0.
|
64
|
+
Please refer to the [official API documentation](https://api.setlist.fm/docs/1.0/index.html) for available parameters etc.
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
setlistfm.artist('27e2997f-f7a1-4353-bcc4-57b9274fa9a4')
|
68
|
+
setlistfm.artist_setlists('27e2997f-f7a1-4353-bcc4-57b9274fa9a4', {p: 2})
|
69
|
+
setlistfm.city(5357527)
|
70
|
+
setlistfm.search_artists({artistName: 'BABYMETAL'})
|
71
|
+
setlistfm.search_cities({country: 'US'})
|
72
|
+
setlistfm.search_countries
|
73
|
+
setlistfm.search_setlists({artistMbid: '27e2997f-f7a1-4353-bcc4-57b9274fa9a4'})
|
74
|
+
setlistfm.search_venues({name: 'US'})
|
75
|
+
setlistfm.setlist_version('6bd6ca6e')
|
76
|
+
setlistfm.setlist('6bd6ca6e')
|
77
|
+
setlistfm.user('hondallica')
|
78
|
+
setlistfm.user_attended('hondallica')
|
79
|
+
setlistfm.user_edited('hondallica')
|
80
|
+
setlistfm.venue('6bd6ca6e')
|
81
|
+
setlistfm.venue_setlists('6bd6ca6e')
|
82
|
+
```
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
## License
|
87
|
+
|
88
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'setlistfm'
|
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__)
|
data/bin/setup
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
module APIMethod
|
2
|
+
def artist(mbid)
|
3
|
+
http.get("/rest/#{api_version}/artist/#{mbid}")
|
4
|
+
end
|
5
|
+
|
6
|
+
def artist_setlists(mbid, params = {})
|
7
|
+
http.get("/rest/#{api_version}/artist/#{mbid}/setlists", params)
|
8
|
+
end
|
9
|
+
|
10
|
+
def city(geoid)
|
11
|
+
http.get("/rest/#{api_version}/city/#{geoid}")
|
12
|
+
end
|
13
|
+
|
14
|
+
def search_artists(params = {})
|
15
|
+
http.get("/rest/#{api_version}/search/artists", params)
|
16
|
+
end
|
17
|
+
|
18
|
+
def search_cities(params = {})
|
19
|
+
http.get("/rest/#{api_version}/search/cities", params)
|
20
|
+
end
|
21
|
+
|
22
|
+
def search_countries(params = {})
|
23
|
+
http.get("/rest/#{api_version}/search/countries", params)
|
24
|
+
end
|
25
|
+
|
26
|
+
def search_setlists(params = {})
|
27
|
+
http.get("/rest/#{api_version}/search/setlists", params)
|
28
|
+
end
|
29
|
+
|
30
|
+
def search_venues(params = {})
|
31
|
+
http.get("/rest/#{api_version}/search/venues", params)
|
32
|
+
end
|
33
|
+
|
34
|
+
def setlist_version(version_id, params = {})
|
35
|
+
http.get("/rest/#{api_version}/setlist/version/#{version_id}", params)
|
36
|
+
end
|
37
|
+
|
38
|
+
def setlist(setlist_id, params = {})
|
39
|
+
http.get("/rest/#{api_version}/setlist/#{setlist_id}", params)
|
40
|
+
end
|
41
|
+
|
42
|
+
def user(user_id, params = {})
|
43
|
+
http.get("/rest/#{api_version}/user/#{user_id}", params)
|
44
|
+
end
|
45
|
+
|
46
|
+
def user_attended(user_id, params = {})
|
47
|
+
http.get("/rest/#{api_version}/user/#{user_id}/attended", params)
|
48
|
+
end
|
49
|
+
|
50
|
+
def user_edited(user_id, params = {})
|
51
|
+
http.get("/rest/#{api_version}/user/#{user_id}/edited", params)
|
52
|
+
end
|
53
|
+
|
54
|
+
def venue(venue_id, params = {})
|
55
|
+
http.get("/rest/#{api_version}/venue/#{venue_id}", params)
|
56
|
+
end
|
57
|
+
|
58
|
+
def venue_setlists(venue_id, params = {})
|
59
|
+
http.get("/rest/#{api_version}/venue/#{venue_id}/setlists", params)
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'faraday_middleware'
|
3
|
+
|
4
|
+
module Request
|
5
|
+
def base_url(url = 'https://api.setlist.fm')
|
6
|
+
url
|
7
|
+
end
|
8
|
+
|
9
|
+
def http
|
10
|
+
Faraday.new(url: base_url) do |f|
|
11
|
+
f.response :mashify
|
12
|
+
f.response :json
|
13
|
+
f.request :url_encoded
|
14
|
+
f.request :retry, max: 5, interval: 1.0
|
15
|
+
f.options[:open_timeout] = 2
|
16
|
+
f.options[:timeout] = 5
|
17
|
+
f.headers['x-api-key'] = @api_key
|
18
|
+
f.headers['Accept'] = 'application/json'
|
19
|
+
f.headers['User-Agent'] = "ruby-setlistfm/#{version}"
|
20
|
+
f.adapter :net_http
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module_function :base_url
|
25
|
+
end
|
data/lib/setlistfm.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'setlistfm/version'
|
2
|
+
require 'setlistfm/request'
|
3
|
+
require 'setlistfm/api_method'
|
4
|
+
|
5
|
+
class Setlistfm
|
6
|
+
include Version
|
7
|
+
include Request
|
8
|
+
include APIMethod
|
9
|
+
attr_accessor :api_key, :url, :version, :api_version
|
10
|
+
|
11
|
+
def initialize(api_key = ENV['SETLISTFM_API_KEY'])
|
12
|
+
raise 'API key is required' unless api_key
|
13
|
+
@version = Version.version
|
14
|
+
@api_version = Version.api_version
|
15
|
+
@api_key = api_key
|
16
|
+
@url = Request.base_url
|
17
|
+
end
|
18
|
+
end
|
data/setlistfm.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'setlistfm/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'setlistfm'
|
8
|
+
spec.version = Version.version
|
9
|
+
spec.authors = ['Hondallica']
|
10
|
+
spec.email = ['hondallica@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = 'setlist.fm API client library'
|
13
|
+
spec.homepage = 'https://github.com/hondallica/ruby-setlistfm'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
spec.required_ruby_version = '>= 2.3'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = 'exe'
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ['lib']
|
23
|
+
|
24
|
+
spec.add_dependency 'faraday', '~> 0.13.1'
|
25
|
+
spec.add_dependency 'faraday_middleware', '~> 0.12.2'
|
26
|
+
spec.add_dependency 'hashie'
|
27
|
+
|
28
|
+
spec.add_development_dependency 'bundler', '~> 1.15'
|
29
|
+
spec.add_development_dependency 'rake', '12.1.0'
|
30
|
+
spec.add_development_dependency 'rspec', '~> 3.6'
|
31
|
+
spec.add_development_dependency 'rubocop', '0.50.0'
|
32
|
+
spec.add_development_dependency 'webmock', '3.0.1'
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: setlistfm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hondallica
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-10-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.13.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.13.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday_middleware
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.12.2
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.12.2
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: hashie
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.15'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.15'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 12.1.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 12.1.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.6'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.6'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.50.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.50.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: webmock
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 3.0.1
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 3.0.1
|
125
|
+
description:
|
126
|
+
email:
|
127
|
+
- hondallica@gmail.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".gitignore"
|
133
|
+
- ".rspec"
|
134
|
+
- ".rubocop.yml"
|
135
|
+
- ".travis.yml"
|
136
|
+
- Gemfile
|
137
|
+
- LICENSE.txt
|
138
|
+
- README.md
|
139
|
+
- Rakefile
|
140
|
+
- bin/console
|
141
|
+
- bin/setup
|
142
|
+
- lib/setlistfm.rb
|
143
|
+
- lib/setlistfm/api_method.rb
|
144
|
+
- lib/setlistfm/request.rb
|
145
|
+
- lib/setlistfm/version.rb
|
146
|
+
- setlistfm.gemspec
|
147
|
+
homepage: https://github.com/hondallica/ruby-setlistfm
|
148
|
+
licenses:
|
149
|
+
- MIT
|
150
|
+
metadata: {}
|
151
|
+
post_install_message:
|
152
|
+
rdoc_options: []
|
153
|
+
require_paths:
|
154
|
+
- lib
|
155
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '2.3'
|
160
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
requirements: []
|
166
|
+
rubyforge_project:
|
167
|
+
rubygems_version: 2.6.13
|
168
|
+
signing_key:
|
169
|
+
specification_version: 4
|
170
|
+
summary: setlist.fm API client library
|
171
|
+
test_files: []
|