Module: RegApi2::Builder

Included in:
Bill, Common, Domain, Folder, Hosting, Service, Shop, User, Zone
Defined in:
lib/reg_api2/builder.rb

Overview

Internal DSL Builder. Provides metamethods.

Class Method Summary (collapse)

Class Method Details

+ (Object) included(mod)

Extends module by metamethods category and define.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/reg_api2/builder.rb', line 7

def self.included(mod)
  mod.module_eval do

    class << self
      # @!method Sets method category
      # @param category [String or NilClass] Category of methods
      # @see define 
      def category category
        @cat = category
      end

      # @!method Defines API method.
      # @param name Name of specified method.
      def define name, defopts = {} 
        define_method name do |opts = {}|
          RegApi2.make_action(@cat, name, defopts, opts)
        end
      end
    end
  end
end