class CheckoutRu::ExpiredTicketResponse
Attributes
response[R]
Public Class Methods
new(response)
click to toggle source
# File lib/checkout_ru/expired_ticket_response.rb, line 7 def initialize(response) @response = response || {} end
Public Instance Methods
broken_error_as_of_oct_06_2014?()
click to toggle source
# File lib/checkout_ru/expired_ticket_response.rb, line 27 def broken_error_as_of_oct_06_2014? status == 500 && body =~ /Сервис\s+временно\s+не\s+доступен/ end
json_style_error_after_jan_2015?()
click to toggle source
# File lib/checkout_ru/expired_ticket_response.rb, line 19 def json_style_error_after_jan_2015? error && error_code == 3 && error_message =~ /is\s+expired\s+or\s+invalid/ end
match?()
click to toggle source
# File lib/checkout_ru/expired_ticket_response.rb, line 11 def match? # Checkout.ru changed (broke) invalid ticket responses a few times. These # predicates reflect various ways we've seen that tickets can expire. json_style_error_after_jan_2015? || old_style_error_before_jan_2015? || broken_error_as_of_oct_06_2014? end
old_style_error_before_jan_2015?()
click to toggle source
# File lib/checkout_ru/expired_ticket_response.rb, line 23 def old_style_error_before_jan_2015? [400, 500].include?(status) && body =~ /is\s+expired\s+or\s+invalid/ end
Private Instance Methods
body()
click to toggle source
# File lib/checkout_ru/expired_ticket_response.rb, line 36 def body; response[:body] end
error()
click to toggle source
# File lib/checkout_ru/expired_ticket_response.rb, line 33 def error; response[:error] end
error_code()
click to toggle source
# File lib/checkout_ru/expired_ticket_response.rb, line 34 def error_code; response[:error_code] end
error_message()
click to toggle source
# File lib/checkout_ru/expired_ticket_response.rb, line 35 def error_message; response[:error_message] end
status()
click to toggle source
# File lib/checkout_ru/expired_ticket_response.rb, line 37 def status; response[:status] end