mx-platform-ruby 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (260) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -2
  3. data/Gemfile.lock +84 -0
  4. data/README.md +236 -33
  5. data/Rakefile +8 -9
  6. data/lib/mx-platform-ruby.rb +126 -35
  7. data/lib/mx-platform-ruby/api/mx_platform_api.rb +4917 -0
  8. data/lib/mx-platform-ruby/api_client.rb +395 -0
  9. data/lib/mx-platform-ruby/api_error.rb +57 -0
  10. data/lib/mx-platform-ruby/configuration.rb +276 -0
  11. data/lib/mx-platform-ruby/models/account.rb +569 -0
  12. data/lib/mx-platform-ruby/models/account_number.rb +281 -0
  13. data/lib/mx-platform-ruby/models/account_numbers_response_body.rb +229 -0
  14. data/lib/mx-platform-ruby/models/account_owner.rb +317 -0
  15. data/lib/mx-platform-ruby/models/account_owners_response_body.rb +229 -0
  16. data/lib/mx-platform-ruby/models/account_response_body.rb +218 -0
  17. data/lib/mx-platform-ruby/models/account_update_request.rb +218 -0
  18. data/lib/mx-platform-ruby/models/account_update_request_body.rb +218 -0
  19. data/lib/mx-platform-ruby/models/accounts_response_body.rb +229 -0
  20. data/lib/mx-platform-ruby/models/categories_response_body.rb +229 -0
  21. data/lib/mx-platform-ruby/models/category.rb +281 -0
  22. data/lib/mx-platform-ruby/models/category_create_request.rb +241 -0
  23. data/lib/mx-platform-ruby/models/category_create_request_body.rb +218 -0
  24. data/lib/mx-platform-ruby/models/category_response_body.rb +218 -0
  25. data/lib/mx-platform-ruby/models/category_update_request.rb +227 -0
  26. data/lib/mx-platform-ruby/models/category_update_request_body.rb +218 -0
  27. data/lib/mx-platform-ruby/models/challenge.rb +276 -0
  28. data/lib/mx-platform-ruby/models/challenge_image_options.rb +236 -0
  29. data/lib/mx-platform-ruby/models/challenge_options.rb +227 -0
  30. data/lib/mx-platform-ruby/models/challenges_response_body.rb +229 -0
  31. data/lib/mx-platform-ruby/models/connect_widget.rb +227 -0
  32. data/lib/mx-platform-ruby/models/connect_widget_request.rb +308 -0
  33. data/lib/mx-platform-ruby/models/connect_widget_request_body.rb +218 -0
  34. data/lib/mx-platform-ruby/models/connect_widget_response_body.rb +218 -0
  35. data/lib/mx-platform-ruby/models/credential.rb +254 -0
  36. data/lib/mx-platform-ruby/models/credential_request.rb +227 -0
  37. data/lib/mx-platform-ruby/models/credentials_response_body.rb +229 -0
  38. data/lib/mx-platform-ruby/models/enhance_transaction.rb +353 -0
  39. data/lib/mx-platform-ruby/models/enhance_transactions_request.rb +264 -0
  40. data/lib/mx-platform-ruby/models/enhance_transactions_request_body.rb +220 -0
  41. data/lib/mx-platform-ruby/models/enhance_transactions_response_body.rb +220 -0
  42. data/lib/mx-platform-ruby/models/holding.rb +371 -0
  43. data/lib/mx-platform-ruby/models/holding_response_body.rb +218 -0
  44. data/lib/mx-platform-ruby/models/holdings_response_body.rb +229 -0
  45. data/lib/mx-platform-ruby/models/inline_response200.rb +218 -0
  46. data/lib/mx-platform-ruby/models/institution.rb +299 -0
  47. data/lib/mx-platform-ruby/models/institution_response_body.rb +218 -0
  48. data/lib/mx-platform-ruby/models/institutions_response_body.rb +229 -0
  49. data/lib/mx-platform-ruby/models/member.rb +317 -0
  50. data/lib/mx-platform-ruby/models/member_create_request.rb +284 -0
  51. data/lib/mx-platform-ruby/models/member_create_request_body.rb +236 -0
  52. data/lib/mx-platform-ruby/models/member_response_body.rb +218 -0
  53. data/lib/mx-platform-ruby/models/member_resume_request.rb +220 -0
  54. data/lib/mx-platform-ruby/models/member_resume_request_body.rb +218 -0
  55. data/lib/mx-platform-ruby/models/member_status.rb +292 -0
  56. data/lib/mx-platform-ruby/models/member_status_response_body.rb +218 -0
  57. data/lib/mx-platform-ruby/models/member_update_request.rb +256 -0
  58. data/lib/mx-platform-ruby/models/member_update_request_body.rb +218 -0
  59. data/lib/mx-platform-ruby/models/members_response_body.rb +229 -0
  60. data/lib/mx-platform-ruby/models/merchant.rb +263 -0
  61. data/lib/mx-platform-ruby/models/merchant_response_body.rb +218 -0
  62. data/lib/mx-platform-ruby/models/merchants_response_body.rb +229 -0
  63. data/lib/mx-platform-ruby/models/o_auth_window.rb +227 -0
  64. data/lib/mx-platform-ruby/models/o_auth_window_response_body.rb +218 -0
  65. data/lib/mx-platform-ruby/models/pagination.rb +245 -0
  66. data/lib/mx-platform-ruby/models/statement.rb +281 -0
  67. data/lib/mx-platform-ruby/models/statement_response_body.rb +218 -0
  68. data/lib/mx-platform-ruby/models/statements_response_body.rb +229 -0
  69. data/lib/mx-platform-ruby/models/tag.rb +236 -0
  70. data/lib/mx-platform-ruby/models/tag_create_request.rb +223 -0
  71. data/lib/mx-platform-ruby/models/tag_create_request_body.rb +218 -0
  72. data/lib/mx-platform-ruby/models/tag_response_body.rb +218 -0
  73. data/lib/mx-platform-ruby/models/tag_update_request.rb +223 -0
  74. data/lib/mx-platform-ruby/models/tag_update_request_body.rb +218 -0
  75. data/lib/mx-platform-ruby/models/tagging.rb +254 -0
  76. data/lib/mx-platform-ruby/models/tagging_create_request.rb +237 -0
  77. data/lib/mx-platform-ruby/models/tagging_create_request_body.rb +218 -0
  78. data/lib/mx-platform-ruby/models/tagging_response_body.rb +218 -0
  79. data/lib/mx-platform-ruby/models/tagging_update_request.rb +223 -0
  80. data/lib/mx-platform-ruby/models/tagging_update_request_body.rb +218 -0
  81. data/lib/mx-platform-ruby/models/taggings_response_body.rb +229 -0
  82. data/lib/mx-platform-ruby/models/tags_response_body.rb +229 -0
  83. data/lib/mx-platform-ruby/models/transaction.rb +533 -0
  84. data/lib/mx-platform-ruby/models/transaction_response_body.rb +218 -0
  85. data/lib/mx-platform-ruby/models/transaction_rule.rb +272 -0
  86. data/lib/mx-platform-ruby/models/transaction_rule_create_request.rb +246 -0
  87. data/lib/mx-platform-ruby/models/transaction_rule_create_request_body.rb +218 -0
  88. data/lib/mx-platform-ruby/models/transaction_rule_response_body.rb +218 -0
  89. data/lib/mx-platform-ruby/models/transaction_rule_update_request.rb +236 -0
  90. data/lib/mx-platform-ruby/models/transaction_rule_update_request_body.rb +218 -0
  91. data/lib/mx-platform-ruby/models/transaction_rules_response_body.rb +229 -0
  92. data/lib/mx-platform-ruby/models/transaction_update_request.rb +223 -0
  93. data/lib/mx-platform-ruby/models/transaction_update_request_body.rb +218 -0
  94. data/lib/mx-platform-ruby/models/transactions_response_body.rb +229 -0
  95. data/lib/mx-platform-ruby/models/user.rb +254 -0
  96. data/lib/mx-platform-ruby/models/user_create_request.rb +245 -0
  97. data/lib/mx-platform-ruby/models/user_create_request_body.rb +218 -0
  98. data/lib/mx-platform-ruby/models/user_response_body.rb +218 -0
  99. data/lib/mx-platform-ruby/models/user_update_request.rb +245 -0
  100. data/lib/mx-platform-ruby/models/user_update_request_body.rb +218 -0
  101. data/lib/mx-platform-ruby/models/users_response_body.rb +229 -0
  102. data/lib/mx-platform-ruby/models/widget.rb +236 -0
  103. data/lib/mx-platform-ruby/models/widget_request.rb +331 -0
  104. data/lib/mx-platform-ruby/models/widget_request_body.rb +218 -0
  105. data/lib/mx-platform-ruby/models/widget_response_body.rb +218 -0
  106. data/lib/mx-platform-ruby/version.rb +13 -3
  107. data/mx-platform-ruby.gemspec +34 -27
  108. data/openapi/mx_platform_ruby.yml +11 -0
  109. data/spec/api/mx_platform_api_spec.rb +979 -0
  110. data/spec/api_client_spec.rb +188 -0
  111. data/spec/configuration_spec.rb +42 -0
  112. data/spec/models/account_number_spec.rb +76 -0
  113. data/spec/models/account_numbers_response_body_spec.rb +40 -0
  114. data/spec/models/account_owner_spec.rb +100 -0
  115. data/spec/models/account_owners_response_body_spec.rb +40 -0
  116. data/spec/models/account_response_body_spec.rb +34 -0
  117. data/spec/models/account_spec.rb +268 -0
  118. data/spec/models/account_update_request_body_spec.rb +34 -0
  119. data/spec/models/account_update_request_spec.rb +34 -0
  120. data/spec/models/accounts_response_body_spec.rb +40 -0
  121. data/spec/models/categories_response_body_spec.rb +40 -0
  122. data/spec/models/category_create_request_body_spec.rb +34 -0
  123. data/spec/models/category_create_request_spec.rb +46 -0
  124. data/spec/models/category_response_body_spec.rb +34 -0
  125. data/spec/models/category_spec.rb +76 -0
  126. data/spec/models/category_update_request_body_spec.rb +34 -0
  127. data/spec/models/category_update_request_spec.rb +40 -0
  128. data/spec/models/challenge_image_options_spec.rb +46 -0
  129. data/spec/models/challenge_options_spec.rb +40 -0
  130. data/spec/models/challenge_spec.rb +70 -0
  131. data/spec/models/challenges_response_body_spec.rb +40 -0
  132. data/spec/models/connect_widget_request_body_spec.rb +34 -0
  133. data/spec/models/connect_widget_request_spec.rb +94 -0
  134. data/spec/models/connect_widget_response_body_spec.rb +34 -0
  135. data/spec/models/connect_widget_spec.rb +40 -0
  136. data/spec/models/credential_request_spec.rb +40 -0
  137. data/spec/models/credential_spec.rb +58 -0
  138. data/spec/models/credentials_response_body_spec.rb +40 -0
  139. data/spec/models/enhance_transaction_spec.rb +124 -0
  140. data/spec/models/enhance_transactions_request_body_spec.rb +34 -0
  141. data/spec/models/enhance_transactions_request_spec.rb +58 -0
  142. data/spec/models/enhance_transactions_response_body_spec.rb +34 -0
  143. data/spec/models/holding_response_body_spec.rb +34 -0
  144. data/spec/models/holding_spec.rb +136 -0
  145. data/spec/models/holdings_response_body_spec.rb +40 -0
  146. data/spec/models/inline_response200_spec.rb +34 -0
  147. data/spec/models/institution_response_body_spec.rb +34 -0
  148. data/spec/models/institution_spec.rb +88 -0
  149. data/spec/models/institutions_response_body_spec.rb +40 -0
  150. data/spec/models/member_create_request_body_spec.rb +46 -0
  151. data/spec/models/member_create_request_spec.rb +70 -0
  152. data/spec/models/member_response_body_spec.rb +34 -0
  153. data/spec/models/member_resume_request_body_spec.rb +34 -0
  154. data/spec/models/member_resume_request_spec.rb +34 -0
  155. data/spec/models/member_spec.rb +100 -0
  156. data/spec/models/member_status_response_body_spec.rb +34 -0
  157. data/spec/models/member_status_spec.rb +82 -0
  158. data/spec/models/member_update_request_body_spec.rb +34 -0
  159. data/spec/models/member_update_request_spec.rb +58 -0
  160. data/spec/models/members_response_body_spec.rb +40 -0
  161. data/spec/models/merchant_response_body_spec.rb +34 -0
  162. data/spec/models/merchant_spec.rb +64 -0
  163. data/spec/models/merchants_response_body_spec.rb +40 -0
  164. data/spec/models/o_auth_window_response_body_spec.rb +34 -0
  165. data/spec/models/o_auth_window_spec.rb +40 -0
  166. data/spec/models/pagination_spec.rb +52 -0
  167. data/spec/models/statement_response_body_spec.rb +34 -0
  168. data/spec/models/statement_spec.rb +76 -0
  169. data/spec/models/statements_response_body_spec.rb +40 -0
  170. data/spec/models/tag_create_request_body_spec.rb +34 -0
  171. data/spec/models/tag_create_request_spec.rb +34 -0
  172. data/spec/models/tag_response_body_spec.rb +34 -0
  173. data/spec/models/tag_spec.rb +46 -0
  174. data/spec/models/tag_update_request_body_spec.rb +34 -0
  175. data/spec/models/tag_update_request_spec.rb +34 -0
  176. data/spec/models/tagging_create_request_body_spec.rb +34 -0
  177. data/spec/models/tagging_create_request_spec.rb +40 -0
  178. data/spec/models/tagging_response_body_spec.rb +34 -0
  179. data/spec/models/tagging_spec.rb +58 -0
  180. data/spec/models/tagging_update_request_body_spec.rb +34 -0
  181. data/spec/models/tagging_update_request_spec.rb +34 -0
  182. data/spec/models/taggings_response_body_spec.rb +40 -0
  183. data/spec/models/tags_response_body_spec.rb +40 -0
  184. data/spec/models/transaction_response_body_spec.rb +34 -0
  185. data/spec/models/transaction_rule_create_request_body_spec.rb +34 -0
  186. data/spec/models/transaction_rule_create_request_spec.rb +46 -0
  187. data/spec/models/transaction_rule_response_body_spec.rb +34 -0
  188. data/spec/models/transaction_rule_spec.rb +70 -0
  189. data/spec/models/transaction_rule_update_request_body_spec.rb +34 -0
  190. data/spec/models/transaction_rule_update_request_spec.rb +46 -0
  191. data/spec/models/transaction_rules_response_body_spec.rb +40 -0
  192. data/spec/models/transaction_spec.rb +244 -0
  193. data/spec/models/transaction_update_request_body_spec.rb +34 -0
  194. data/spec/models/transaction_update_request_spec.rb +34 -0
  195. data/spec/models/transactions_response_body_spec.rb +40 -0
  196. data/spec/models/user_create_request_body_spec.rb +34 -0
  197. data/spec/models/user_create_request_spec.rb +52 -0
  198. data/spec/models/user_response_body_spec.rb +34 -0
  199. data/spec/models/user_spec.rb +58 -0
  200. data/spec/models/user_update_request_body_spec.rb +34 -0
  201. data/spec/models/user_update_request_spec.rb +52 -0
  202. data/spec/models/users_response_body_spec.rb +40 -0
  203. data/spec/models/widget_request_body_spec.rb +34 -0
  204. data/spec/models/widget_request_spec.rb +106 -0
  205. data/spec/models/widget_response_body_spec.rb +34 -0
  206. data/spec/models/widget_spec.rb +46 -0
  207. data/spec/spec_helper.rb +100 -13
  208. metadata +317 -144
  209. data/.github/workflows/test.yml +0 -20
  210. data/.gitignore +0 -13
  211. data/.rubocop.yml +0 -44
  212. data/lib/mx-platform-ruby/account.rb +0 -107
  213. data/lib/mx-platform-ruby/account_number.rb +0 -57
  214. data/lib/mx-platform-ruby/account_owner.rb +0 -42
  215. data/lib/mx-platform-ruby/category.rb +0 -127
  216. data/lib/mx-platform-ruby/challenge.rb +0 -37
  217. data/lib/mx-platform-ruby/client.rb +0 -59
  218. data/lib/mx-platform-ruby/connect_widget.rb +0 -43
  219. data/lib/mx-platform-ruby/credential.rb +0 -54
  220. data/lib/mx-platform-ruby/enhanced_transaction.rb +0 -44
  221. data/lib/mx-platform-ruby/error.rb +0 -6
  222. data/lib/mx-platform-ruby/holding.rb +0 -87
  223. data/lib/mx-platform-ruby/institution.rb +0 -78
  224. data/lib/mx-platform-ruby/member.rb +0 -242
  225. data/lib/mx-platform-ruby/member_status.rb +0 -35
  226. data/lib/mx-platform-ruby/merchant.rb +0 -52
  227. data/lib/mx-platform-ruby/oauth_window.rb +0 -32
  228. data/lib/mx-platform-ruby/pageable.rb +0 -29
  229. data/lib/mx-platform-ruby/statement.rb +0 -70
  230. data/lib/mx-platform-ruby/tag.rb +0 -104
  231. data/lib/mx-platform-ruby/tagging.rb +0 -107
  232. data/lib/mx-platform-ruby/transaction.rb +0 -162
  233. data/lib/mx-platform-ruby/transaction_rule.rb +0 -112
  234. data/lib/mx-platform-ruby/user.rb +0 -112
  235. data/lib/mx-platform-ruby/widget.rb +0 -49
  236. data/spec/lib/mx-platform-ruby/account_number_spec.rb +0 -100
  237. data/spec/lib/mx-platform-ruby/account_owner_spec.rb +0 -71
  238. data/spec/lib/mx-platform-ruby/account_spec.rb +0 -267
  239. data/spec/lib/mx-platform-ruby/category_spec.rb +0 -244
  240. data/spec/lib/mx-platform-ruby/challenge_spec.rb +0 -72
  241. data/spec/lib/mx-platform-ruby/client_spec.rb +0 -101
  242. data/spec/lib/mx-platform-ruby/connect_widget_spec.rb +0 -66
  243. data/spec/lib/mx-platform-ruby/credential_spec.rb +0 -90
  244. data/spec/lib/mx-platform-ruby/enhanced_transaction_spec.rb +0 -89
  245. data/spec/lib/mx-platform-ruby/holding_spec.rb +0 -178
  246. data/spec/lib/mx-platform-ruby/institution_spec.rb +0 -141
  247. data/spec/lib/mx-platform-ruby/member_spec.rb +0 -557
  248. data/spec/lib/mx-platform-ruby/member_status_spec.rb +0 -76
  249. data/spec/lib/mx-platform-ruby/merchant_spec.rb +0 -89
  250. data/spec/lib/mx-platform-ruby/oauth_window_spec.rb +0 -47
  251. data/spec/lib/mx-platform-ruby/pageable_spec.rb +0 -75
  252. data/spec/lib/mx-platform-ruby/statement_spec.rb +0 -130
  253. data/spec/lib/mx-platform-ruby/tag_spec.rb +0 -179
  254. data/spec/lib/mx-platform-ruby/tagging_spec.rb +0 -191
  255. data/spec/lib/mx-platform-ruby/transaction_rule_spec.rb +0 -207
  256. data/spec/lib/mx-platform-ruby/transaction_spec.rb +0 -449
  257. data/spec/lib/mx-platform-ruby/user_spec.rb +0 -196
  258. data/spec/lib/mx-platform-ruby/widget_spec.rb +0 -76
  259. data/spec/lib/mx-platform-ruby_spec.rb +0 -15
  260. data/spec/sample.pdf +0 -0
