Class: GimmeGimme::FakeCimServer
- Inherits:
-
Object
- Object
- GimmeGimme::FakeCimServer
show all
- Defined in:
- lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_server.rb
Defined Under Namespace
Modules: RequestParser
Classes: AuthOnlyTransaction, CaptureOnlyTransaction, CustomerPaymentProfile, CustomerProfile, Transaction
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of FakeCimServer.
8
9
10
11
12
13
|
# File 'lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_server.rb', line 8
def initialize
@customer_profiles = ActiveSupport::OrderedHash.new
@customer_payment_profiles = ActiveSupport::OrderedHash.new
@transactions = []
@errors = {}
end
|
Instance Attribute Details
#customer_payment_profiles ⇒ Object
Returns the value of attribute customer_payment_profiles.
6
7
8
|
# File 'lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_server.rb', line 6
def customer_payment_profiles
@customer_payment_profiles
end
|
#customer_profiles ⇒ Object
Returns the value of attribute customer_profiles.
6
7
8
|
# File 'lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_server.rb', line 6
def customer_profiles
@customer_profiles
end
|
#transactions ⇒ Object
Returns the value of attribute transactions.
6
7
8
|
# File 'lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_server.rb', line 6
def transactions
@transactions
end
|
Instance Method Details
#customer_payment_profile_exists?(payment_profile_id) ⇒ Boolean
54
55
56
|
# File 'lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_server.rb', line 54
def customer_payment_profile_exists?(payment_profile_id)
customer_payment_profiles.key?(payment_profile_id)
end
|
#customer_profile_exists?(customer_profile_id) ⇒ Boolean
50
51
52
|
# File 'lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_server.rb', line 50
def customer_profile_exists?(customer_profile_id)
customer_profiles.key?(customer_profile_id)
end
|
#last_customer_payment_profile ⇒ Object
30
31
32
|
# File 'lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_server.rb', line 30
def last_customer_payment_profile
@customer_payment_profiles.values.last
end
|
#last_customer_profile ⇒ Object
22
23
24
|
# File 'lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_server.rb', line 22
def last_customer_profile
@customer_profiles.values.last
end
|
#last_transaction ⇒ Object
26
27
28
|
# File 'lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_server.rb', line 26
def last_transaction
@transactions.last
end
|
#register_error_for(request, message, type = nil) ⇒ Object
34
35
36
37
38
39
|
# File 'lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_server.rb', line 34
def register_error_for(request, message, type = nil)
@errors[request] = {
:type => type,
:message => message
}
end
|
#request(method, url, data, headers) ⇒ Object
41
42
43
44
45
46
47
48
|
# File 'lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_server.rb', line 41
def request(method, url, data, )
Rails.logger.debug "[CIM Request] #{method} #{url}\n#{data}"
document = Nokogiri::XML.parse(data)
request_type = document.root.name
response = process_request(request_type, document)
Rails.logger.debug "[CIM Response]\n#{response}"
response
end
|
#reset ⇒ Object
15
16
17
18
19
20
|
# File 'lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_server.rb', line 15
def reset
@customer_payment_profiles.clear
@customer_profiles.clear
@transactions.clear
@errors.clear
end
|