Class: Awis::Models::CategoryBrowse
- Defined in:
- lib/awis/models/category_browse.rb
Instance Attribute Summary collapse
-
#categories ⇒ Object
Returns the value of attribute categories.
-
#language_categories ⇒ Object
Returns the value of attribute language_categories.
-
#letter_bars ⇒ Object
Returns the value of attribute letter_bars.
-
#related_categories ⇒ Object
Returns the value of attribute related_categories.
Attributes inherited from Base
#request_id, #response, #status_code
Instance Method Summary collapse
-
#base_node_name ⇒ Object
rubocop:enable Metrics/AbcSize rubocop:enable Metrics/CyclomaticComplexity rubocop:enable Metrics/PerceivedComplexity rubocop:enable Metrics/MethodLength rubocop:enable Metrics/BlockLength.
- #category_node_name ⇒ Object
-
#initialize(response) ⇒ CategoryBrowse
constructor
A new instance of CategoryBrowse.
- #language_category_node_name ⇒ Object
- #letter_bars_node_name ⇒ Object
- #related_category_node_name ⇒ Object
-
#setup_data!(response) ⇒ Object
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/PerceivedComplexity rubocop:disable Metrics/MethodLength rubocop:disable Metrics/BlockLength.
Methods inherited from Base
#action_name, #loading_response, #pretty_xml, #relationship_collections, #root_node_name, #success?
Constructor Details
#initialize(response) ⇒ CategoryBrowse
Returns a new instance of CategoryBrowse.
8 9 10 11 12 13 14 15 |
# File 'lib/awis/models/category_browse.rb', line 8 def initialize(response) @categories = [] @language_categories = [] = [] = [] super(response) end |
Instance Attribute Details
#categories ⇒ Object
Returns the value of attribute categories.
6 7 8 |
# File 'lib/awis/models/category_browse.rb', line 6 def categories @categories end |
#language_categories ⇒ Object
Returns the value of attribute language_categories.
6 7 8 |
# File 'lib/awis/models/category_browse.rb', line 6 def language_categories @language_categories end |
#letter_bars ⇒ Object
Returns the value of attribute letter_bars.
6 7 8 |
# File 'lib/awis/models/category_browse.rb', line 6 def end |
#related_categories ⇒ Object
Returns the value of attribute related_categories.
6 7 8 |
# File 'lib/awis/models/category_browse.rb', line 6 def end |
Instance Method Details
#base_node_name ⇒ Object
rubocop:enable Metrics/AbcSize rubocop:enable Metrics/CyclomaticComplexity rubocop:enable Metrics/PerceivedComplexity rubocop:enable Metrics/MethodLength rubocop:enable Metrics/BlockLength
83 84 85 |
# File 'lib/awis/models/category_browse.rb', line 83 def base_node_name "#{root_node_name}/aws:CategoryBrowse" end |
#category_node_name ⇒ Object
87 88 89 |
# File 'lib/awis/models/category_browse.rb', line 87 def category_node_name "#{base_node_name}/aws:Categories/aws:Category" end |
#language_category_node_name ⇒ Object
91 92 93 |
# File 'lib/awis/models/category_browse.rb', line 91 def language_category_node_name "#{base_node_name}/aws:LanguageCategories/aws:Category" end |
#letter_bars_node_name ⇒ Object
99 100 101 |
# File 'lib/awis/models/category_browse.rb', line 99 def "#{base_node_name}/aws:LetterBars/aws:Category" end |
#related_category_node_name ⇒ Object
95 96 97 |
# File 'lib/awis/models/category_browse.rb', line 95 def "#{base_node_name}/aws:RelatedCategories/aws:Category" end |
#setup_data!(response) ⇒ Object
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/PerceivedComplexity rubocop:disable Metrics/MethodLength rubocop:disable Metrics/BlockLength
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/awis/models/category_browse.rb', line 22 def setup_data!(response) categories = [] language_categories = [] = [] = [] response.each_node do |node, path| text = node.inner_xml text = text.to_i if text.to_i.to_s == text text = nil if text.class == String && text.empty? if node.name == 'aws:RequestId' @request_id ||= text elsif node.name == 'aws:StatusCode' @status_code ||= text elsif node.name == 'aws:Path' && path == "#{category_node_name}/aws:Path" categories << { path: text } elsif node.name == 'aws:Title' && path == "#{category_node_name}/aws:Title" categories << { title: text } elsif node.name == 'aws:SubCategoryCount' && path == "#{category_node_name}/aws:SubCategoryCount" categories << { sub_category_count: text } elsif node.name == 'aws:TotalListingCount' && path == "#{category_node_name}/aws:TotalListingCount" categories << { total_listing_count: text } elsif node.name == 'aws:Path' && path == "#{language_category_node_name}/aws:Path" language_categories << { path: text } elsif node.name == 'aws:Title' && path == "#{language_category_node_name}/aws:Title" language_categories << { title: text } elsif node.name == 'aws:SubCategoryCount' && path == "#{language_category_node_name}/aws:SubCategoryCount" language_categories << { sub_category_count: text } elsif node.name == 'aws:TotalListingCount' && path == "#{language_category_node_name}/aws:TotalListingCount" language_categories << { total_listing_count: text } elsif node.name == 'aws:Path' && path == "#{related_category_node_name}/aws:Path" << { path: text } elsif node.name == 'aws:Title' && path == "#{related_category_node_name}/aws:Title" << { title: text } elsif node.name == 'aws:SubCategoryCount' && path == "#{related_category_node_name}/aws:SubCategoryCount" << { sub_category_count: text } elsif node.name == 'aws:TotalListingCount' && path == "#{related_category_node_name}/aws:TotalListingCount" << { total_listing_count: text } elsif node.name == 'aws:Path' && path == "#{letter_bars_node_name}/aws:Path" << { path: text } elsif node.name == 'aws:Title' && path == "#{letter_bars_node_name}/aws:Title" << { title: text } elsif node.name == 'aws:SubCategoryCount' && path == "#{letter_bars_node_name}/aws:SubCategoryCount" << { sub_category_count: text } elsif node.name == 'aws:TotalListingCount' && path == "#{letter_bars_node_name}/aws:TotalListingCount" << { total_listing_count: text } end end relationship_collections(@categories, categories, 4, Category) relationship_collections(@language_categories, language_categories, 4, LanguageCategory) relationship_collections(, , 4, ) relationship_collections(, , 4, LetterBar) end |