Sha256: 8d9cd6e58dcafc0de58a6ce7273ee666d69670e4e282419321405705d74aabdf

Contents?: true

Size: 754 Bytes

Versions: 3

Compression:

Stored size: 754 Bytes

Contents

module Ratis

  class LandmarkCategory

    attr_accessor :type, :description, :human_type, :human_description

    def self.all
      response = Request.get 'Getcategories'
      return [] unless response.success?

      response.to_array(:getcategories_response, :types, :typeinfo).map do |ti|
        lc                   = LandmarkCategory.new
        lc.type              = ti[:type]
        lc.description       = ti[:description]
        lc.human_type        = lc.type.gsub(/web/i, "")
        lc.human_description = lc.description.gsub(/web\s*/i, "")
        lc
      end
    end

    def self.web_categories
      all.select{|cat| cat.type.include?('WEB') }.map do |cat|
        [ cat.human_description, cat.type ]
      end
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ratis-3.3.6 lib/ratis/landmark_category.rb
ratis-3.3.5 lib/ratis/landmark_category.rb
ratis-3.3.4 lib/ratis/landmark_category.rb