Class: WirecardCheckoutPage::InitResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/wirecard_checkout_page/init_response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body, original_response: nil) ⇒ InitResponse

Returns a new instance of InitResponse.


11
12
13
14
# File 'lib/wirecard_checkout_page/init_response.rb', line 11

def initialize(body, original_response: nil)
  @body = body
  @original_response = original_response
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body


18
19
20
# File 'lib/wirecard_checkout_page/init_response.rb', line 18

def body
  @body
end

#original_responseObject (readonly)

Returns the value of attribute original_response


16
17
18
# File 'lib/wirecard_checkout_page/init_response.rb', line 16

def original_response
  @original_response
end

Class Method Details

.from_typhoeus_response(response) ⇒ Object


7
8
9
# File 'lib/wirecard_checkout_page/init_response.rb', line 7

def self.from_typhoeus_response(response)
  new(response.body, original_response: response)
end

Instance Method Details

#messageObject


30
31
32
# File 'lib/wirecard_checkout_page/init_response.rb', line 30

def message
  @original_response.body
end

#paramsObject


20
21
22
23
24
# File 'lib/wirecard_checkout_page/init_response.rb', line 20

def params
  {
    payment_url: @original_response.headers['Location']
  }
end

#success?Boolean

Returns:

  • (Boolean)

26
27
28
# File 'lib/wirecard_checkout_page/init_response.rb', line 26

def success?
  !!params[:payment_url]
end