class Ygoprodeck::Name

Attributes

name[R]

Public Class Methods

is(name) click to toggle source
# File lib/ygoprodeck/search/name.rb, line 5
def self.is(name)
        url = "#{Ygoprodeck::Endpoint.is}?name=#{name}"
        uri = URI(url)
        response = Net::HTTP.get(uri)
        load = JSON.parse(response)
        
        if load[0] == nil
                '{"error"=>"No card matching your query was found in the database."}'
        else
                load[0]
        end
        
end