Sha256: c38f3a247f80370aed48f49f32769fcb096f159515c3627015a3866a5ca3b290

Contents?: true

Size: 615 Bytes

Versions: 2

Compression:

Stored size: 615 Bytes

Contents

module Mirage
  class Templates
    include HTTParty
    def initialize base_url
      @url = "#{base_url}/templates"
      @requests = Requests.new(base_url)
      @default_config = TemplateConfiguration.new
    end

    def default_config &block
      return @default_config unless block_given?
      yield @default_config
    end

    def delete_all
      self.class.delete(@url)
      @requests.delete_all
    end

    def put endpoint, response
      template = Mirage::Template.new  "#{@url}/#{endpoint}", response, @default_config
      yield template if block_given?
      template.create
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mirage-3.0.0.alpha.2 lib/mirage/client/templates.rb
mirage-3.0.0.alpha.1 lib/mirage/client/templates.rb