Class: Ratis::LandmarkCategory
- Inherits:
-
Object
- Object
- Ratis::LandmarkCategory
- Defined in:
- lib/ratis/landmark_category.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#human_description ⇒ Object
Returns the value of attribute human_description.
-
#human_type ⇒ Object
Returns the value of attribute human_type.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ti) ⇒ LandmarkCategory
constructor
A new instance of LandmarkCategory.
Constructor Details
#initialize(ti) ⇒ LandmarkCategory
Returns a new instance of LandmarkCategory.
7 8 9 10 11 12 |
# File 'lib/ratis/landmark_category.rb', line 7 def initialize(ti) @type = ti[:type] @description = ti[:description] @human_type = type.gsub(/web/i, "") @human_description = description.gsub(/web\s*/i, "") end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
5 6 7 |
# File 'lib/ratis/landmark_category.rb', line 5 def description @description end |
#human_description ⇒ Object
Returns the value of attribute human_description.
5 6 7 |
# File 'lib/ratis/landmark_category.rb', line 5 def human_description @human_description end |
#human_type ⇒ Object
Returns the value of attribute human_type.
5 6 7 |
# File 'lib/ratis/landmark_category.rb', line 5 def human_type @human_type end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/ratis/landmark_category.rb', line 5 def type @type end |
Class Method Details
.all ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ratis/landmark_category.rb', line 14 def self.all response = Request.get 'Getcategories' return [] unless response.success? categories = response.to_array(:getcategories_response, :types, :typeinfo) categories.map do |category| Ratis::LandmarkCategory.new(category) end end |
.web_categories ⇒ Object
25 26 27 28 29 |
# File 'lib/ratis/landmark_category.rb', line 25 def self.web_categories all.select{|cat| cat.type.include?('WEB') }.map do |cat| [ cat.human_description, cat.type ] end end |