Class: TCGPlayerSDK::Manifest
- Inherits:
-
ResponseStruct
- Object
- OpenStruct
- ResponseStruct
- TCGPlayerSDK::Manifest
- Defined in:
- lib/tcg-player-sdk/manifest.rb
Overview
Add some shortcuts and helpers to parse the manifest
Instance Method Summary collapse
-
#filters ⇒ Array<TCGPlayerSDK::ResponseStruct>
Pick out the filters struct from the response.
-
#initialize(hash = nil) ⇒ Manifest
constructor
A new instance of Manifest.
-
#sort_values ⇒ Array<String>
The actual values that are legitimate inputs to search query's sort field.
-
#sorting ⇒ Array<TCGPlayerSDK::ResponseStruct>
Pick out the sorting struct from the response.
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
#filters ⇒ Array<TCGPlayerSDK::ResponseStruct>
Pick out the filters struct from the response
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_values ⇒ Array<String>
Returns 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 |
#sorting ⇒ Array<TCGPlayerSDK::ResponseStruct>
Pick out the sorting struct from the response
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 |