lyriki 1.0.0 → 1.0.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 737cc120be682e468db5d479867c38041e42e0b7
4
- data.tar.gz: 8b7dc7f4911f6df1a55baa9626ec5ace7cb82c78
3
+ metadata.gz: 115c12b55ce53c2fdd9b97adcf14c0935ba66b72
4
+ data.tar.gz: 5d9c1dfbff46b1546109d257bc15a54024efb337
5
5
  SHA512:
6
- metadata.gz: 0e41f0ae5d331fca05b4445e281abf0f4fe3b38ba572dca2a2421677e24c509270d95ee5a2555e1dca518c619b694144a1471936e9a806202ae45b8a92175b28
7
- data.tar.gz: 07d961aa02ecfcd26bcfa62a6853ee4be3c27a28e0c4b449a171894ac6f6b4949e22eebae4e2b339f10c832b3843e3347ff7784bf6e30e4ccab0555ac3a511d8
6
+ metadata.gz: 819cb348a07c2c843f1b3621752e0e783592fb82191fc6fb9de5bdd3d45fd0e7aea658ed8564ea322abf2d4a7bcd6c3e3724d3dfa61d851aa696b3135c97157d
7
+ data.tar.gz: e33132e3b6ac3337e5173a9de053696a8800fac54d957c32da50204d211c8720db684849d57d59b080f60b5a4e6fd619715236667a8b19c9a5f22bbdb121ac98
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  /pkg/
2
2
  *.gem
3
+ Gemfile.lock
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
- # lyriki: wrapper for [LyricsWiki](http://lyrics.wikia.com)'s [API](http://lyrics.wikia.com/LyricWiki:API)
1
+ # lyriki
2
2
 
