-
Notifications
You must be signed in to change notification settings - Fork 5
/
console.rb
37 lines (28 loc) · 1 KB
/
console.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# frozen_string_literal: true
# To run this file over irb:
# bundle exec irb -r './console.rb'
#
require "musicbrainz"
require "amazing_print"
email = `git config --get user.email`.strip
raise MusicBrainz::InvalidConfiguration if email.nil? || email.length.zero?
MusicBrainz.configure do |c|
c.app_name = "MusicBrainz Test"
c.app_version = MusicBrainz::VERSION
c.contact = `git config --get user.email`.strip
# c.use :instrumentation
# c.response :caching, ActiveSupport::Cache.lookup_store(:file_store, "./tmp/cache")
end
def client
@client ||= MusicBrainz::Client.new
end
puts <<~HEREDOC
`client` is initialized.
Usage examples :
client.artist '5b11f4ce-a62d-471e-81fc-a69a8278c7da'
client.artists 'Nirvana'
client.artists q: { artist: 'Nirvana', country: 'se' }
client.artists q: { artist: '30 seconds to mars', alias: '30 seconds to mars' }, operator: 'OR'
client.artists q: { tag: 'Punk' }, limit: 2
client.artists release: '7a7b7bb2-5abe-3088-9e3e-6bfd54035138'
HEREDOC