songkickr 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -32,6 +32,16 @@ module Songkickr
32
32
  result = self.class.get("#{path}/events.json", :query => query)
33
33
  Songkickr::EventResult.new result
34
34
  end
35
+
36
+
37
+ # Getting detailed information of a single event
38
+ # http://www.songkick.com/developer/upcoming-events
39
+
40
+ def event(event_id)
41
+ result = self.class.get("/events/#{event_id}.json")
42
+ # and now for some dirrty hack
43
+ Songkickr::Event.new result["resultsPage"]["results"]["event"]
44
+ end
35
45
 
36
46
  # Parameters - http://groups.google.com/group/songkick-api/browse_thread/thread/af15b9a6ad3c3513#
37
47
  # artist_id - Songkick artist_id, use artist_search to get it
data/songkickr.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{songkickr}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
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{2011-05-10}
12
+ s.date = %q{2011-05-11}
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 = [
@@ -36,10 +36,13 @@ Gem::Specification.new do |s|
36
36
  "lib/songkickr/venue.rb",
37
37
  "songkickr.gemspec",
38
38
  "test.rb",
39
+ "test/fixtures/event_7391451.json",
39
40
  "test/fixtures/events.json",
41
+ "test/fixtures/invalid_api_key.json",
40
42
  "test/fixtures/no_events.json",
41
43
  "test/helper.rb",
42
44
  "test/songkickr/test_artist.rb",
45
+ "test/songkickr/test_event.rb",
43
46
  "test/songkickr/test_remote.rb",
44
47
  "test/test_songkickr.rb"
45
48
  ]
@@ -50,6 +53,7 @@ Gem::Specification.new do |s|
50
53
  s.test_files = [
51
54
  "test/helper.rb",
52
55
  "test/songkickr/test_artist.rb",
56
+ "test/songkickr/test_event.rb",
53
57
  "test/songkickr/test_remote.rb",
54
58
  "test/test_songkickr.rb"
55
59
  ]
@@ -0,0 +1 @@
1
+ {"resultsPage":{"results":{"event":{"popularity":0.00283,"uri":"http:\/\/www.songkick.com\/concerts\/7391451-17-hippies-at-muffathalle?utm_source=4961&utm_medium=partner","location":{"city":"Munich, Germany","lng":11.58971,"lat":48.13321},"displayName":"17 Hippies at Muffathalle (May 11, 2011)","id":7391451,"type":"Concert","start":{"time":"20:00:00","date":"2011-05-11","datetime":"2011-05-11T20:00:00+0100"},"performance":[{"artist":{"uri":"http:\/\/www.songkick.com\/artists\/306885-17-hippies?utm_source=4961&utm_medium=partner","displayName":"17 Hippies","id":306885,"identifier":[{"href":"http:\/\/api.songkick.com\/api\/3.0\/artists\/mbid:8315641a-6dca-40fd-a893-d247e4db84c3.json","mbid":"8315641a-6dca-40fd-a893-d247e4db84c3"}]},"displayName":"17 Hippies","billingIndex":1,"id":13542731,"billing":"headline"}],"venue":{"city":{"uri":"http:\/\/www.songkick.com\/metro_areas\/28549-germany-munich?utm_source=4961&utm_medium=partner","country":{"displayName":"Germany"},"displayName":"Munich","id":28549},"zip":"81667","uri":"http:\/\/www.songkick.com\/venues\/33264-muffathalle?utm_source=4961&utm_medium=partner","displayName":"Muffathalle","street":"Zellstr. 4, Munich","lng":11.58971,"id":33264,"phone":"+49 89 458750-7","website":"www.muffathalle.de","capacity":null,"metroArea":{"uri":"http:\/\/www.songkick.com\/metro_areas\/28549-germany-munich?utm_source=4961&utm_medium=partner","country":{"displayName":"Germany"},"displayName":"Munich","id":28549},"description":"","lat":48.13321},"status":"ok"}},"status":"ok"}}
@@ -0,0 +1 @@
1
+ {"resultsPage":{"status":"error","error":{"message":"Invalid or missing apikey"}}}
@@ -0,0 +1,19 @@
1
+ require 'helper'
2
+
3
+ class TestArtist < Test::Unit::TestCase
4
+ context "Given an Event from fixture" do
5
+ setup do
6
+ fixture_hash = Crack::JSON.parse(fixture_file('event_7391451.json')) # extract to helper?
7
+ @event = Songkickr::Event.new(fixture_hash["resultsPage"]["results"]["event"])
8
+ end
9
+
10
+ should "properly load data from JSON" do
11
+ assert_equal "Concert", @event.type
12
+ assert_equal "Munich, Germany", @event.location.city
13
+ assert_equal "Muffathalle", @event.venue.display_name
14
+ assert_equal 1, @event.performance.size
15
+ assert_equal "17 Hippies", @event.performance.first.display_name
16
+ end
17
+
18
+ end
19
+ end
@@ -9,22 +9,27 @@ class TestRemote < Test::Unit::TestCase
9
9
  end
