module Met

Constants

VERSION

Public Class Methods

artwork(id) click to toggle source
# File lib/met.rb, line 12
def self.artwork(id)
  uri = URI("https://collectionapi.metmuseum.org/public/collection/v1/objects/#{id}")
  json = JSON.parse(Net::HTTP.get(uri))

  Artwork.new(
    id: json["objectID"],
    image: json["primaryImage"],
    preview: json["primaryImageSmall"],
    department: json["department"],
    name: json["objectName"],
    title: json["title"]
  )
end