Class: MTG::Set
- Inherits:
-
Object
- Object
- MTG::Set
- Includes:
- RestClient, SetRepresenter, Roar::JSON
- Defined in:
- lib/mtg_sdk/set.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#booster ⇒ Object
Returns the value of attribute booster.
-
#border ⇒ Object
Returns the value of attribute border.
-
#code ⇒ Object
Returns the value of attribute code.
-
#gatherer_code ⇒ Object
Returns the value of attribute gatherer_code.
-
#magic_cards_info_code ⇒ Object
Returns the value of attribute magic_cards_info_code.
-
#mkm_id ⇒ Object
Returns the value of attribute mkm_id.
-
#mkm_name ⇒ Object
Returns the value of attribute mkm_name.
-
#name ⇒ Object
Returns the value of attribute name.
-
#old_code ⇒ Object
Returns the value of attribute old_code.
-
#online_only ⇒ Object
Returns the value of attribute online_only.
-
#release_date ⇒ Object
Returns the value of attribute release_date.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
-
.all ⇒ Array<Set>
Get all sets from a query.
-
.find(code) ⇒ Set
Find a single set by the set code.
-
.generate_booster(code) ⇒ Array<Card>
Array of Card objects.
-
.Resource ⇒ string
Get the resource string.
-
.where(args) ⇒ QueryBuilder
Adds a parameter to the hash of query parameters.
Methods included from RestClient
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
11 12 13 |
# File 'lib/mtg_sdk/set.rb', line 11 def block @block end |
#booster ⇒ Object
Returns the value of attribute booster.
11 12 13 |
# File 'lib/mtg_sdk/set.rb', line 11 def booster @booster end |
#border ⇒ Object
Returns the value of attribute border.
11 12 13 |
# File 'lib/mtg_sdk/set.rb', line 11 def border @border end |
#code ⇒ Object
Returns the value of attribute code.
11 12 13 |
# File 'lib/mtg_sdk/set.rb', line 11 def code @code end |
#gatherer_code ⇒ Object
Returns the value of attribute gatherer_code.
11 12 13 |
# File 'lib/mtg_sdk/set.rb', line 11 def gatherer_code @gatherer_code end |
#magic_cards_info_code ⇒ Object
Returns the value of attribute magic_cards_info_code.
11 12 13 |
# File 'lib/mtg_sdk/set.rb', line 11 def magic_cards_info_code @magic_cards_info_code end |
#mkm_id ⇒ Object
Returns the value of attribute mkm_id.
11 12 13 |
# File 'lib/mtg_sdk/set.rb', line 11 def mkm_id @mkm_id end |
#mkm_name ⇒ Object
Returns the value of attribute mkm_name.
11 12 13 |
# File 'lib/mtg_sdk/set.rb', line 11 def mkm_name @mkm_name end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/mtg_sdk/set.rb', line 11 def name @name end |
#old_code ⇒ Object
Returns the value of attribute old_code.
11 12 13 |
# File 'lib/mtg_sdk/set.rb', line 11 def old_code @old_code end |
#online_only ⇒ Object
Returns the value of attribute online_only.
11 12 13 |
# File 'lib/mtg_sdk/set.rb', line 11 def online_only @online_only end |
#release_date ⇒ Object
Returns the value of attribute release_date.
11 12 13 |
# File 'lib/mtg_sdk/set.rb', line 11 def release_date @release_date end |
#type ⇒ Object
Returns the value of attribute type.
11 12 13 |
# File 'lib/mtg_sdk/set.rb', line 11 def type @type end |
Class Method Details
.all ⇒ Array<Set>
Get all sets from a query
33 34 35 |
# File 'lib/mtg_sdk/set.rb', line 33 def self.all QueryBuilder.new(Set).all end |
.find(code) ⇒ Set
Find a single set by the set code
26 27 28 |
# File 'lib/mtg_sdk/set.rb', line 26 def self.find(code) QueryBuilder.new(Set).find(code) end |
.generate_booster(code) ⇒ Array<Card>
Returns Array of Card objects.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/mtg_sdk/set.rb', line 49 def self.generate_booster(code) cards = [] response = RestClient.get("sets/#{code}/booster") data = response.body['cards'] data.each do |card| cards << Card.new.from_json(card.to_json) end cards end |
.Resource ⇒ string
Get the resource string
18 19 20 |
# File 'lib/mtg_sdk/set.rb', line 18 def self.Resource "sets" end |
.where(args) ⇒ QueryBuilder
Adds a parameter to the hash of query parameters
41 42 43 |
# File 'lib/mtg_sdk/set.rb', line 41 def self.where(args) QueryBuilder.new(Set).where(args) end |