Class: Badger::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/badger/service.rb

Class Method Summary collapse

Class Method Details

.badge(name, github_slug) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/badger/service.rb', line 3

def self.badge name, github_slug
  return nil unless params = Config.instance.services[name]
  params = Config.instance.services[name]

  badge_url  = 'http://%s/%s/%s.svg' % [
      Config.instance.config['badge_service'],
      params['badge_slug'],
      github_slug
  ]
  target_url = 'https://%s/%s' % [
      params['url_path'],
      github_slug
  ]

  Badger.badge params['alt_text'], badge_url, target_url
end