Class: UsersTest
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- UsersTest
- Defined in:
- lib/ost-sdk-ruby/test/users_test.rb,
lib/ost-sdk-ruby/test/webhooks_test.rb
Instance Method Summary collapse
- #test_users_create ⇒ Object
- #test_users_get ⇒ Object
- #test_users_get_list ⇒ Object
- #test_webhooks_create ⇒ Object
- #test_webhooks_verify_signature ⇒ Object
- #users_service ⇒ Object
- #webhooks_delete(webhook_id) ⇒ Object
- #webhooks_get(webhook_id) ⇒ Object
- #webhooks_get_all ⇒ Object
- #webhooks_service ⇒ Object
- #webhooks_update(webhook_id) ⇒ Object
Instance Method Details
#test_users_create ⇒ Object
12 13 14 15 16 |
# File 'lib/ost-sdk-ruby/test/users_test.rb', line 12 def test_users_create result = users_service.create() puts "result=>#{result}" unless result["success"] assert_equal(result["success"], true) end |
#test_users_get ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/ost-sdk-ruby/test/users_test.rb', line 18 def test_users_get result = users_service.get({ user_id: Config::OST_KIT_USER_ID }) puts "result=>#{result}" unless result["success"] assert_equal(result["success"], true) end |
#test_users_get_list ⇒ Object
26 27 28 29 30 |
# File 'lib/ost-sdk-ruby/test/users_test.rb', line 26 def test_users_get_list result = users_service.get_list() puts "result=>#{result}" unless result["success"] assert_equal(result["success"], true) end |
#test_webhooks_create ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ost-sdk-ruby/test/webhooks_test.rb', line 12 def test_webhooks_create result = webhooks_service.create({ topics: ['transactions/initiate', 'transactions/success'], url: 'https://testingWebhooks.com' }) puts "result=>#{result}" unless result["success"] webhook_id = result["data"]["webhook"]["id"] webhooks_get(webhook_id) webhooks_get_all webhooks_update(webhook_id) webhooks_delete(webhook_id) assert_equal(result["success"], true) end |
#test_webhooks_verify_signature ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/ost-sdk-ruby/test/webhooks_test.rb', line 58 def test_webhooks_verify_signature data = {} data[:hello] = 'hello' result = webhooks_service.verify_signature({ version: "2", webhook_secret: "mySecret", request_timestamp: "1559902637", signature: "2c56c143550c603a6ff47054803f03ee4755c9c707986ae27f7ca1dd1c92a824", stringified_data: data.to_json }) puts "result=>#{result}" unless result assert_equal(result, true) end |
#users_service ⇒ Object
8 9 10 |
# File 'lib/ost-sdk-ruby/test/users_test.rb', line 8 def users_service @users_service ||= Config::OST_SDK.services.users end |
#webhooks_delete(webhook_id) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/ost-sdk-ruby/test/webhooks_test.rb', line 50 def webhooks_delete(webhook_id) result = webhooks_service.delete({ webhook_id: webhook_id, }) puts "result=>#{result}" unless result["success"] assert_equal(result["success"], true) end |
#webhooks_get(webhook_id) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/ost-sdk-ruby/test/webhooks_test.rb', line 26 def webhooks_get(webhook_id) result = webhooks_service.get({ webhook_id: webhook_id }) puts "result=>#{result}" unless result["success"] assert_equal(result["success"], true) end |
#webhooks_get_all ⇒ Object
34 35 36 37 38 |
# File 'lib/ost-sdk-ruby/test/webhooks_test.rb', line 34 def webhooks_get_all result = webhooks_service.get_list() puts "result=>#{result}" unless result["success"] assert_equal(result["success"], true) end |
#webhooks_service ⇒ Object
8 9 10 |
# File 'lib/ost-sdk-ruby/test/webhooks_test.rb', line 8 def webhooks_service @webhooks_service ||= Config::OST_SDK.services.webhooks end |
#webhooks_update(webhook_id) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/ost-sdk-ruby/test/webhooks_test.rb', line 40 def webhooks_update(webhook_id) result = webhooks_service.update({ webhook_id: webhook_id, topics: ['transactions/initiate', 'transactions/success', 'transactions/failure'], status: 'inactive' }) puts "result=>#{result}" unless result["success"] assert_equal(result["success"], true) end |