Sha256: ea9aff8bf5a60c06060fe68bd43e537e387e36a906066204cc00392ab3cd4d6d

Contents?: true

Size: 1.39 KB

Versions: 8

Compression:

Stored size: 1.39 KB

Contents

module Pokemon
  class Set
    attr_accessor :id, :name, :series, :printed_total, :total, :legalities, :ptcgo_code, :release_date, :updated_at, :images

    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

    # Get the resource string
    #
    # @return [String] The API resource string
    def self.Resource
      "sets"
    end
    
    # Find a single set by the set code
    #
    # @param id [String] the set code
    # @return [Set] the Set object response
    def self.find(id)
      QueryBuilder.new(Set).find(id)
    end

    # Get all sets from a query by paging through data
    #
    # @return [Array<Set>] Array of Set objects
    def self.all
      QueryBuilder.new(Set).all
    end
    
    # Adds a parameter to the hash of query parameters
    #
    # @param args [Hash] the query parameter
    # @return [Array<Set>] Array of Set objects
    def self.where(args)
      QueryBuilder.new(Set).where(args)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pokemon_tcg_sdk-4.5.0 lib/pokemon_tcg_sdk/set.rb
pokemon_tcg_sdk-4.4.0 lib/pokemon_tcg_sdk/set.rb
pokemon_tcg_sdk-4.3.0 lib/pokemon_tcg_sdk/set.rb
pokemon_tcg_sdk-4.2.1 lib/pokemon_tcg_sdk/set.rb
pokemon_tcg_sdk-4.2.0 lib/pokemon_tcg_sdk/set.rb
pokemon_tcg_sdk-4.1.1 lib/pokemon_tcg_sdk/set.rb
pokemon_tcg_sdk-4.1.0 lib/pokemon_tcg_sdk/set.rb
pokemon_tcg_sdk-4.0.0 lib/pokemon_tcg_sdk/set.rb