guitarparty_client 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a53868d88895e9ae0dbb3feb498069bf1cf68d5a
4
+ data.tar.gz: bc50b4515b463e854b0d797a1126ae3f426a9d6b
5
+ SHA512:
6
+ metadata.gz: cfb98f91ee3aac10087f4dc9c3f768efbb178518f1e34590eb0d901d71bcac49e3a0ac7982ac1310f5c5c5d2a25799c8a9a6d7bd3be6d29943f9467da8b80b49
7
+ data.tar.gz: c98347a2e8d8ffe7ddee00322284e1ba40e82c566a606d048f2e91372b93429052847c2af714a4d16f9ba5807f0591881902a05a2b4aaa1c73b60e73ef43af9d
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in guitarparty_client.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Toby
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,149 @@
1
+
2
+ ## Installation
3
+
4
+ Add this line to your application's Gemfile:
5
+
6
+ ```ruby
7
+ gem 'guitarparty_client'
8
+ ```
9
+
10
+ And then execute:
11
+
12
+ $ bundle
13
+
14
+ Or install it yourself as:
15
+
16
+ $ gem install guitarparty_client
17
+
18
+ Retrieve an API key from http://www.guitarparty.com/developers/api-key/
19
+
20
+ ## Usage
21
+
22
+ To initialize:
23
+
24
+ ```ruby
25
+ require 'guitarparty_client'
26
+ guitarparty = GuitarpartyClient.new("API-KEY")
27
+ ```
28
+
29
+ To get song information:
30
+
31
+ ```ruby
32
+ require 'guitarparty_client'
33
+ guitarparty = GuitarpartyClient.new("API-KEY")
34
+
35
+ guitarparty.song_by_name("Jolene")
36
+
37
+ guitarparty.song_by_id(1)
38
+ ```
39
+ Both return:
40
+
41
+ ```json
42
+ {
43
+ "body": "...",
44
+ "chords": [...],
45
+ "tags": [],
46
+ "title": "Jolene",
47
+ "uri": "/v2/songs/5/"
48
+ }
49
+ ```
50
+
51
+ To get lyrics/chords:
52
+
53
+
54
+ ```ruby
55
+ require 'guitarparty_client'
56
+ guitarparty = GuitarpartyClient.new("API-KEY")
57
+
58
+ guitarparty.lyrics_by_name("Jolene")
59
+
60
+ guitarparty.lyrics_by_id(1)
61
+ ```
62
+
63
+ Both return the lyrics and chords:
64
+
65
+ "Capo á 4.bandi
66
+
67
+ Jo[Am]lene, Jo[C]lene, Jo[G]lene, Jo[Am]lene!
68
+ I'm b[G]egging of you, please don't take my [Am]man.
69
+ Jo[Am]lene, Jo[C]lene, Jo[G]lene, Jo[Am]lene!
70
+ Pl[G]ease don't take him, just because you [Am]can.
71
+ ..."
72
+
73
+ To get artist information:
74
+
75
+ ```ruby
76
+ require 'guitarparty_client'
77
+ guitarparty = GuitarpartyClient.new("API-KEY")
78
+
79
+ guitarparty.artist_by_name("Dolly Parton")
80
+
81
+ guitarparty.artist_by_id(1)
82
+ ```
83
+
84
+ Both return:
85
+
86
+ ```json
87
+
88
+ {
89
+ "objects": [
90
+ {
91
+ "bio": "Dolly Rebecca Parton (born January 19, 1946) ...",
92
+ "name": "Dolly Parton",
93
+ "slug": "dolly-parton",
94
+ "uri": "/v2/artists/1/"
95
+ }
96
+ ],
97
+ "objects_count": 1
98
+ }
99
+ ```
100
+
101
+ To get only artist biography:
102
+
103
+ ```ruby
104
+ require 'guitarparty_client'
105
+ guitarparty = GuitarpartyClient.new("API-KEY")
106
+
107
+ guitarparty.bio_by_name("Dolly Parton")
108
+
109
+ guitarparty.bio_by_id(1)
110
+ ```
111
+
112
+ Both return a string of the full bio as shown above.
113
+
114
+ To get chord information:
115
+
116
+ ```ruby
117
+ require 'guitarparty_client'
118
+ guitarparty = GuitarpartyClient.new("API-KEY")
119
+
120
+ guitarparty.get_chord("Am")
121
+ ```
122
+ Returns chord information:
123
+
124
+ ```json
125
+ {
126
+ "objects": [
127
+ {
128
+ "code": "xo221o",
129
+ "image_url": "http://chords.guitarparty.com/chord-images/guitar_Am_xo221o.png",
130
+ "instrument": {
131
+ "name": "Guitar",
132
+ "safe_name": "guitar",
133
+ "tuning": "EADGBE"
134
+ },
135
+ "name": "Am",
136
+ "uri": "/v2/chords/46345/"
137
+ }
138
+ ],
139
+ "objects_count": 1
140
+ }
141
+ ```
142
+
143
+ And
144
+
145
+ ```ruby
146
+ guitarparty.get_chord_variations("Am")
147
+ ```
148
+
149
+ Returns all variations of the chord.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "guitarparty_client"
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
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'guitarparty_client/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "guitarparty_client"
8
+ spec.version = GuitarpartyClient::Version::VERSION
9
+ spec.authors = ["Toby"]
10
+ spec.email = ["trgray9@gmail.com"]
11
+
12
+ spec.summary = %q{A ruby wrapper for the Guitarparty API}
13
+ spec.description = %q{Provides an easy to use Ruby gem to interact with the Guitarparty API}
14
+ spec.homepage = "https://github.com/trgray9/guitarparty-ruby-wrapper"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.8"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec", "~> 3.0"
25
+ spec.add_dependency "rest-client"
26
+ spec.add_dependency "mime-types"
27
+ spec.add_dependency "netrc"
28
+ spec.add_dependency "http-cookie"
29
+ spec.add_dependency "json"
30
+ end
@@ -0,0 +1,28 @@
1
+ require 'rest-client'
2
+ require 'guitarparty_client'
3
+ require 'json'
4
+
5
+ class GuitarpartyClient
6
+ module Artists
7
+
8
+ def artist_by_name(artist)
9
+ artist.gsub!(/\s/,'+')
10
+ RestClient.get "#{@base_url}artists/?query=#{artist}", {'Guitarparty-Api-Key' => @api_key}
11
+ end
12
+
13
+ def artist_by_id(id)
14
+ RestClient.get "#{@base_url}artists/#{id}/", {'Guitarparty-Api-Key' => @api_key}
15
+ end
16
+
17
+ def bio_by_name(artist)
18
+ artist.gsub!(/\s/,'+')
19
+ response = RestClient.get "#{@base_url}artists/?query=#{artist}", {'Guitarparty-Api-Key' => @api_key}
20
+ JSON.parse(response)["objects"][0]["bio"]
21
+ end
22
+
23
+ def bio_by_id(id)
24
+ response =RestClient.get "#{@base_url}artists/#{id}/", {'Guitarparty-Api-Key' => @api_key}
25
+ JSON.parse(response)["bio"]
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,15 @@
1
+ require 'rest-client'
2
+ require 'guitarparty_client'
3
+
4
+ class GuitarpartyClient
5
+ module Chords
6
+
7
+ def get_chord(chord)
8
+ RestClient.get "#{@base_url}chords/?query=#{chord}", {'Guitarparty-Api-Key' => @api_key}
9
+ end
10
+
11
+ def get_chord_variations(chord)
12
+ RestClient.get "#{@base_url}chords/?query=#{chord}/?variations=true", {'Guitarparty-Api-Key' => @api_key}
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,25 @@
1
+ require 'rest-client'
2
+ require 'guitarparty_client'
3
+
4
+ class GuitarpartyClient
5
+ module Songs
6
+
7
+ def song_by_name(name)
8
+ RestClient.get "#{@base_url}songs/?query=#{name}", {'Guitarparty-Api-Key' => @api_key}
9
+ end
10
+
11
+ def song_by_id(id)
12
+ RestClient.get "#{@base_url}songs/#{id}/", {'Guitarparty-Api-Key' => @api_key}
13
+ end
14
+
15
+ def lyrics_by_name(name)
16
+ response = RestClient.get "#{@base_url}songs/?query=#{name}", {'Guitarparty-Api-Key' => @api_key}
17
+ JSON.parse(response)["objects"][0]["body"]
18
+ end
19
+
20
+ def lyrics_by_id(id)
21
+ response = RestClient.get "#{@base_url}/songs/#{id}/", {'Guitarparty-Api-Key' => @api_key}
22
+ JSON.parse(response)["body"]
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,5 @@
1
+ class GuitarpartyClient
2
+ module Version
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ require "guitarparty_client/version"
2
+ require "guitarparty_client/songs"
3
+ require "guitarparty_client/artists"
4
+ require "guitarparty_client/chords"
5
+
6
+ class GuitarpartyClient
7
+ include Songs
8
+ include Artists
9
+ include Chords
10
+
11
+ def initialize(api_key)
12
+ @api_key = api_key
13
+ @base_url = "http://api.guitarparty.com/v2/"
14
+ end
15
+
16
+ end
metadata ADDED
@@ -0,0 +1,171 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guitarparty_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Toby
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-02-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rest-client
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: mime-types
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: netrc
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: http-cookie
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: json
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: Provides an easy to use Ruby gem to interact with the Guitarparty API
126
+ email:
127
+ - trgray9@gmail.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".gitignore"
133
+ - ".rspec"
134
+ - ".travis.yml"
135
+ - Gemfile
136
+ - LICENSE.txt
137
+ - README.md
138
+ - Rakefile
139
+ - bin/console
140
+ - bin/setup
141
+ - guitarparty_client.gemspec
142
+ - lib/guitarparty_client.rb
143
+ - lib/guitarparty_client/artists.rb
144
+ - lib/guitarparty_client/chords.rb
145
+ - lib/guitarparty_client/songs.rb
146
+ - lib/guitarparty_client/version.rb
147
+ homepage: https://github.com/trgray9/guitarparty-ruby-wrapper
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: '0'
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.4.6
168
+ signing_key:
169
+ specification_version: 4
170
+ summary: A ruby wrapper for the Guitarparty API
171
+ test_files: []