Class: Scryfall::Cards

Inherits:
Base
  • Object
show all
Defined in:
lib/scryfall/cards.rb

Class Method Summary collapse

Class Method Details

.named_exact(cardname, **args) ⇒ Object



8
9
10
# File 'lib/scryfall/cards.rb', line 8

def self.named_exact(cardname, **args)
  api.get '/cards/named', { exact: cardname }, **args
end

.named_fuzzy(cardname, **args) ⇒ Object



4
5
6
# File 'lib/scryfall/cards.rb', line 4

def self.named_fuzzy(cardname, **args)
  api.get '/cards/named', { fuzzy: cardname }, **args
end

.search(query, **args) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/scryfall/cards.rb', line 12

def self.search(query, **args)
  params = { q: query.encode }

  if args.has_key?(:page) && args.page >= 1
    params['page'] = args.page
  end

  api.get '/cards/search', params, **args
end

.with_arena_id(id, **args) ⇒ Object



26
27
28
# File 'lib/scryfall/cards.rb', line 26

def self.with_arena_id(id, **args)
  api.get "/cards/arena/#{id}", {}, **args
end

.with_id(id, **args) ⇒ Object



34
35
36
# File 'lib/scryfall/cards.rb', line 34

def self.with_id(id, **args)
  api.get "/cards/#{id}", {}, **args
end

.with_mtgo_id(id, **args) ⇒ Object



22
23
24
# File 'lib/scryfall/cards.rb', line 22

def self.with_mtgo_id(id, **args)
  api.get "/cards/mtgo/#{id}", {}, **args
end

.with_tcgplayer_id(id, **args) ⇒ Object



30
31
32
# File 'lib/scryfall/cards.rb', line 30

def self.with_tcgplayer_id(id, **args)
  api.get "/cards/tcgplayer/#{id}", {}, **args
end