Sha256: d42371633229d800b46510c78243860da68105232831df0e35a76aed9d0b7521

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

module Octogate
  class TargetBuilder
    def initialize
      @url            = nil
      @username       = nil
      @password       = nil
      @hook_type      = [:push]
      @http_method    = :get
      @parameter_type = :query
      @match          = nil
    end

    def url(url)
      @url = url
    end

    def username(username)
      @username = username
    end

    def password(password)
      @password = password
    end

    def hook_type(types)
      @hook_type = Array(types)
    end

    def http_method(http_method)
      @http_method = http_method
    end

    def parameter_type(parameter_type)
      @parameter_type = parameter_type
    end

    def match(match_proc)
      @match = match_proc
    end

    def params(params)
      @params = params
    end

    def __to_target__
      Target.new(
        url:             @url,
        username:        @username,
        password:        @password,
        hook_type:       @hook_type,
        http_method:     @http_method,
        parameter_type:  @parameter_type,
        params:          @params,
        match:           @match,
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
octogate-0.1.0 lib/octogate/target_builder.rb