Class: Tinyembedly::Service

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/tinyembedly/service.rb

Class Method Summary collapse

Class Method Details

.servicesObject



5
6
7
8
9
10
11
# File 'lib/tinyembedly/service.rb', line 5

def self.services
  if !defined?(@@services) || @@services.nil?
    res = get("http://#{BASE_URI}/1/services/ruby")
    @@services = res.code == 200 ? res.parsed_response : nil
  end
  @@services
end

.services_regexObject



13
14
15
16
17
18
# File 'lib/tinyembedly/service.rb', line 13

def self.services_regex
  if services.is_a?(Array)
    r = services.collect { |service| service['regex'].join('|') }.join('|')
    Regexp.new("^(#{r})$")
  end
end