3
+ A [Ruby gem](http://rubygems.org/gems/lyriki) wrapper for [LyricsWiki](http://lyrics.wikia.com)'s [API](http://lyrics.wikia.com/LyricWiki:API).
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/lyriki.svg)](http://badge.fury.io/rb/lyriki)
3
6
  [![Build Status](https://travis-ci.org/alxndr/lyriki.png?branch=master)](https://travis-ci.org/alxndr/lyriki)
4
7
  [![Code Climate](https://codeclimate.com/github/alxndr/lyriki.png)](https://codeclimate.com/github/alxndr/lyriki)
5
8
  [![Test Coverage](https://codeclimate.com/github/alxndr/lyriki/badges/coverage.svg)](https://codeclimate.com/github/alxndr/lyriki)
data/Rakefile CHANGED
@@ -1,2 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
2
3
 
4
+ RSpec::Core::RakeTask.new(:spec) do |task|
5
+ task.rspec_opts = ["--color", "--format documentation"]
6
+ end
7
+
8
+ task default: :spec
@@ -0,0 +1,7 @@
1
+ module CustomStringMethods
2
+
3
+ def url_encode
4
+ CGI.escape self
5
+ end
6
+
7
+ end
@@ -8,7 +8,7 @@ module Lyriki
8
8
  include WebHelpers
9
9
 
10
10
  def initialize(name)
11
- @data = get url_for_artist(name)
11
+ @data = get(url_for_artist(name))
12
12
  end
13
13
 
14
14
  def response_data
@@ -18,7 +18,7 @@ module Lyriki
18
18
  private
19
19
 
20
20
  def url_for_artist(name)
21
- "http://lyrics.wikia.com/api.php?func=getArtist&artist=#{url_encode(name)}&fmt=realjson"
21
+ "http://lyrics.wikia.com/api.php?func=getArtist&artist=#{name.url_encode}&fmt=realjson"
22
22
  end
23
23
 
24
24
  end
@@ -9,7 +9,7 @@ module Lyriki
9
9
 
10
10
  def initialize(**args)
11
11
  raise ArgumentError unless args[:artist] && args[:song]
12
- @data = get url_for_song(args[:artist], args[:song])
12
+ @data = get(url_for_song(args[:artist], args[:song]))
13
13
  end
14
14
 
15
15
  def response_data
@@ -19,7 +19,7 @@ module Lyriki
19
19
  private
20
20
 
21
21
  def url_for_song(artist, song)
22
- "http://lyrics.wikia.com/api.php?artist=#{url_encode(artist)}&song=#{url_encode(song)}&fmt=realjson"
22
+ "http://lyrics.wikia.com/api.php?artist=#{artist.url_encode}&song=#{song.url_encode}&fmt=realjson"
23
23
  end
24
24
 
25
25
  end
@@ -1,3 +1,3 @@
1
1
  module Lyriki
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.0.1"
3
3
  end
data/lib/web_helpers.rb CHANGED
@@ -1,11 +1,13 @@
1
- module WebHelpers
1
+ require "custom_string_methods"
2
2
 
3
- def url_encode(str)
4
- CGI.escape str
5
- end
3
+ module WebHelpers
6
4
 
7
5
  def get(url)
8
6
  Net::HTTP.get URI(url)
9
7
  end
10
8
 
9
+ String.instance_eval do
10
+ include CustomStringMethods
11
+ end
12
+
11
13
  end
data/lyriki.gemspec CHANGED
@@ -9,7 +9,11 @@ Gem::Specification.new do |s|
9
9
  s.authors = ["Alexander"]
10
10
  s.email = ["alxndr+gem@gmail.com"]
11
11
  s.summary = "A wrapper for the LyricsWiki API"
12
- s.description = "A basic Ruby wrapper for the API provided by LyricsWiki (http://lyrics.wikia.com/)."
12
+ s.description = <<-DESC
13
+ A basic Ruby wrapper for the API provided by LyricsWiki (http://lyrics.wikia.com/).
14
+
15
+ Currently only implements fetching artist data, song data, and song lyrics.
16
+ DESC
13
17
  s.homepage = "http://github.com/alxndr/lyriki"
14
18
  s.license = "MIT"
15
19
 
@@ -18,9 +22,14 @@ Gem::Specification.new do |s|
18
22
  s.test_files = s.files.grep(%r{^spec/})
19
23
  s.require_paths = ["lib"]
20
24
 
25
+ s.required_ruby_version = ">= 2.0"
26
+
21
27
  s.add_runtime_dependency "json"
22
28
  s.add_runtime_dependency "nokogiri"
23
29
 
24
30
  s.add_development_dependency "bundler", "~> 1.6"
25
31
  s.add_development_dependency "rake"
32
+ s.add_development_dependency "rspec"
33
+ s.add_development_dependency "vcr"
34
+ s.add_development_dependency "webmock"
26
35
  end
@@ -0,0 +1,22 @@
1
+ require "spec_helper"
2
+
3
+ describe CustomStringMethods do
4
+
5
+ String.instance_eval do
6
+ include CustomStringMethods
7
+ end
8
+
9
+ describe "#url_encode" do
10
+ it "should replace troublesome characters" do
11
+ encoded = "foo's bar & baz".url_encode
12
+
13
+ expect(encoded).not_to include " "
14
+ expect(encoded).to include "+"
15
+ expect(encoded).not_to include "'"
16
+ expect(encoded).to include "%27"
17
+ expect(encoded).not_to include "&"
18
+ expect(encoded).to include "%26"
19
+ end
20
+ end
21
+
22
+ end
@@ -20,7 +20,7 @@ describe Lyriki::Legacy::SongLyrics, vcr: { record: :none } do
20
20
  describe "initialize" do
21
21
  describe "without an artist" do
22
22
  it "should raise an error" do
23
- expect{ Lyriki::Legacy::SongLyrics.new song: "inca roads" }.to raise_error(ArgumentError)
23
+ expect { Lyriki::Legacy::SongLyrics.new song: "inca roads" }.to raise_error(ArgumentError)
24
24
  end
25
25
  end
26
26
  describe "without a song" do
@@ -5,15 +5,6 @@ describe WebHelpers do
5
5
 
6
6
  subject { Class.new { include WebHelpers }.new }
7
7
 
8
- describe "#url_encode" do
9
- it "should replace apostrophes" do
10
- encoded = subject.url_encode("foo's bar")
11
-
12
- expect(encoded).not_to include "'"
13
- expect(encoded).to include "%27"
14
- end
15
- end
16
-
17
8
  describe "#get" do
18
9
  it { is_expected.to respond_to :get }
19
10
  it "should hit Net::HTTP"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lyriki
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander
@@ -66,7 +66,52 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- description: A basic Ruby wrapper for the API provided by LyricsWiki (http://lyrics.wikia.com/).
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
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
+ - !ruby/object:Gem::Dependency
84
+ name: vcr
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
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: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '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'
111
+ description: |2
112
+ A basic Ruby wrapper for the API provided by LyricsWiki (http://lyrics.wikia.com/).
113
+
114
+ Currently only implements fetching artist data, song data, and song lyrics.
70
115
  email:
71
116
  - alxndr+gem@gmail.com
72
117
  executables: []
@@ -77,12 +122,12 @@ files:
77
122
  - ".hound.yml"
78
123
  - ".travis.yml"
79
124
  - Gemfile
80
- - Gemfile.lock
81
125
  - Guardfile
82
126
  - LICENSE.txt
83
127
  - README.md
84
128
  - Rakefile
85
129
  - config/rubocop.yml
130
+ - lib/custom_string_methods.rb
86
131
  - lib/lyriki.rb
87
132
  - lib/lyriki/legacy.rb
88
133
  - lib/lyriki/legacy/artist_data.rb
@@ -91,6 +136,7 @@ files:
91
136
  - lib/lyriki/version.rb
92
137
  - lib/web_helpers.rb
93
138
  - lyriki.gemspec
139
+ - spec/custom_string_methods_spec.rb
94
140
  - spec/fixtures/vcr_cassettes/Lyriki_Legacy_ArtistData/.yml
95
141
  - spec/fixtures/vcr_cassettes/Lyriki_Legacy_ArtistData/_response_data/should_return_stored_data.yml
96
142
  - spec/fixtures/vcr_cassettes/Lyriki_Legacy_SongData/.yml
@@ -116,7 +162,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
116
162
  requirements:
117
163
  - - ">="
118
164
  - !ruby/object:Gem::Version
119
- version: '0'
165
+ version: '2.0'
120
166
  required_rubygems_version: !ruby/object:Gem::Requirement
121
167
  requirements:
122
168
  - - ">="
@@ -129,6 +175,7 @@ signing_key:
129
175
  specification_version: 4
130
176
  summary: A wrapper for the LyricsWiki API
131
177
  test_files:
178
+ - spec/custom_string_methods_spec.rb
132
179
  - spec/fixtures/vcr_cassettes/Lyriki_Legacy_ArtistData/.yml
133
180
  - spec/fixtures/vcr_cassettes/Lyriki_Legacy_ArtistData/_response_data/should_return_stored_data.yml
134
181
  - spec/fixtures/vcr_cassettes/Lyriki_Legacy_SongData/.yml
data/Gemfile.lock DELETED
@@ -1,93 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- lyriki (0.0.1)
5
- json
6
- nokogiri
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- addressable (2.3.6)
12
- awesome_print (1.2.0)
13
- celluloid (0.16.0)
14
- timers (~> 4.0.0)
15
- codeclimate-test-reporter (0.4.1)
16
- simplecov (>= 0.7.1, < 1.0.0)
17
- coderay (1.1.0)
18
- crack (0.4.2)
19
- safe_yaml (~> 1.0.0)
20
- diff-lcs (1.2.5)
21
- docile (1.1.5)
22
- ffi (1.9.6)
23
- formatador (0.2.5)
24
- guard (2.9.1)
25
- formatador (>= 0.2.4)
26
- listen (~> 2.7)
27
- lumberjack (~> 1.0)
28
- pry (>= 0.9.12)
29
- thor (>= 0.18.1)
30
- guard-rspec (4.3.1)
31
- guard (~> 2.1)
32
- rspec (>= 2.14, < 4.0)
33
- hitimes (1.2.2)
34
- json (1.8.1)
35
- listen (2.8.3)
36
- celluloid (>= 0.15.2)
37
- rb-fsevent (>= 0.9.3)
38
- rb-inotify (>= 0.9)
39
- lumberjack (1.0.9)
40
- method_source (0.8.2)
41
- mini_portile (0.6.1)
42
- multi_json (1.10.1)
43
- nokogiri (1.6.4.1)
44
- mini_portile (~> 0.6.0)
45
- pry (0.10.1)
46
- coderay (~> 1.1.0)
47
- method_source (~> 0.8.1)
48
- slop (~> 3.4)
49
- rake (10.4.0)
50
- rb-fsevent (0.9.4)
51
- rb-inotify (0.9.5)
52
- ffi (>= 0.5.0)
53
- rspec (3.1.0)
54
- rspec-core (~> 3.1.0)
55
- rspec-expectations (~> 3.1.0)
56
- rspec-mocks (~> 3.1.0)
57
- rspec-core (3.1.7)
58
- rspec-support (~> 3.1.0)
59
- rspec-expectations (3.1.2)
60
- diff-lcs (>= 1.2.0, < 2.0)
61
- rspec-support (~> 3.1.0)
62
- rspec-mocks (3.1.3)
63
- rspec-support (~> 3.1.0)
64
- rspec-support (3.1.2)
65
- safe_yaml (1.0.4)
66
- simplecov (0.9.1)
67
- docile (~> 1.1.0)
68
- multi_json (~> 1.0)
69
- simplecov-html (~> 0.8.0)
70
- simplecov-html (0.8.0)
71
- slop (3.6.0)
72
- thor (0.19.1)
73
- timers (4.0.1)
74
- hitimes
75
- vcr (2.9.3)
76
- webmock (1.20.4)
77
- addressable (>= 2.3.6)
78
- crack (>= 0.3.2)
79
-
80
- PLATFORMS
81
- ruby
82
-
83
- DEPENDENCIES
84
- awesome_print
85
- bundler (~> 1.6)
86
- codeclimate-test-reporter
87
- guard
88
- guard-rspec
89
- lyriki!
90
- rake
91
- rspec
92
- vcr
93
- webmock