metal_archives 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '00870c0edc861f8ff624c887f5a83346e1d2cba6'
4
- data.tar.gz: 19f0e38a29a17f35604ae692c5773c8bcee0cede
3
+ metadata.gz: 0ed8310a30556ecb2a4162a99f848fdb990c69cc
4
+ data.tar.gz: 0ab681f3fa13d9c26157490d6de20be03595e63c
5
5
  SHA512:
6
- metadata.gz: 2499d481e8719a3913504a826214824b7871004ffabed9661e1bb623510bdc3d4cbd9a80499d8b7a2888d24b0314334d6fb29dad12f033057a23fe2e7bcb7949
7
- data.tar.gz: d6825c4a2172caa7b37d3080154e653961c3e456e3018f20b283b286a493064a5401a00348752d3f207fb5af7a1b272df9d9145b136e922e3662b515fe499012
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 ==(:id)
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 ==(:id)
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, 'invalid date' unless year?
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, 'invalid date'
54
+ rescue => e
55
+ raise MetalArchives::Errors::ArgumentError, "Invalid date: #{value}: #{e}"
56
56
  end
57
57
 
58
58
  def to_s
@@ -4,5 +4,5 @@ module MetalArchives
4
4
  ##
5
5
  # MetalArchives API version
6
6
  #
7
- VERSION = '2.0.0'
7
+ VERSION = '2.0.1'
8
8
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metal_archives
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Dejonckheere