Class: TCGPlayerSDK::Manifest

Inherits:
ResponseStruct show all
Defined in:
lib/tcg-player-sdk/manifest.rb

Overview

Add some shortcuts and helpers to parse the manifest

Instance Method Summary collapse

Methods inherited from ResponseStruct

#each, #keys, #method_missing, #respond_to_missing?, #to_h, #to_s, #try

Constructor Details

#initialize(hash = nil) ⇒ Manifest

Returns a new instance of Manifest.



4
5
6
# File 'lib/tcg-player-sdk/manifest.rb', line 4

def initialize(hash = nil)
  super
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class TCGPlayerSDK::ResponseStruct

Instance Method Details

#filtersArray<TCGPlayerSDK::ResponseStruct>

Pick out the filters struct from the response

Returns:



31
32
33
34
35
36
37
# File 'lib/tcg-player-sdk/manifest.rb', line 31

def filters
  if(self.results && self.results.is_a?(Array))
    @filters ||= self.results.first.filters
  end

  return @filters
end

#sort_valuesArray<String>

Returns The actual values that are legitimate inputs to search query's sort field.

Returns:

  • (Array<String>)

    The actual values that are legitimate inputs to search query's sort field



22
23
24
25
# File 'lib/tcg-player-sdk/manifest.rb', line 22

def sort_values
  _sorting = sorting || []
  @sort_values ||= _sorting.map(&:value)
end

#sortingArray<TCGPlayerSDK::ResponseStruct>

Pick out the sorting struct from the response

Returns:



12
13
14
15
16
17
18
# File 'lib/tcg-player-sdk/manifest.rb', line 12

def sorting
  if(self.results && self.results.is_a?(Array))
    @sorting ||= self.results.first.sorting
  end

  return @sorting
end