Class: CASino::ProxyResponseBuilder

Inherits:
Object
  • Object
show all
Defined in:
app/builders/casino/proxy_response_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(success, options) ⇒ ProxyResponseBuilder

Returns a new instance of ProxyResponseBuilder.



6
7
8
9
# File 'app/builders/casino/proxy_response_builder.rb', line 6

def initialize(success, options)
  @success = success
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'app/builders/casino/proxy_response_builder.rb', line 4

def options
  @options
end

#successObject (readonly)

Returns the value of attribute success.



4
5
6
# File 'app/builders/casino/proxy_response_builder.rb', line 4

def success
  @success
end

Instance Method Details

#buildObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/builders/casino/proxy_response_builder.rb', line 11

def build
  xml = Builder::XmlMarkup.new(indent: 2)
  xml.cas :serviceResponse, 'xmlns:cas' => 'http://www.yale.edu/tp/cas' do |service_response|
    if success
      service_response.cas :proxySuccess do |proxy_success|
        proxy_success.cas :proxyTicket, options[:proxy_ticket].ticket
      end
    else
      service_response.cas :proxyFailure, options[:error_message], code: options[:error_code]
    end
  end
  xml.target!
end