@@ -1,72 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe ::MXPlatformRuby::Challenge do
6
- let(:challenge_attributes) do
7
- {
8
- field_name: 'Who is this guy?',
9
- guid: 'CRD-ce76d2e3-86bd-ec4a-ec52-eb53b5194bf5',
10
- image_data: 'Who is this guy?',
11
- image_options: [
12
- {
13
- data_uri: 'data:image/png;base64,iVBORw0KGgoAAAANSUh ... more image data ...',
14
- label: 'IMAGE_1',
15
- value: 'image_data'
16
- }
17
- ],
18
- label: 'Who is this guy?',
19
- options: [
20
- {
21
- label: 'IMAGE_1',
22
- value: 'image_data'
23
- }
24
- ],
25
- type: 'IMAGE_DATA'
26
- }
27
- end
28
- let(:list_member_challenges_options) do
29
- {
30
- member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
31
- page: 1,
32
- records_per_page: 10,
33
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
34
- }
35
- end
36
- let(:pagination_attributes) do
37
- {
38
- 'current_page' => 1,
39
- 'per_page' => 25,
40
- 'total_pages' => 1,
41
- 'total_entries' => 1
42
- }
43
- end
44
-
45
- context 'list_member_challenges endpoints' do
46
- let(:list_member_challenges_response) do
47
- {
48
- 'challenges' => [challenge_attributes],
49
- 'pagination' => pagination_attributes
50
- }
51
- end
52
-
53
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_member_challenges_response) }
54
-
55
- describe 'list_member_challenges' do
56
- it 'returns a list of challenges' do
57
- response = described_class.list_member_challenges
58
-
59
- expect(response).to be_kind_of(::MXPlatformRuby::Page)
60
- expect(response.first).to be_kind_of(::MXPlatformRuby::Challenge)
61
- expect(response.first.field_name).to eq(challenge_attributes[:field_name])
62
- expect(response.first.guid).to eq(challenge_attributes[:guid])
63
- expect(response.first.image_data).to eq(challenge_attributes[:image_data])
64
- expect(response.first.image_options).to eq(challenge_attributes[:image_options])
65
- expect(response.first.label).to eq(challenge_attributes[:label])
66
- expect(response.first.options).to eq(challenge_attributes[:options])
67
- expect(response.first.type).to eq(challenge_attributes[:type])
68
- expect(response.length).to eq(1)
69
- end
70
- end
71
- end
72
- end
@@ -1,101 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe ::MXPlatformRuby::Client do
6
- let(:client_custom_params) { described_class.new('base_url', 'password', 'username') }
7
- let(:client_default_params) { described_class.new }
8
- let(:error_response) { ::OpenStruct.new('status' => 500, 'body' => 'error_message') }
9
- let(:file_response) { ::OpenStruct.new('status' => 200, 'body' => sample_pdf_binary) }
10
- let(:ok_response) { ::OpenStruct.new('status' => 200, 'body' => '{ "key": "value" }') }
11
- let(:sample_pdf) { ::File.open('spec/sample.pdf') }
12
- let(:sample_pdf_binary) { ::IO.binread(sample_pdf) }
13
-
14
- describe '#http_client' do
15
- it 'returns a HTTPClient' do
16
- expect(client_custom_params.http_client).to be_a(::HTTPClient)
17
- end
18
- end
19
-
20
- describe '#initialize' do
21
- context 'with default params' do
22
- it 'sets password to param default' do
23
- expect(client_default_params.password).to eq(nil)
24
- end
25
-
26
- it 'sets username to param default' do
27
- expect(client_default_params.username).to eq(nil)
28
- end
29
-
30
- it 'sets base_url to param default' do
31
- expect(client_default_params.base_url).to eq('https://int-api.mx.com')
32
- end
33
- end
34
-
35
- context 'with params' do
36
- it 'sets password to param' do
37
- expect(client_custom_params.password).to eq('password')
38
- end
39
-
40
- it 'sets username to param' do
41
- expect(client_custom_params.username).to eq('username')
42
- end
43
-
44
- it 'sets base_url to param' do
45
- expect(client_custom_params.base_url).to eq('base_url')
46
- end
47
- end
48
- end
49
-
50
- describe '#make_request' do
51
- before do
52
- allow(client_custom_params.http_client).to receive(:get).and_return(ok_response)
53
- end
54
-
55
- it 'builds the request url' do
56
- expect(client_custom_params.http_client).to receive(:get).with('base_url/endpoint', any_args)
57
- client_custom_params.make_request({ http_method: :get, endpoint: '/endpoint' })
58
- end
59
-
60
- it 'sends authentication headers' do
61
- expect(client_custom_params.http_client).to receive(:get).with(
62
- anything,
63
- anything,
64
- hash_including(Authorization: 'Basic dXNlcm5hbWU6cGFzc3dvcmQ=')
65
- )
66
- client_custom_params.make_request({ http_method: :get, endpoint: '/endpoint' })
67
- end
68
-
69
- it 'sends the body as json' do
70
- expect(client_custom_params.http_client).to receive(:get).with(anything, '{"key":"value"}', any_args)
71
- client_custom_params.make_request({ http_method: :get, endpoint: '/endpoint', request_body: { key: :value } })
72
- end
73
-
74
- context 'when the response is json' do
75
- it 'parses the json response' do
76
- allow(client_custom_params.http_client).to receive(:get).and_return(ok_response)
77
- parsed_response = client_custom_params.make_request({ http_method: :get, endpoint: '/endpoint', request_body: { key: :value } })
78
- expect(parsed_response['key']).to eq('value')
79
- end
80
- end
81
-
82
- context 'when the response is not json' do
83
- it 'formats the response as a ::TempFile' do
84
- allow(client_custom_params.http_client).to receive(:get).and_return(file_response)
85
- temp_file = client_custom_params.make_request({ http_method: :get, endpoint: '/endpoint', request_body: { key: :value } })
86
-
87
- expect(temp_file).to be_kind_of(::Tempfile)
88
- expect(::IO.read(temp_file)).to eq(::IO.read(sample_pdf))
89
- end
90
- end
91
-
92
- context 'with error' do
93
- it 'raises a ::MXPlatformRuby::Error' do
94
- allow(client_custom_params.http_client).to receive(:get).and_return(error_response)
95
- expect { client_custom_params.make_request({ http_method: :get, endpoint: '/endpoint', request_body: { key: :value } }) }.to raise_error(
96
- ::MXPlatformRuby::Error
97
- )
98
- end
99
- end
100
- end
101
- end
@@ -1,66 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe ::MXPlatformRuby::ConnectWidget do
6
- let(:connect_widget_attributes) do
7
- {
8
- connect_widget_url: 'https://int-widgets.moneydesktop.com/md/connect/jb1rA14m85tw2lyvpgfx4gc6d3Z8z8Ayb8',
9
- guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
10
- }
11
- end
12
- let(:request_connect_widget_url_options) do
13
- {
14
- color_scheme: 'light',
15
- current_institution_code: 'chase',
16
- current_member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
17
- disable_institution_search: false,
18
- include_transactions: true,
19
- is_mobile_webview: true,
20
- mode: 'aggregation',
21
- ui_message_version: 4,
22
- ui_message_webview_url_scheme: 'mx',
23
- update_credentials: false,
24
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54',
25
- wait_for_full_aggregation: false
26
- }
27
- end
28
-
29
- describe 'request_connect_widget_url' do
30
- let(:request_connect_widget_url_response) { { 'user' => connect_widget_attributes } }
31
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(request_connect_widget_url_response) }
32
-
33
- it 'returns connect_widget' do
34
- response = described_class.request_connect_widget_url
35
-
36
- expect(response).to be_kind_of(::MXPlatformRuby::ConnectWidget)
37
- expect(response.connect_widget_url).to eq(connect_widget_attributes[:connect_widget_url])
38
- expect(response.guid).to eq(connect_widget_attributes[:guid])
39
- end
40
-
41
- it 'makes a client request with the expected params' do
42
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
43
- {
44
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/connect_widget_url',
45
- http_method: :post,
46
- request_body: {
47
- config: {
48
- color_scheme: 'light',
49
- current_institution_code: 'chase',
50
- current_member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
51
- disable_institution_search: false,
52
- include_transactions: true,
53
- is_mobile_webview: true,
54
- mode: 'aggregation',
55
- ui_message_version: 4,
56
- ui_message_webview_url_scheme: 'mx',
57
- update_credentials: false,
58
- wait_for_full_aggregation: false
59
- }
60
- }
61
- }
62
- )
63
- described_class.request_connect_widget_url(request_connect_widget_url_options)
64
- end
65
- end
66
- end
@@ -1,90 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe ::MXPlatformRuby::Credential do
6
- let(:credential_attributes) do
7
- {
8
- display_order: 1,
9
- field_name: 'LOGIN',
10
- field_type: 'TEXT',
11
- guid: 'CRD-1ec152cd-e628-e81a-e852-d1e7104624da',
12
- label: 'Username'
13
- }
14
- end
15
- let(:list_institution_required_credentials_options) do
16
- {
17
- institution_code: 'chase',
18
- page: 1,
19
- records_per_page: 10
20
- }
21
- end
22
- let(:list_member_credentials_options) do
23
- {
24
- member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
25
- page: 1,
26
- records_per_page: 10,
27
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
28
- }
29
- end
30
- let(:pagination_attributes) do
31
- {
32
- 'current_page' => 1,
33
- 'per_page' => 25,
34
- 'total_pages' => 1,
35
- 'total_entries' => 1
36
- }
37
- end
38
-
39
- context 'list_institution_required_credentials endpoints' do
40
- let(:list_institution_required_credentials_response) do
41
- {
42
- 'credentials' => [credential_attributes],
43
- 'pagination' => pagination_attributes
44
- }
45
- end
46
-
47
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_institution_required_credentials_response) }
48
-
49
- describe 'list_institution_required_credentials' do
50
- it 'returns a list of credentials' do
51
- response = described_class.list_institution_required_credentials
52
-
53
- expect(response).to be_kind_of(::MXPlatformRuby::Page)
54
- expect(response.first).to be_kind_of(::MXPlatformRuby::Credential)
55
- expect(response.first.display_order).to eq(credential_attributes[:display_order])
56
- expect(response.first.field_name).to eq(credential_attributes[:field_name])
57
- expect(response.first.field_type).to eq(credential_attributes[:field_type])
58
- expect(response.first.guid).to eq(credential_attributes[:guid])
59
- expect(response.first.label).to eq(credential_attributes[:label])
60
- expect(response.length).to eq(1)
61
- end
62
- end
63
- end
64
-
65
- context 'list_member_credentials endpoints' do
66
- let(:list_member_credentials_response) do
67
- {
68
- 'credentials' => [credential_attributes],
69
- 'pagination' => pagination_attributes
70
- }
71
- end
72
-
73
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_member_credentials_response) }
74
-
75
- describe 'list_member_credentials' do
76
- it 'returns a list of credentials' do
77
- response = described_class.list_member_credentials
78
-
79
- expect(response).to be_kind_of(::MXPlatformRuby::Page)
80
- expect(response.first).to be_kind_of(::MXPlatformRuby::Credential)
81
- expect(response.first.display_order).to eq(credential_attributes[:display_order])
82
- expect(response.first.field_name).to eq(credential_attributes[:field_name])
83
- expect(response.first.field_type).to eq(credential_attributes[:field_type])
84
- expect(response.first.guid).to eq(credential_attributes[:guid])
85
- expect(response.first.label).to eq(credential_attributes[:label])
86
- expect(response.length).to eq(1)
87
- end
88
- end
89
- end
90
- end
@@ -1,89 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe ::MXPlatformRuby::EnhancedTransaction do
6
- let(:enhanced_transaction_attributes) do
7
- {
8
- amount: 21.33,
9
- category: 'Fast Food',
10
- description: 'IN-N-OUT BURGER',
11
- id: 'ID-123',
12
- is_bill_pay: false,
13
- is_direct_deposit: false,
14
- is_expense: false,
15
- is_fee: false,
16
- is_income: false,
17
- is_international: false,
18
- is_overdraft_fee: false,
19
- is_payroll_advance: false,
20
- merchant_category_code: 5411,
21
- merchant_guid: 'MCH-7ed79542-884d-2b1b-dd74-501c5cc9d25b',
22
- original_description: 'IN-N-OUT BURGER',
23
- type: 'DEBIT'
24
- }
25
- end
26
- let(:enhance_transactions_options) do
27
- {
28
- transactions: [
29
- {
30
- amount: 21.33,
31
- description: 'IN-N-OUT BURGER',
32
- id: 'ID-123',
33
- merchant_category_code: 123,
34
- type: 'DEBIT'
35
- }
36
- ]
37
- }
38
- end
39
-
40
- describe 'enhance_transactions' do
41
- let(:enhance_transactions_response) { { 'transactions' => [enhanced_transaction_attributes] } }
42
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(enhance_transactions_response) }
43
-
44
- it 'returns an array of enhanced_transactions' do
45
- response = described_class.enhance_transactions
46
-
47
- expect(response).to be_kind_of(::Array)
48
- expect(response.first).to be_kind_of(::MXPlatformRuby::EnhancedTransaction)
49
- expect(response.first.amount).to eq(enhanced_transaction_attributes[:amount])
50
- expect(response.first.category).to eq(enhanced_transaction_attributes[:category])
51
- expect(response.first.description).to eq(enhanced_transaction_attributes[:description])
52
- expect(response.first.id).to eq(enhanced_transaction_attributes[:id])
53
- expect(response.first.is_bill_pay).to eq(enhanced_transaction_attributes[:is_bill_pay])
54
- expect(response.first.is_direct_deposit).to eq(enhanced_transaction_attributes[:is_direct_deposit])
55
- expect(response.first.is_expense).to eq(enhanced_transaction_attributes[:is_expense])
56
- expect(response.first.is_fee).to eq(enhanced_transaction_attributes[:is_fee])
57
- expect(response.first.is_income).to eq(enhanced_transaction_attributes[:is_income])
58
- expect(response.first.is_international).to eq(enhanced_transaction_attributes[:is_international])
59
- expect(response.first.is_overdraft_fee).to eq(enhanced_transaction_attributes[:is_overdraft_fee])
60
- expect(response.first.is_payroll_advance).to eq(enhanced_transaction_attributes[:is_payroll_advance])
61
- expect(response.first.merchant_category_code).to eq(enhanced_transaction_attributes[:merchant_category_code])
62
- expect(response.first.merchant_guid).to eq(enhanced_transaction_attributes[:merchant_guid])
63
- expect(response.first.original_description).to eq(enhanced_transaction_attributes[:original_description])
64
- expect(response.first.type).to eq(enhanced_transaction_attributes[:type])
65
- expect(response.length).to eq(1)
66
- end
67
-
68
- it 'makes a client request with the expected params' do
69
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
70
- {
71
- endpoint: '/transactions/enhance',
72
- http_method: :post,
73
- request_body: {
74
- transactions: [
75
- {
76
- amount: 21.33,
77
- description: 'IN-N-OUT BURGER',
78
- id: 'ID-123',
79
- merchant_category_code: 123,
80
- type: 'DEBIT'
81
- }
82
- ]
83
- }
84
- }
85
- )
86
- described_class.enhance_transactions(enhance_transactions_options)
87
- end
88
- end
89
- end
@@ -1,178 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe ::MXPlatformRuby::Holding do
6
- let(:holding_attributes) do
7
- {
8
- account_guid: 'HOL-d65683e8-9eab-26bb-bcfd-ced159c9abe2',
9
- cost_basis: 827.0,
10
- created_at: '2015-04-13T18:01:23.000Z',
11
- currency_code: 'USD',
12
- cusip: '18383M878',
13
- daily_change: 2.5,
14
- description: 'Guggenheim Defensive Equity ETF',
15
- guid: 'HOL-d65683e8-9eab-26bb-bcfd-ced159c9abe2',
16
- holding_type: 'MONEY_MARKET',
17
- id: 'ID-123',
18
- market_value: 989.5,
19
- member_guid: 'MBR-d65683e8-9eab-26bb-bcfd-ced159c9abe',
20
- metadata: 'metadata',
21
- purchase_price: 26.3,
22
- shares: 6.0,
23
- symbol: 'DEF',
24
- updated_at: '2015-04-13T18:01:23.000Z',
25
- user_guid: 'USR-743e5d7f-1116-28fa-5de1-d3ba02e41d8d'
26
- }
27
- end
28
- let(:list_holdings_by_member_options) do
29
- {
30
- from_date: '2015-09-20',
31
- member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
32
- page: 1,
33
- records_per_page: 10,
34
- to_date: '2019-10-20',
35
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
36
- }
37
- end
38
- let(:list_holdings_by_user_options) do
39
- {
40
- from_date: '2015-09-20',
41
- page: 1,
42
- records_per_page: 10,
43
- to_date: '2019-10-20',
44
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
45
- }
46
- end
47
- let(:read_holding_options) do
48
- {
49
- holding_guid: 'HOL-d65683e8-9eab-26bb-bcfd-ced159c9abe2',
50
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
51
- }
52
- end
53
- let(:pagination_attributes) do
54
- {
55
- 'current_page' => 1,
56
- 'per_page' => 25,
57
- 'total_pages' => 1,
58
- 'total_entries' => 1
59
- }
60
- end
61
-
62
- context 'list_holdings_by_member endpoints' do
63
- let(:list_holdings_by_member_response) do
64
- {
65
- 'holdings' => [holding_attributes],
66
- 'pagination' => pagination_attributes
67
- }
68
- end
69
-
70
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_holdings_by_member_response) }
71
-
72
- describe 'list_holdings_by_member' do
73
- it 'returns a list of holdings' do
74
- response = described_class.list_holdings_by_member
75
-
76
- expect(response).to be_kind_of(::MXPlatformRuby::Page)
77
- expect(response.first).to be_kind_of(::MXPlatformRuby::Holding)
78
- expect(response.first.account_guid).to eq(holding_attributes[:account_guid])
79
- expect(response.first.cost_basis).to eq(holding_attributes[:cost_basis])
80
- expect(response.first.created_at).to eq(holding_attributes[:created_at])
81
- expect(response.first.currency_code).to eq(holding_attributes[:currency_code])
82
- expect(response.first.cusip).to eq(holding_attributes[:cusip])
83
- expect(response.first.daily_change).to eq(holding_attributes[:daily_change])
84
- expect(response.first.description).to eq(holding_attributes[:description])
85
- expect(response.first.guid).to eq(holding_attributes[:guid])
86
- expect(response.first.holding_type).to eq(holding_attributes[:holding_type])
87
- expect(response.first.id).to eq(holding_attributes[:id])
88
- expect(response.first.market_value).to eq(holding_attributes[:market_value])
89
- expect(response.first.member_guid).to eq(holding_attributes[:member_guid])
90
- expect(response.first.metadata).to eq(holding_attributes[:metadata])
91
- expect(response.first.purchase_price).to eq(holding_attributes[:purchase_price])
92
- expect(response.first.shares).to eq(holding_attributes[:shares])
93
- expect(response.first.symbol).to eq(holding_attributes[:symbol])
94
- expect(response.first.updated_at).to eq(holding_attributes[:updated_at])
95
- expect(response.first.user_guid).to eq(holding_attributes[:user_guid])
96
- expect(response.length).to eq(1)
97
- end
98
- end
99
- end
100
-
101
- context 'list_holdings_by_user endpoints' do
102
- let(:list_holdings_by_user_response) do
103
- {
104
- 'holdings' => [holding_attributes],
105
- 'pagination' => pagination_attributes
106
- }
107
- end
108
-
109
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_holdings_by_user_response) }
110
-
111
- describe 'list_holdings_by_user' do
112
- it 'returns a list of holdings' do
113
- response = described_class.list_holdings_by_user
114
-
115
- expect(response).to be_kind_of(::MXPlatformRuby::Page)
116
- expect(response.first).to be_kind_of(::MXPlatformRuby::Holding)
117
- expect(response.first.account_guid).to eq(holding_attributes[:account_guid])
118
- expect(response.first.cost_basis).to eq(holding_attributes[:cost_basis])
119
- expect(response.first.created_at).to eq(holding_attributes[:created_at])
120
- expect(response.first.currency_code).to eq(holding_attributes[:currency_code])
121
- expect(response.first.cusip).to eq(holding_attributes[:cusip])
122
- expect(response.first.daily_change).to eq(holding_attributes[:daily_change])
123
- expect(response.first.description).to eq(holding_attributes[:description])
124
- expect(response.first.guid).to eq(holding_attributes[:guid])
125
- expect(response.first.holding_type).to eq(holding_attributes[:holding_type])
126
- expect(response.first.id).to eq(holding_attributes[:id])
127
- expect(response.first.market_value).to eq(holding_attributes[:market_value])
128
- expect(response.first.member_guid).to eq(holding_attributes[:member_guid])
129
- expect(response.first.metadata).to eq(holding_attributes[:metadata])
130
- expect(response.first.purchase_price).to eq(holding_attributes[:purchase_price])
131
- expect(response.first.shares).to eq(holding_attributes[:shares])
132
- expect(response.first.symbol).to eq(holding_attributes[:symbol])
133
- expect(response.first.updated_at).to eq(holding_attributes[:updated_at])
134
- expect(response.first.user_guid).to eq(holding_attributes[:user_guid])
135
- expect(response.length).to eq(1)
136
- end
137
- end
138
- end
139
-
140
- describe 'read_holding' do
141
- let(:read_holding_response) { { 'holding' => holding_attributes } }
142
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(read_holding_response) }
143
-
144
- it 'returns holding' do
145
- response = described_class.read_holding
146
-
147
- expect(response).to be_kind_of(::MXPlatformRuby::Holding)
148
- expect(response.account_guid).to eq(holding_attributes[:account_guid])
149
- expect(response.cost_basis).to eq(holding_attributes[:cost_basis])
150
- expect(response.created_at).to eq(holding_attributes[:created_at])
151
- expect(response.currency_code).to eq(holding_attributes[:currency_code])
152
- expect(response.cusip).to eq(holding_attributes[:cusip])
153
- expect(response.daily_change).to eq(holding_attributes[:daily_change])
154
- expect(response.description).to eq(holding_attributes[:description])
155
- expect(response.guid).to eq(holding_attributes[:guid])
156
- expect(response.holding_type).to eq(holding_attributes[:holding_type])
157
- expect(response.id).to eq(holding_attributes[:id])
158
- expect(response.market_value).to eq(holding_attributes[:market_value])
159
- expect(response.member_guid).to eq(holding_attributes[:member_guid])
160
- expect(response.metadata).to eq(holding_attributes[:metadata])
161
- expect(response.purchase_price).to eq(holding_attributes[:purchase_price])
162
- expect(response.shares).to eq(holding_attributes[:shares])
163
- expect(response.symbol).to eq(holding_attributes[:symbol])
164
- expect(response.updated_at).to eq(holding_attributes[:updated_at])
165
- expect(response.user_guid).to eq(holding_attributes[:user_guid])
166
- end
167
-
168
- it 'makes a client request with the expected params' do
169
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
170
- {
171
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/holdings/HOL-d65683e8-9eab-26bb-bcfd-ced159c9abe2',
172
- http_method: :get
173
- }
174
- )
175
- described_class.read_holding(read_holding_options)
176
- end
177
- end
178
- end