musicscrape 0.0.2 → 0.0.3

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.
Files changed (2) hide show
  1. data/lib/musicscrape.rb +17 -4
  2. metadata +1 -1
data/lib/musicscrape.rb CHANGED
@@ -1,17 +1,29 @@
1
1
  require 'rubygems'
2
2
  require 'rest-client'
3
3
  #This gem goes to www.thestranger.com/seattle/Music and scrapes data for all the recommended concerts.
4
- #The intent is to have it put them on your google calendar but it hasn't gotten that far yet.
4
+ #The one method you need is get_music_listings which returns an array of hashes of the form
5
+ #[[:title=> "", :venue=>"", :date=>"", :details=>""], ...]
6
+ #how to use this gem:
7
+ #scrape = Scrape.new
8
+ #scrape.get_music_listings
9
+ #that is all.
5
10
 
6
11
 
7
12
  class Scrape
8
13
  #Scrape is meant to parse www.thestranger.com/music and pull out info on the recommended shows
9
14
  #initialize with source_type = :web and url = "http://www.thestranger.com/music"
10
- def initialize(source_type,url)
15
+ def initialize(source_type = :web)
11
16
  @source_type = source_type
12
- @url = url
17
+ @url="http://www.thestranger.com/seattle/Music"
13
18
  end
14
-
19
+
20
+ def get_music_listings
21
+ #This is the one method you need to use
22
+ @scrape = Scrape.new(:web)
23
+ @pruned_page = @scrape.remove_excess(@scrape.load_page)
24
+ @scrape.get_events(@pruned_page) #returns an array of hashes
25
+ end
26
+
15
27
  def load_page
16
28
  #Uses RestClient to get the html
17
29
  if @source_type == :web then
@@ -58,6 +70,7 @@ class Scrape
58
70
  end
59
71
 
60
72
  class Google
73
+ #the plan is to make it add the events to your google calendar. Not yet Functional.
61
74
  attr_writer :password
62
75
  attr_writer :user
63
76
  attr_writer :title
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: musicscrape
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: