rbrainz 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,13 @@
1
- # $Id: test_factory.rb 140 2007-07-17 13:27:54Z phw $
1
+ # $Id: test_factory.rb 207 2008-04-23 19:55:38Z phw $
2
2
  #
3
3
  # Author:: Philipp Wolfer (mailto:phw@rubyforge.org)
4
4
  # Copyright:: Copyright (c) 2007, Nigel Graham, Philipp Wolfer
5
5
  # License:: RBrainz is free software distributed under a BSD style license.
6
6
  # See LICENSE[file:../LICENSE.html] for permissions.
7
7
 
8
+ require 'rbrainz/model'
9
+ include MusicBrainz
10
+
8
11
  class MyArtist < Model::Artist
9
12
  end
10
13
 
@@ -1,4 +1,4 @@
1
- # $Id: testing_helper.rb 78 2007-06-04 19:47:11Z phw $
1
+ # $Id: testing_helper.rb 203 2008-03-17 11:00:15Z phw $
2
2
  #
3
3
  # Usefull helper methods which are used in different test classes.
4
4
  #
@@ -10,6 +10,7 @@
10
10
  # Converts a query string into a hash.
11
11
  def query_string_to_hash query_string
12
12
  Hash[*query_string.scan(/(.+?)=(.*?)(?:&|$)/).flatten].each_value {|v|
13
+ v.gsub!('+', ' ')
13
14
  v.gsub!(/%([0-9a-f]{2})/i) { [$1.hex].pack 'C' }
14
15
  }
15
16
  end
@@ -1,4 +1,4 @@
1
- # $Id: test_artist_includes.rb 158 2007-07-25 16:19:19Z phw $
1
+ # $Id: test_artist_includes.rb 203 2008-03-17 11:00:15Z phw $
2
2
  #
3
3
  # Author:: Philipp Wolfer (mailto:phw@rubyforge.org)
4
4
  # Copyright:: Copyright (c) 2007, Philipp Wolfer
@@ -33,7 +33,7 @@ class TestArtistIncludes < Test::Unit::TestCase
33
33
  result_string = includes.to_s
34
34
  assert_equal 'inc=', result_string[0..3]
35
35
 
36
- result_array = result_string[4..-1].split('%20')
36
+ result_array = result_string[4..-1].split(/%20|\+/)
37
37
  assert result_array.include?('aliases')
38
38
  assert result_array.include?('artist-rels')
39
39
  assert result_array.include?('release-rels')
@@ -1,4 +1,4 @@
1
- # $Id: test_label_includes.rb 118 2007-07-11 22:46:58Z phw $
1
+ # $Id: test_label_includes.rb 203 2008-03-17 11:00:15Z phw $
2
2
  #
3
3
  # Author:: Philipp Wolfer (mailto:phw@rubyforge.org)
4
4
  # Copyright:: Copyright (c) 2007, Philipp Wolfer
@@ -31,7 +31,7 @@ class TestLabelIncludes < Test::Unit::TestCase
31
31
  result_string = includes.to_s
32
32
  assert_equal 'inc=', result_string[0..3]
33
33
 
34
- result_array = result_string[4..-1].split('%20')
34
+ result_array = result_string[4..-1].split(/%20|\+/)
35
35
  assert result_array.include?('aliases')
36
36
  assert result_array.include?('artist-rels')
37
37
  assert result_array.include?('release-rels')
@@ -1,4 +1,4 @@
1
- # $Id: test_release_includes.rb 118 2007-07-11 22:46:58Z phw $
1
+ # $Id: test_release_includes.rb 203 2008-03-17 11:00:15Z phw $
2
2
  #
3
3
  # Author:: Philipp Wolfer (mailto:phw@rubyforge.org)
4
4
  # Copyright:: Copyright (c) 2007, Philipp Wolfer
@@ -37,7 +37,7 @@ class TestReleaseIncludes < Test::Unit::TestCase
37
37
  result_string = includes.to_s
38
38
  assert_equal 'inc=', result_string[0..3]
39
39
 
40
- result_array = result_string[4..-1].split('%20')
40
+ result_array = result_string[4..-1].split(/%20|\+/)
41
41
  assert result_array.include?('artist')
42
42
  assert result_array.include?('counts')
43
43
  assert result_array.include?('release-events')
@@ -1,4 +1,4 @@
1
- # $Id: test_track_includes.rb 118 2007-07-11 22:46:58Z phw $
1
+ # $Id: test_track_includes.rb 203 2008-03-17 11:00:15Z phw $
2
2
  #
3
3
  # Author:: Philipp Wolfer (mailto:phw@rubyforge.org)
4
4
  # Copyright:: Copyright (c) 2007, Philipp Wolfer
@@ -33,7 +33,7 @@ class TestTrackIncludes < Test::Unit::TestCase
33
33
  result_string = includes.to_s
34
34
  assert_equal 'inc=', result_string[0..3]
35
35
 
36
- result_array = result_string[4..-1].split('%20')
36
+ result_array = result_string[4..-1].split(/%20|\+/)
37
37
  assert result_array.include?('artist')
38
38
  assert result_array.include?('releases')
39
39
  assert result_array.include?('puids')
@@ -1,4 +1,4 @@
1
- # $Id: test_webservice.rb 114 2007-07-10 19:33:22Z phw $
1
+ # $Id: test_webservice.rb 203 2008-03-17 11:00:15Z phw $
2
2
  #
3
3
  # Author:: Philipp Wolfer (mailto:phw@rubyforge.org)
4
4
  # Copyright:: Copyright (c) 2007, Philipp Wolfer
@@ -45,7 +45,7 @@ class TestWebservice < Test::Unit::TestCase
45
45
  end
46
46
 
47
47
  def test_get_connection_error
48
- ws = Webservice::Webservice.new(:host => 'example.org')
48
+ ws = Webservice::Webservice.new(:host => 'invalid.host.tld')
49
49
  ws.open_timeout = 0.1
50
50
  assert_raise(Webservice::ConnectionError) {
51
51
  ws.get(:artist, :id => Model::MBID.parse('10bf95b6-30e3-44f1-817f-45762cdc0de0', :artist))
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: rbrainz
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.4.0
7
- date: 2007-12-16 00:00:00 +01:00
6
+ version: 0.4.1
7
+ date: 2008-04-23 00:00:00 +02:00
8
8
  summary: Ruby library for the MusicBrainz XML web service.
9
9
  require_paths:
10
10
  - lib
@@ -35,35 +35,41 @@ files:
35
35
  - README
36
36
  - TODO
37
37
  - CHANGES
38
+ - setup.rb
38
39
  - doc/README.rdoc
39
- - examples/getuser.rb
40
- - examples/searchartists.rb
41
- - examples/getartist.rb
42
40
  - examples/searchtracks.rb
41
+ - examples/getuser.rb
43
42
  - examples/getlabel.rb
43
+ - examples/searchartists.rb
44
44
  - examples/getrelease.rb
45
45
  - examples/gettrack.rb
46
+ - examples/getartist.rb
46
47
  - examples/searchlabels.rb
47
48
  - examples/searchreleases.rb
48
49
  - examples/tag.rb
49
- - lib/rbrainz/model/release_event.rb
50
50
  - lib/rbrainz/model/relation.rb
51
+ - lib/rbrainz/model/user.rb
51
52
  - lib/rbrainz/model/label.rb
52
53
  - lib/rbrainz/model/release.rb
53
- - lib/rbrainz/model/artist.rb
54
+ - lib/rbrainz/model/release_event.rb
54
55
  - lib/rbrainz/model/disc.rb
55
- - lib/rbrainz/model/track.rb
56
- - lib/rbrainz/model/incomplete_date.rb
57
56
  - lib/rbrainz/model/individual.rb
58
57
  - lib/rbrainz/model/alias.rb
59
- - lib/rbrainz/model/mbid.rb
60
- - lib/rbrainz/model/entity.rb
61
- - lib/rbrainz/model/user.rb
62
58
  - lib/rbrainz/model/scored_collection.rb
63
- - lib/rbrainz/model/tag.rb
64
59
  - lib/rbrainz/model/collection.rb
60
+ - lib/rbrainz/model/incomplete_date.rb
61
+ - lib/rbrainz/model/track.rb
62
+ - lib/rbrainz/model/artist.rb
63
+ - lib/rbrainz/model/tag.rb
64
+ - lib/rbrainz/model/mbid.rb
65
65
  - lib/rbrainz/model/default_factory.rb
66
- - lib/rbrainz/model/duration.rb
66
+ - lib/rbrainz/model/entity.rb
67
+ - lib/rbrainz/utils/helper.rb
68
+ - lib/rbrainz/utils/data.rb
69
+ - lib/rbrainz/core_ext/range/equality.rb
70
+ - lib/rbrainz/core_ext/net_http_digest.rb
71
+ - lib/rbrainz/core_ext/mbid.rb
72
+ - lib/rbrainz/core_ext/range.rb
67
73
  - lib/rbrainz/data/releasetypenames.rb
68
74
  - lib/rbrainz/data/countrynames.rb
69
75
  - lib/rbrainz/data/languagenames.rb
@@ -73,49 +79,43 @@ files:
73
79
  - lib/rbrainz/webservice/filter.rb
74
80
  - lib/rbrainz/webservice/query.rb
75
81
  - lib/rbrainz/webservice/includes.rb
76
- - lib/rbrainz/core_ext/range/equality.rb
77
- - lib/rbrainz/core_ext/net_http_digest.rb
78
- - lib/rbrainz/core_ext/range.rb
79
- - lib/rbrainz/core_ext/mbid.rb
80
82
  - lib/rbrainz/webservice.rb
81
83
  - lib/rbrainz/model.rb
82
- - lib/rbrainz/core_ext.rb
83
- - lib/rbrainz/utils/helper.rb
84
- - lib/rbrainz/utils/data.rb
85
84
  - lib/rbrainz/utils.rb
86
85
  - lib/rbrainz/version.rb
86
+ - lib/rbrainz/core_ext.rb
87
87
  - lib/rbrainz.rb
88
- - test/lib/testing_helper.rb
89
- - test/lib/test_entity.rb
90
- - test/lib/mock_webservice.rb
91
88
  - test/lib/test_factory.rb
92
- - test/test_label_filter.rb
89
+ - test/lib/mock_webservice.rb
90
+ - test/lib/test_entity.rb
91
+ - test/lib/testing_helper.rb
93
92
  - test/test_mbxml.rb
94
93
  - test/test_label.rb
95
94
  - test/test_release.rb
96
- - test/test_disc.rb
97
95
  - test/test_release_event.rb
96
+ - test/test_disc.rb
97
+ - test/test_label_filter.rb
98
98
  - test/test_release_filter.rb
99
99
  - test/test_alias.rb
100
+ - test/test_scored_collection.rb
100
101
  - test/test_track_includes.rb
101
102
  - test/test_collection.rb
102
103
  - test/test_incomplete_date.rb
103
104
  - test/test_artist_includes.rb
104
105
  - test/test_webservice.rb
106
+ - test/test_utils.rb
105
107
  - test/test_track.rb
106
108
  - test/test_query.rb
107
109
  - test/test_label_includes.rb
108
110
  - test/test_artist.rb
109
111
  - test/test_release_includes.rb
112
+ - test/test_range_equality.rb
110
113
  - test/test_track_filter.rb
111
114
  - test/test_mbid.rb
115
+ - test/test_default_factory.rb
112
116
  - test/test_artist_filter.rb
113
- - test/test_relation.rb
114
- - test/test_scored_collection.rb
115
- - test/test_range_equality.rb
116
117
  - test/test_tag.rb
117
- - test/test_default_factory.rb
118
- - test/test_utils.rb
118
+ - test/test_relation.rb
119
119
  - test/test-data/valid
120
120
  - test/test-data/valid/label
121
121
  - test/test-data/valid/label/Atlantic_Records_1.xml
@@ -165,6 +165,11 @@ files:
165
165
  - test/test-data/invalid/artist/tags_1.xml
166
166
  - test/test-data/invalid/artist/empty_2.xml
167
167
  - test/test-data/README
168
+ - debian/control
169
+ - debian/compat
170
+ - debian/changelog
171
+ - debian/copyright
172
+ - debian/rules
168
173
  test_files: []
169
174
 
170
175
  rdoc_options: []
@@ -1,96 +0,0 @@
1
-
2
- # Represents a duration in milliseconds.
3
- class Duration < Numeric
4
-
5
- def initialize(milliseconds=0)
6
- @ms = milliseconds.to_i
7
- end
8
-
9
- def days
10
- to_i / 86400000
11
- end
12
-
13
- def hours
14
- to_i / 3600000 % 24
15
- end
16
-
17
- def minutes
18
- to_i / 60000 % 60
19
- end
20
-
21
- def seconds
22
- to_i / 1000 % 60
23
- end
24
-
25
- def milliseconds
26
- to_i % 1000
27
- end
28
-
29
- def to_i
30
- @ms
31
- end
32
-
33
- def to_f
34
- @ms.to_f
35
- end
36
-
37
- def coerce(numeric)
38
- if numeric.is_a?(Integer)
39
- [numeric, to_i]
40
- else
41
- [Float.induced_from(numeric), to_f]
42
- end
43
- end
44
-
45
- # def method_missing(m, *args)
46
- # if ['%'.to_sym, '+'.to_sym, '-'.to_sym, '*'.to_sym, '/'.to_sym].include?(m)
47
- # self.class.new(@ms.send(m, *args))
48
- # end
49
- # end
50
-
51
- def <=> other
52
- to_i <=> other
53
- end
54
-
55
- def % other
56
- Duration.new(to_i % other)
57
- end
58
-
59
- def + other
60
- Duration.new(to_i + other)
61
- end
62
-
63
- def - other
64
- Duration.new(to_i - other)
65
- end
66
-
67
- def * other
68
- Duration.new(to_i * other)
69
- end
70
-
71
- def / other
72
- Duration.new(to_i / other)
73
- end
74
-
75
- def ** other
76
- Duration.new(to_i ** other)
77
- end
78
-
79
- end
80
-
81
- require 'delegate'
82
-
83
- #class Duration < DelegateClass(Fixnum)
84
- #
85
- # def x_method_missing(m, *args, &block)
86
- # if block_given?
87
- # result = super m, *args
88
- # else
89
- # result = super m, *args, &block
90
- # end
91
- # result.is_a?(Integer) ? Duration.new(result) : result
92
- # end
93
- #
94
- #end
95
-
96
-