Class: Pokemon::Set

Inherits:
Object
  • Object
show all
Defined in:
lib/pokemon_tcg_sdk/set.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/pokemon_tcg_sdk/set.rb', line 3

def id
  @id
end

#imagesObject

Returns the value of attribute images.



3
4
5
# File 'lib/pokemon_tcg_sdk/set.rb', line 3

def images
  @images
end

#legalitiesObject

Returns the value of attribute legalities.



3
4
5
# File 'lib/pokemon_tcg_sdk/set.rb', line 3

def legalities
  @legalities
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/pokemon_tcg_sdk/set.rb', line 3

def name
  @name
end

#printed_totalObject

Returns the value of attribute printed_total.



3
4
5
# File 'lib/pokemon_tcg_sdk/set.rb', line 3

def printed_total
  @printed_total
end

#ptcgo_codeObject

Returns the value of attribute ptcgo_code.



3
4
5
# File 'lib/pokemon_tcg_sdk/set.rb', line 3

def ptcgo_code
  @ptcgo_code
end

#release_dateObject

Returns the value of attribute release_date.



3
4
5
# File 'lib/pokemon_tcg_sdk/set.rb', line 3

def release_date
  @release_date
end

#seriesObject

Returns the value of attribute series.



3
4
5
# File 'lib/pokemon_tcg_sdk/set.rb', line 3

def series
  @series
end

#totalObject

Returns the value of attribute total.



3
4
5
# File 'lib/pokemon_tcg_sdk/set.rb', line 3

def total
  @total
end

#updated_atObject

Returns the value of attribute updated_at.



3
4
5
# File 'lib/pokemon_tcg_sdk/set.rb', line 3

def updated_at
  @updated_at
end

Class Method Details

.allArray<Set>

Get all sets from a query by paging through data

Returns:

  • (Array<Set>)

    Array of Set objects



39
40
41
# File 'lib/pokemon_tcg_sdk/set.rb', line 39

def self.all
  QueryBuilder.new(Set).all
end

.find(id) ⇒ Set

Find a single set by the set code

Parameters:

  • id (String)

    the set code

Returns:

  • (Set)

    the Set object response



32
33
34
# File 'lib/pokemon_tcg_sdk/set.rb', line 32

def self.find(id)
  QueryBuilder.new(Set).find(id)
end

.from_json(json) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/pokemon_tcg_sdk/set.rb', line 5

def self.from_json(json)
  set = Set.new
  set.id = json['id']
  set.name = json['name']
  set.series = json['series']
  set.printed_total = json['printedTotal']
  set.total = json['total']
  set.legalities = Legalities.from_json(json['legalities']) if !json['legalities'].nil?
  set.ptcgo_code = json['ptcgoCode']
  set.release_date = json['releaseDate']
  set.updated_at = json['updatedAt']
  set.images = SetImages.from_json(json['images']) if !json['images'].nil?

  set
end

.ResourceString

Get the resource string

Returns:

  • (String)

    The API resource string



24
25
26
# File 'lib/pokemon_tcg_sdk/set.rb', line 24

def self.Resource
  "sets"
end

.where(args) ⇒ Array<Set>

Adds a parameter to the hash of query parameters

Parameters:

  • args (Hash)

    the query parameter

Returns:

  • (Array<Set>)

    Array of Set objects



47
48
49
# File 'lib/pokemon_tcg_sdk/set.rb', line 47

def self.where(args)
  QueryBuilder.new(Set).where(args)
end