Class: PaysecureApiDocumentationLive::Success51Exception

Inherits:
APIException
  • Object
show all
Defined in:
lib/paysecure_api_documentation_live/exceptions/success51_exception.rb

Overview

Success51 class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ Success51Exception

The constructor.

Parameters:

  • reason (String)

    The reason for raising an exception.

  • response (HttpResponse)

    The HttpReponse of the API call.



47
48
49
50
51
# File 'lib/paysecure_api_documentation_live/exceptions/success51_exception.rb', line 47

def initialize(reason, response)
  super(reason, response)
  hash = APIHelper.json_deserialize(@response.raw_body)
  unbox(hash)
end

Instance Attribute Details

#amountFloat

TODO: Write general description for this method

Returns:

  • (Float)


22
23
24
# File 'lib/paysecure_api_documentation_live/exceptions/success51_exception.rb', line 22

def amount
  @amount
end

#created_onInteger

TODO: Write general description for this method

Returns:

  • (Integer)


26
27
28
# File 'lib/paysecure_api_documentation_live/exceptions/success51_exception.rb', line 26

def created_on
  @created_on
end

#currencyString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/paysecure_api_documentation_live/exceptions/success51_exception.rb', line 42

def currency
  @currency
end

#purchase_idString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/paysecure_api_documentation_live/exceptions/success51_exception.rb', line 18

def purchase_id
  @purchase_id
end

#reasonString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/paysecure_api_documentation_live/exceptions/success51_exception.rb', line 38

def reason
  @reason
end

#refund_idString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/paysecure_api_documentation_live/exceptions/success51_exception.rb', line 14

def refund_id
  @refund_id
end

#refund_onInteger

TODO: Write general description for this method

Returns:

  • (Integer)


30
31
32
# File 'lib/paysecure_api_documentation_live/exceptions/success51_exception.rb', line 30

def refund_on
  @refund_on
end

#statusString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/paysecure_api_documentation_live/exceptions/success51_exception.rb', line 34

def status
  @status
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



78
79
80
81
82
83
84
# File 'lib/paysecure_api_documentation_live/exceptions/success51_exception.rb', line 78

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} refund_id: #{@refund_id.inspect}, purchase_id: #{@purchase_id.inspect},"\
  " amount: #{@amount.inspect}, created_on: #{@created_on.inspect}, refund_on:"\
  " #{@refund_on.inspect}, status: #{@status.inspect}, reason: #{@reason.inspect}, currency:"\
  " #{@currency.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



70
71
72
73
74
75
# File 'lib/paysecure_api_documentation_live/exceptions/success51_exception.rb', line 70

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} refund_id: #{@refund_id}, purchase_id: #{@purchase_id}, amount: #{@amount},"\
  " created_on: #{@created_on}, refund_on: #{@refund_on}, status: #{@status}, reason:"\
  " #{@reason}, currency: #{@currency}>"
end

#unbox(hash) ⇒ Object

Populates this object by extracting properties from a hash. response body.

Parameters:

  • hash (Hash)

    The deserialized response sent by the server in the



56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/paysecure_api_documentation_live/exceptions/success51_exception.rb', line 56

def unbox(hash)
  return nil unless hash

  @refund_id = hash.key?('refundId') ? hash['refundId'] : nil
  @purchase_id = hash.key?('purchaseId') ? hash['purchaseId'] : nil
  @amount = hash.key?('amount') ? hash['amount'] : nil
  @created_on = hash.key?('createdOn') ? hash['createdOn'] : nil
  @refund_on = hash.key?('refundOn') ? hash['refundOn'] : nil
  @status = hash.key?('status') ? hash['status'] : nil
  @reason = hash.key?('reason') ? hash['reason'] : nil
  @currency = hash.key?('currency') ? hash['currency'] : nil
end