Sha256: 79c0bf3ac3a109009b332ae99b70af07f0dbead6ab5d93a17a58d305f769c4a6

Contents?: true

Size: 716 Bytes

Versions: 11

Compression:

Stored size: 716 Bytes

Contents

class Lbrt::Service::Exporter
  class << self
    def export(client, options = {})
      self.new(client, options).export
    end
  end # of class methods

  def initialize(client, options = {})
    @client = client
    @options = options
  end

  def export
    services = @client.services.get
    normalize(services)
  end

  private

  def normalize(services)
    service_by_key = {}

    services.each do |srvc|
      type = srvc.delete('type')
      title = srvc.delete('title')
      service_key = [type, title]

      if service_by_key[service_key]
        raise "Duplicate service type/title exists: #{type}/#{title}"
      end

      service_by_key[service_key] = srvc
    end

    service_by_key
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
lbrt-0.2.1 lib/lbrt/service/exporter.rb
lbrt-0.2.0 lib/lbrt/service/exporter.rb
lbrt-0.1.9 lib/lbrt/service/exporter.rb
lbrt-0.1.8 lib/lbrt/service/exporter.rb
lbrt-0.1.7 lib/lbrt/service/exporter.rb
lbrt-0.1.6 lib/lbrt/service/exporter.rb
lbrt-0.1.5 lib/lbrt/service/exporter.rb
lbrt-0.1.4 lib/lbrt/service/exporter.rb
lbrt-0.1.3 lib/lbrt/service/exporter.rb
lbrt-0.1.1 lib/lbrt/service/exporter.rb
lbrt-0.1.0 lib/lbrt/service/exporter.rb