Class: DPay::ReturnUrls

Inherits:
Object
  • Object
show all
Defined in:
lib/dpay/payment/return_urls.rb,
sig/dpay/payment/return_urls.rbs

Constant Summary collapse

HTTP_URL =

Returns:

  • (Regexp)
%r{\Ahttps?://[^\s]+\z}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(success, fail, ipn) ⇒ ReturnUrls

Returns a new instance of ReturnUrls.

Parameters:

  • success (String)
  • fail (String)
  • ipn (String)


9
10
11
12
13
14
15
16
17
18
# File 'lib/dpay/payment/return_urls.rb', line 9

def initialize(success, fail, ipn)
  { "success" => success, "fail" => fail, "ipn" => ipn }.each do |name, url|
    raise InvalidArgumentError, %(Invalid #{name} URL "#{url}") unless url.is_a?(String) && HTTP_URL.match?(url)
  end

  @success = success
  @fail = fail
  @ipn = ipn
  freeze
end

Instance Attribute Details

#failString (readonly)

Returns the value of attribute fail.

Returns:

  • (String)


7
8
9
# File 'lib/dpay/payment/return_urls.rb', line 7

def fail
  @fail
end

#ipnString (readonly)

Returns the value of attribute ipn.

Returns:

  • (String)


7
8
9
# File 'lib/dpay/payment/return_urls.rb', line 7

def ipn
  @ipn
end

#successString (readonly)

Returns the value of attribute success.

Returns:

  • (String)


7
8
9
# File 'lib/dpay/payment/return_urls.rb', line 7

def success
  @success
end