Class: Velocify::Model::RequestBuilder

Inherits:
Object
  • Object
show all
Includes:
RequestHelpers
Defined in:
lib/velocify/model.rb

Instance Method Summary collapse

Methods included from RequestHelpers

#arrayify

Constructor Details

#initializeRequestBuilder

Returns a new instance of RequestBuilder.



73
74
75
# File 'lib/velocify/model.rb', line 73

def initialize
  @destruct = false
end

Instance Method Details

#authenticate?(is_on) ⇒ Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/velocify/model.rb', line 81

def authenticate? is_on
  @authenticate = is_on
end

#buildObject



101
102
103
104
105
106
107
108
109
# File 'lib/velocify/model.rb', line 101

def build
  Request.new.tap do |req|
    req.payload = @xml || MessagePayload.new(@message)
    req.requires_auth = @authenticate
    req.transform = @transform || -> (resp) { resp }
    req.operation = @operation
    req.destruct_response = @destruct          
  end
end

#destruct_response?(is_on) ⇒ Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/velocify/model.rb', line 77

def destruct_response? is_on
  @destruct = is_on
end

#message(msg) ⇒ Object



97
98
99
# File 'lib/velocify/model.rb', line 97

def message msg
  @message = msg
end

#operation(op) ⇒ Object



89
90
91
# File 'lib/velocify/model.rb', line 89

def operation op
  @operation = op.to_sym
end

#transform(&block) ⇒ Object



85
86
87
# File 'lib/velocify/model.rb', line 85

def transform &block
  @transform = block
end

#xml(xml) ⇒ Object



93
94
95
# File 'lib/velocify/model.rb', line 93

def xml xml
  @xml = xml
end