class Mtgapi::Client
Attributes
token[R]
Public Class Methods
new(token = ENV['MTG_TOKEN'])
click to toggle source
# File lib/mtgapi/client.rb, line 11 def initialize(token = ENV['MTG_TOKEN']) @token = token end
Public Instance Methods
find_by(attr, value)
click to toggle source
# File lib/mtgapi/client.rb, line 19 def find_by(attr, value) url = self.send("#{attr.to_s}_url", value) self.class.get(url).parsed_response end
id_url(id)
click to toggle source
# File lib/mtgapi/client.rb, line 24 def id_url(id) "/card/id/#{id}" end
name_url(name)
click to toggle source
# File lib/mtgapi/client.rb, line 28 def name_url(name) "/card/name/#{name}" end
set_url(set)
click to toggle source
# File lib/mtgapi/client.rb, line 32 def set_url(set) "/card/set/#{set}" end
sets()
click to toggle source
# File lib/mtgapi/client.rb, line 15 def sets self.class.get("/list/sets").parsed_response end
token_append()
click to toggle source
# File lib/mtgapi/client.rb, line 36 def token_append "?token=#{token}" end