songkickr 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ begin
10
10
  gem.email = "jrmehle@gmail.com"
11
11
  gem.homepage = "http://github.com/jrmehle/songkickr"
12
12
  gem.authors = ["Jared Mehle"]
13
- gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
13
+ gem.add_development_dependency "shoulda", ">= 2.11.0"
14
14
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
15
  end
16
16
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -1,10 +1,13 @@
1
1
  module Songkickr
2
2
  class Artist
3
- attr_accessor :href, :display_name
3
+ attr_accessor :href, :display_name, :id, :uri, :onTourUntil
4
4
 
5
5
  def initialize(artist_hash = {})
6
6
  @href = artist_hash["href"]
7
7
  @display_name = artist_hash["displayName"]
8
+ @id = artist_hash["id"]
9
+ @uri = artist_hash["uri"]
10
+ @onTourUntil = artist_hash["onTourUntil"]
8
11
  end
9
12
  end
10
13
  end
@@ -0,0 +1,29 @@
1
+ module Songkickr
2
+ class ArtistResult
3
+ attr_accessor :page, :total_entries, :results
4
+
5
+ def initialize(result_hash = {})
6
+ results_page = result_hash["resultsPage"]
7
+
8
+ if results_page
9
+ @page = results_page["page"]
10
+ @total_entries = results_page["totalEntries"]
11
+ @results = parse_results results_page["results"]
12
+ end
13
+ end
14
+
15
+ protected
16
+
17
+ def parse_results(results = {})
18
+ artists = []
19
+ if results.include?("artist")
20
+ results["artist"].each do |artist|
21
+ artists << Songkickr::Artist.new(artist)
22
+ end
23
+ end
24
+
25
+ artists
26
+ end
27
+
28
+ end
29
+ end
@@ -28,10 +28,31 @@ module Songkickr
28
28
  # location - see the Songkick website for instructions on how to use the location parameter
29
29
 
30
30
  def events(query = {})
31
- result = self.class.get('/events.json', :query => query)
31
+ path = extract_path_from_query(query)
32
+ result = self.class.get("#{path}/events.json", :query => query)
32
33
  Songkickr::EventResult.new result
33
34
  end
34
-
35
+
36
+ # Parameters - http://groups.google.com/group/songkick-api/browse_thread/thread/af15b9a6ad3c3513#
37
+ # artist_id - Songkick artist_id, use artist_search to get it
38
+ # min_date
39
+ # max_date
40
+ # per_page
41
+ # page
42
+
43
+ def gigography (artist_id, query= {})
44
+ result = self.class.get("/artists/#{artist_id}/gigography.json",:query=>query)
45
+ Songkickr::EventResult.new result
46
+ end
47
+
48
+ # Parameters - http://www.songkick.com/developer/artist-search
49
+ # full_text (full text of a search)
50
+ # returns artist
51
+
52
+ def artist_search(query={})
53
+ result = self.class.get("/search/artists.json?query=#{query[:artist_name]}", :query=>query)
54
+ Songkickr::ArtistResult.new result
55
+ end
35
56
 
36
57
  # Parameters - http://www.songkick.com/developer/events-for-user
37
58
  #
@@ -60,5 +81,12 @@ module Songkickr
60
81
  result = self.class.get("/events/#{event_id}/setlists.json")
61
82
  Songkickr::ConcertSetlistResult.new result
62
83
  end
84
+
85
+ private
86
+
87
+ def extract_path_from_query(query = {})
88
+ mbid = query.delete :mbid
89
+ "/artists/mbid:#{mbid}" if mbid
90
+ end
63
91
  end
64
92
  end
data/lib/songkickr.rb CHANGED
@@ -13,6 +13,7 @@ require dir + '/songkickr/setlist'
13
13
  require dir + '/songkickr/event_result'
14
14
  require dir + '/songkickr/concert_setlist_result'
15
15
  require dir + '/songkickr/remote'
