Compare commits
2 commits
d6888f1941
...
3ea0842f00
Author | SHA1 | Date | |
---|---|---|---|
3ea0842f00 | |||
9d8f035360 |
1 changed files with 8 additions and 1 deletions
|
@ -35,7 +35,11 @@ class Pet < ApplicationRecord
|
|||
color_id: pet_data[:color_id].to_i
|
||||
)
|
||||
|
||||
new_image_hash = Pet.fetch_image_hash(self.name)
|
||||
begin
|
||||
new_image_hash = Pet.fetch_image_hash(self.name)
|
||||
rescue => error
|
||||
Rails.logger.warn "Failed to load image hash: #{error.full_message}"
|
||||
end
|
||||
self.pet_type.image_hash = new_image_hash if new_image_hash.present?
|
||||
|
||||
# With an alt style, `body_id` in the biology data refers to the body ID of
|
||||
|
@ -133,6 +137,9 @@ class Pet < ApplicationRecord
|
|||
end
|
||||
|
||||
def self.fetch_metadata(name, timeout: 10)
|
||||
# If this is an image hash "pet name", it has no metadata.
|
||||
return nil if name.start_with?("@")
|
||||
|
||||
request = PET_SERVICE.action('getPet').request([name])
|
||||
send_amfphp_request(request).tap do |data|
|
||||
if data[:name].blank?
|
||||
|
|
Loading…
Reference in a new issue