Class: FederalRegister::HighlightedDocument
- Defined in:
- lib/federal_register/highlighted_document.rb
Defined Under Namespace
Classes: InvalidPhotoSize, PhotoCredit
Constant Summary collapse
- VALID_PHOTO_SIZES =
[ 'full_size', 'homepage', 'large', 'medium', 'navigation', 'small' ]
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
add_attribute, #fetch_full, #full?, #initialize, override_base_uri
Methods inherited from Client
Constructor Details
This class inherits a constructor from FederalRegister::Base
Instance Method Details
#photo_credit ⇒ Object
30 31 32 |
# File 'lib/federal_register/highlighted_document.rb', line 30 def photo_credit @credit ||= PhotoCredit.new(attributes['photo']['credit']) if attributes['photo'] end |
#photo_url(size) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/federal_register/highlighted_document.rb', line 19 def photo_url(size) unless VALID_PHOTO_SIZES.include?(size) raise InvalidPhotoSize, "valid photo sizes are #{VALID_PHOTO_SIZES.join(', ')}" end if attributes['photo'] attributes['photo']['urls'][size] end end |