Sha256: 616f2468d2c52e9043fcfd0aa4d14fef6e2742fe010ea92d6b1150ea5bb7b111

Contents?: true

Size: 784 Bytes

Versions: 13

Compression:

Stored size: 784 Bytes

Contents

module Ratis

  class LandmarkCategory

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

    def initialize(ti)
      @type              = ti[:type]
      @description       = ti[:description]
      @human_type        = type.gsub(/web/i, "")
      @human_description = description.gsub(/web\s*/i, "")
    end

    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

    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

13 entries across 13 versions & 1 rubygems

Version Path
ratis-3.6.6 lib/ratis/landmark_category.rb
ratis-3.6.5 lib/ratis/landmark_category.rb
ratis-3.6.4 lib/ratis/landmark_category.rb
ratis-3.6.3 lib/ratis/landmark_category.rb
ratis-3.6.2 lib/ratis/landmark_category.rb
ratis-3.6.1 lib/ratis/landmark_category.rb
ratis-3.6.0 lib/ratis/landmark_category.rb
ratis-3.5.0 lib/ratis/landmark_category.rb
ratis-3.4.3 lib/ratis/landmark_category.rb
ratis-3.4.2 lib/ratis/landmark_category.rb
ratis-3.4.1 lib/ratis/landmark_category.rb
ratis-3.4.0 lib/ratis/landmark_category.rb
ratis-3.3.7 lib/ratis/landmark_category.rb