Sha256: 6da55df49fdbed203fcc3bce53ddefc20fb344d0e309527f02469184c5db8d3b

Contents?: true

Size: 1.1 KB

Versions: 36

Compression:

Stored size: 1.1 KB

Contents

require 'client/helpers/method_builder'
require 'client/template/model/common_methods'
require 'client/template/model/instance_methods'

module Mirage
  class Template
    module Model

      class << self
        def extended clazz
          clazz.extend(CommonMethods)
          clazz.extend(Helpers::MethodBuilder)
          clazz.send(:include, HTTParty)
          clazz.send(:include, CommonMethods)
          clazz.send(:include, InstanceMethods)


          mod = Module.new do
            def initialize *args

              super *args
              [:content_type,
               :http_method,
               :default,
               :status,
               :delay,
               :required_parameters,
               :required_body_content,
               :required_headers,
               :headers,
               :endpoint, :delay].each do |attribute|
                eval("#{attribute} self.class.#{attribute} if self.class.#{attribute}")
              end


            end
          end

          clazz.send(:include, mod)

          clazz.format :json
          clazz
        end
      end
    end

  end
end

Version data entries

36 entries across 36 versions & 2 rubygems

Version Path
mirage-4.0.0.alpha10 lib/mirage/client/template/model.rb
mirage-4.0.0.alpha9 lib/mirage/client/template/model.rb
mirage-4.0.0.alpha8 lib/mirage/client/template/model.rb
mirage-4.0.0.alpha6 lib/mirage/client/template/model.rb
mirage-4.0.0.alpha5 lib/mirage/client/template/model.rb
mirage-4.0.0.alpha4 lib/mirage/client/template/model.rb
mirage-4.0.0.alpha3 lib/mirage/client/template/model.rb
mirage-4.0.0.alpha2 lib/mirage/client/template/model.rb
mirage-4.0.0.alpha1 lib/mirage/client/template/model.rb
mirage-3.0.14 lib/mirage/client/template/model.rb
mirage-3.0.13 lib/mirage/client/template/model.rb
mirage-3.0.12 lib/mirage/client/template/model.rb
mirage-3.0.11 lib/mirage/client/template/model.rb
mirage-3.0.10 lib/mirage/client/template/model.rb
mirage-3.0.9 lib/mirage/client/template/model.rb
mirage-on-thin-3.0.8 lib/mirage/client/template/model.rb
mirage-3.0.8 lib/mirage/client/template/model.rb
mirage-3.0.7 lib/mirage/client/template/model.rb
mirage-3.0.6 lib/mirage/client/template/model.rb
mirage-3.0.5 lib/mirage/client/template/model.rb