16
+ require dir + '/songkickr/artist_result'
16
17
 
17
18
  class APIKeyNotSet < StandardError;
18
19
  def to_s
data/songkickr.gemspec CHANGED
@@ -1,70 +1,69 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{songkickr}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jared Mehle"]
12
- s.date = %q{2010-05-03}
12
+ s.date = %q{2011-05-03}
13
13
  s.description = %q{A Ruby wrapper around the Songkick API. Visit www.songkick.com/developer for documentation on the Songkick API. }
14
14
  s.email = %q{jrmehle@gmail.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.rdoc"
17
+ "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
- ".gitignore",
22
- "LICENSE",
23
- "README.rdoc",
24
- "Rakefile",
25
- "VERSION",
26
- "lib/songkickr.rb",
27
- "lib/songkickr/artist.rb",
28
- "lib/songkickr/concert_setlist_result.rb",
29
- "lib/songkickr/event.rb",
30
- "lib/songkickr/event_result.rb",
31
- "lib/songkickr/location.rb",
32
- "lib/songkickr/performance.rb",
33
- "lib/songkickr/remote.rb",
34
- "lib/songkickr/setlist.rb",
35
- "lib/songkickr/setlist_item.rb",
36
- "lib/songkickr/venue.rb",
37
- "songkickr.gemspec",
38
- "test/fixtures/events.json",
39
- "test/fixtures/no_events.json",
40
- "test/helper.rb",
41
- "test/songkickr/test_artist.rb",
42
- "test/songkickr/test_remote.rb",
43
- "test/test_songkickr.rb"
21
+ "LICENSE",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "lib/songkickr.rb",
26
+ "lib/songkickr/artist.rb",
27
+ "lib/songkickr/artist_result.rb",
28
+ "lib/songkickr/concert_setlist_result.rb",
29
+ "lib/songkickr/event.rb",
30
+ "lib/songkickr/event_result.rb",
31
+ "lib/songkickr/location.rb",
32
+ "lib/songkickr/performance.rb",
33
+ "lib/songkickr/remote.rb",
34
+ "lib/songkickr/setlist.rb",
35
+ "lib/songkickr/setlist_item.rb",
36
+ "lib/songkickr/venue.rb",
37
+ "songkickr.gemspec",
38
+ "test.rb",
39
+ "test/fixtures/events.json",
40
+ "test/fixtures/no_events.json",
41
+ "test/helper.rb",
42
+ "test/songkickr/test_artist.rb",
43
+ "test/songkickr/test_remote.rb",
44
+ "test/test_songkickr.rb"
44
45
  ]
