Method: OpenStax::Content::S3#path_for
- Defined in:
- lib/openstax/content/s3.rb
#path_for(archive_version = nil, book_id = nil, page_uuid = nil, extension = nil) ⇒ Object
Returns the archive path for the given archive_version, book_id, page_uuid and extension If not all arguments are given, returns the prefix instead
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/openstax/content/s3.rb', line 27 def path_for(archive_version = nil, book_id = nil, page_uuid = nil, extension = nil) archive_path = OpenStax::Content.archive_path.chomp('/') if archive_version.nil? "#{archive_path}/" elsif book_id.nil? "#{archive_path}/#{archive_version}/contents/" elsif page_uuid.nil? "#{archive_path}/#{archive_version}/contents/#{book_id}:" elsif extension.nil? "#{archive_path}/#{archive_version}/contents/#{book_id}:#{page_uuid}." else "#{archive_path}/#{archive_version}/contents/#{book_id}:#{page_uuid}.#{extension}" end end |