10
10
  end
11
11
 
12
- # TODO: Fix this later
13
- # context "Given a remote with an invalid api key" do
14
- # setup do
15
- # stub_get('http://api.songkick.com/api/3.0/events.json', 'events.json')
16
- # @remote = Songkickr::Remote.new 'omgwtfbbq_fake_key'
17
- # end
18
- #
19
- # should "generate a remote" do
20
- # assert_not_nil @remote
21
- # end
22
- #
23
- # should "generate nil results" do
24
- # [nil, ':artist_name => ""', ':artist_name => "Madonna"'].each do |remote_params|
25
- # assert_nil @remote.send(:events, remote_params).results
26
- # end
27
- # end
28
- # end
12
+ # TODO: Fix this later
13
+ context "Given a remote with an invalid api key" do
14
+ setup do
15
+ stub_get('http://api.songkick.com/api/3.0/events.json', 'events.json')
16
+ @remote = Songkickr::Remote.new 'omgwtfbbq_fake_key'
17
+ end
18
+
19
+ should "generate a remote" do
20
+ assert_not_nil @remote
21
+ end
22
+
23
+ # to make it work it needs:
24
+ # 1) registering GET http://api.songkick.com/api/3.0/events.json?apikey=omgwtfbbq_fake_key
25
+ # and its variants with fakeweb OR allowing real http connections
26
+ # 2) checking that returned json equals fixtures/invalid_api_key.json
27
+ #
28
+ #should "generate nil results" do
29
+ # [{}, ':artist_name => ""', ':artist_name => "Madonna"'].each do |remote_params|
30
+ # assert_nil @remote.send(:events, remote_params).results
31
+ # end
32
+ #end
33
+ end
29
34
 
30
35
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: songkickr
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jared Mehle
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-10 00:00:00 Z
18
+ date: 2011-05-11 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: shoulda
@@ -62,10 +62,13 @@ files:
62
62
  - lib/songkickr/venue.rb
63
63
  - songkickr.gemspec
64
64
  - test.rb
65
+ - test/fixtures/event_7391451.json
65
66
  - test/fixtures/events.json
67
+ - test/fixtures/invalid_api_key.json
66
68
  - test/fixtures/no_events.json
67
69
  - test/helper.rb
68
70
  - test/songkickr/test_artist.rb
71
+ - test/songkickr/test_event.rb
69
72
  - test/songkickr/test_remote.rb
70
73
  - test/test_songkickr.rb
71
74
  homepage: http://github.com/jrmehle/songkickr
@@ -104,5 +107,6 @@ summary: A Ruby wrapper around the Songkick API.
104
107
  test_files:
105
108
  - test/helper.rb
106
109
  - test/songkickr/test_artist.rb
110
+ - test/songkickr/test_event.rb
107
111
  - test/songkickr/test_remote.rb
108
112
  - test/test_songkickr.rb