45
46
  s.homepage = %q{http://github.com/jrmehle/songkickr}
46
- s.rdoc_options = ["--charset=UTF-8"]
47
47
  s.require_paths = ["lib"]
48
- s.rubygems_version = %q{1.3.6}
48
+ s.rubygems_version = %q{1.7.2}
49
49
  s.summary = %q{A Ruby wrapper around the Songkick API.}
50
50
  s.test_files = [
51
51
  "test/helper.rb",
52
- "test/songkickr/test_artist.rb",
53
- "test/songkickr/test_remote.rb",
54
- "test/test_songkickr.rb"
52
+ "test/songkickr/test_artist.rb",
53
+ "test/songkickr/test_remote.rb",
54
+ "test/test_songkickr.rb"
55
55
  ]
56
56
 
57
57
  if s.respond_to? :specification_version then
58
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
59
58
  s.specification_version = 3
60
59
 
61
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
62
- s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
60
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
61
+ s.add_development_dependency(%q<shoulda>, [">= 2.11.0"])
63
62
  else
64
- s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
63
+ s.add_dependency(%q<shoulda>, [">= 2.11.0"])
65
64
  end
66
65
  else
67
- s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
66
+ s.add_dependency(%q<shoulda>, [">= 2.11.0"])
68
67
  end
69
68
  end
70
69
 
data/test.rb ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ # This is a simple comand line test to make sure everything is working
3
+
4
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
5
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
6
+ require 'songkickr'
7
+ require 'httparty'
8
+
9
+ remote = Songkickr::Remote.new 'hFYxiInE4DBpH5KL'
10
+ @results = remote.artist_search(:artist_name => "Muse", :per_page=>'10' ).results
11
+ @results.each do |result|
12
+ print result.display_name + "\n"
13
+ end
14
+
15
+ print "\n"
16
+
17
+ @gigography_results = remote.gigography(@results[0].id, :per_page=>'50', :page=>'1', :min_date=>'2010-01-01').results
18
+
19
+ @gigography_results.each do |gig|
20
+ print gig.display_name + "\n"
21
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: songkickr
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 25
5
+ prerelease:
5
6
  segments:
6
7
  - 0
7
8
  - 1
8
- - 0
9
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Jared Mehle
@@ -14,19 +15,22 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-03 00:00:00 -05:00
18
- default_executable:
18
+ date: 2011-05-03 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- name: thoughtbot-shoulda
21
+ name: shoulda
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
24
25
  requirements:
25
26
  - - ">="
26
27
  - !ruby/object:Gem::Version
28
+ hash: 35
27
29
  segments:
30
+ - 2
31
+ - 11
28
32
  - 0
29
- version: "0"
33
+ version: 2.11.0
30
34
  type: :development
31
35
  version_requirements: *id001
32
36
  description: "A Ruby wrapper around the Songkick API. Visit www.songkick.com/developer for documentation on the Songkick API. "
@@ -40,13 +44,13 @@ extra_rdoc_files:
40
44
  - README.rdoc
41
45
  files:
42
46
  - .document
43
- - .gitignore
44
47
  - LICENSE
45
48
  - README.rdoc
46
49
  - Rakefile
47
50
  - VERSION
48
51
  - lib/songkickr.rb
49
52
  - lib/songkickr/artist.rb
53
+ - lib/songkickr/artist_result.rb
50
54
  - lib/songkickr/concert_setlist_result.rb
51
55
  - lib/songkickr/event.rb
52
56
  - lib/songkickr/event_result.rb
@@ -57,39 +61,43 @@ files:
57
61
  - lib/songkickr/setlist_item.rb
58
62
  - lib/songkickr/venue.rb
59
63
  - songkickr.gemspec
64
+ - test.rb
60
65
  - test/fixtures/events.json
61
66
  - test/fixtures/no_events.json
62
67
  - test/helper.rb
63
68
  - test/songkickr/test_artist.rb
64
69
  - test/songkickr/test_remote.rb
65
70
  - test/test_songkickr.rb
66
- has_rdoc: true
67
71
  homepage: http://github.com/jrmehle/songkickr
68
72
  licenses: []
69
73
 
70
74
  post_install_message:
71
- rdoc_options:
72
- - --charset=UTF-8
75
+ rdoc_options: []
76
+
73
77
  require_paths:
74
78
  - lib
75
79
  required_ruby_version: !ruby/object:Gem::Requirement
80
+ none: false
76
81
  requirements:
77
82
  - - ">="
78
83
  - !ruby/object:Gem::Version
84
+ hash: 3
79
85
  segments:
80
86
  - 0
81
87
  version: "0"
82
88
  required_rubygems_version: !ruby/object:Gem::Requirement
89
+ none: false
83
90
  requirements:
84
91
  - - ">="
85
92
  - !ruby/object:Gem::Version
93
+ hash: 3
86
94
  segments:
87
95
  - 0
88
96
  version: "0"
89
97
  requirements: []
90
98
 
91
99
  rubyforge_project:
92
- rubygems_version: 1.3.6
100
+ rubygems_version: 1.7.2
93
101
  signing_key:
94
102
  specification_version: 3
95
103
  summary: A Ruby wrapper around the Songkick API.
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC