metal_archives 2.0.0 → 2.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ed8310a30556ecb2a4162a99f848fdb990c69cc
|
4
|
+
data.tar.gz: 0ab681f3fa13d9c26157490d6de20be03595e63c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5e2062fc9b6ddc67bc2439c572cd6dd359bcf3ece870fbb09c4a3d294d075e588227c522273e276808507729834273becd1392cfd83c89a2839e6da4d4cd97c
|
7
|
+
data.tar.gz: f708e10fd9ed4d1eb4f35abe5585dd0703aa633b931bff6f1a8a4ed730c140b46f071582fc34be1c04751a4824fe7bc926b1d2c111cacf1f6b89c00a7536246a
|
@@ -35,6 +35,11 @@ module MetalArchives
|
|
35
35
|
# Use constructor to set attributes
|
36
36
|
initialize assemble
|
37
37
|
|
38
|
+
# Set empty properties to nil
|
39
|
+
self.class.properties.each do |prop|
|
40
|
+
instance_variable_set("@#{prop}", nil) unless instance_variable_defined? "@#{prop}"
|
41
|
+
end
|
42
|
+
|
38
43
|
@loaded = true
|
39
44
|
self.class.cache[id] = self
|
40
45
|
rescue => e
|
@@ -108,13 +113,13 @@ module MetalArchives
|
|
108
113
|
|
109
114
|
# property
|
110
115
|
define_method(name) do
|
111
|
-
load! unless instance_variable_defined?("@#{name}") || name ==
|
116
|
+
load! unless instance_variable_defined?("@#{name}") || name == :id
|
112
117
|
instance_variable_get("@#{name}")
|
113
118
|
end
|
114
119
|
|
115
120
|
# property?
|
116
121
|
define_method("#{name}?") do
|
117
|
-
load! unless instance_variable_defined?("@#{name}") || name ==
|
122
|
+
load! unless instance_variable_defined?("@#{name}") || name == :id
|
118
123
|
|
119
124
|
property = instance_variable_get("@#{name}")
|
120
125
|
property.respond_to?(:empty?) ? !property.empty? : !!property
|
@@ -35,7 +35,7 @@ module MetalArchives
|
|
35
35
|
# Return a +Date+ object
|
36
36
|
#
|
37
37
|
def date
|
38
|
-
raise MetalArchives::Errors::ArgumentError,
|
38
|
+
raise MetalArchives::Errors::ArgumentError, "Invalid conversion to Date: #{self.to_s}" unless year?
|
39
39
|
|
40
40
|
::Date.new @year, month || 1, day || 1
|
41
41
|
end
|
@@ -51,8 +51,8 @@ module MetalArchives
|
|
51
51
|
day = Integer(split[2]) if split.length > 2
|
52
52
|
|
53
53
|
return MetalArchives::NilDate.new year, month, day
|
54
|
-
rescue
|
55
|
-
raise MetalArchives::Errors::ArgumentError,
|
54
|
+
rescue => e
|
55
|
+
raise MetalArchives::Errors::ArgumentError, "Invalid date: #{value}: #{e}"
|
56
56
|
end
|
57
57
|
|
58
58
|
def to_s
|
data/spec/models/band_spec.rb
CHANGED
@@ -48,21 +48,6 @@ RSpec.describe MetalArchives::Band do
|
|
48
48
|
|
49
49
|
expect(-> { MetalArchives::Parsers::Band.send(:map_status, :invalid_status) }).to raise_error MetalArchives::Errors::ParserError
|
50
50
|
end
|
51
|
-
|
52
|
-
it 'rewrites URIs' do
|
53
|
-
old_endpoint = MetalArchives.config.endpoint
|
54
|
-
MetalArchives.config.endpoint = 'https://foo.bar/'
|
55
|
-
|
56
|
-
band = MetalArchives::Band.find! 122302
|
57
|
-
|
58
|
-
expect(band.logo.scheme).to eq 'https'
|
59
|
-
expect(band.logo.host).to eq 'foo.bar'
|
60
|
-
|
61
|
-
expect(band.logo.scheme).to eq 'https'
|
62
|
-
expect(band.photo.host).to eq 'foo.bar'
|
63
|
-
|
64
|
-
MetalArchives.config.endpoint = old_endpoint
|
65
|
-
end
|
66
51
|
end
|
67
52
|
|
68
53
|
describe 'methods' do
|