Class: Octogate::TargetBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/octogate/target_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ TargetBuilder

Returns a new instance of TargetBuilder.



5
6
7
8
9
10
11
12
13
14
# File 'lib/octogate/target_builder.rb', line 5

def initialize(name)
  @name           = name
  @url            = nil
  @username       = nil
  @password       = nil
  @hook_type      = [:push]
  @http_method    = :get
  @parameter_type = :query
  @match          = nil
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/octogate/target_builder.rb', line 3

def name
  @name
end

Instance Method Details

#__to_target__Object



48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/octogate/target_builder.rb', line 48

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

#hook_type(types) ⇒ Object



28
29
30
# File 'lib/octogate/target_builder.rb', line 28

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

#http_method(http_method) ⇒ Object



32
33
34
# File 'lib/octogate/target_builder.rb', line 32

def http_method(http_method)
  @http_method = http_method
end

#match(match_proc) ⇒ Object



40
41
42
# File 'lib/octogate/target_builder.rb', line 40

def match(match_proc)
  @match = match_proc
end

#parameter_type(parameter_type) ⇒ Object



36
37
38
# File 'lib/octogate/target_builder.rb', line 36

def parameter_type(parameter_type)
  @parameter_type = parameter_type
end

#params(params) ⇒ Object



44
45
46
# File 'lib/octogate/target_builder.rb', line 44

def params(params)
  @params = params
end

#password(password) ⇒ Object



24
25
26
# File 'lib/octogate/target_builder.rb', line 24

def password(password)
  @password = password
end

#url(url) ⇒ Object



16
17
18
# File 'lib/octogate/target_builder.rb', line 16

def url(url)
  @url = url
end

#username(username) ⇒ Object



20
21
22
# File 'lib/octogate/target_builder.rb', line 20

def username(username)
  @username = username
end