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,267 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe ::MXPlatformRuby::Account do
6
- let(:account_attributes) do
7
- {
8
- account_number: '5366',
9
- apr: 1.0,
10
- apy: 1.0,
11
- available_balance: 1000.0,
12
- available_credit: 1000.0,
13
- balance: 1000.0,
14
- cash_balance: 1000.0,
15
- cash_surrender_value: 1000.0,
16
- created_at: '2016-10-13T17:57:37.000Z',
17
- credit_limit: 100.0,
18
- currency_code: 'USD',
19
- day_payment_is_due: 20,
20
- death_benefit: 1000,
21
- guid: 'ACT-06d7f44b-caae-0f6e-1384-01f52e75dcb1',
22
- holdings_value: 1000.0,
23
- id: '1040434698',
24
- institution_code: 'chase',
25
- insured_name: 'Frodo Baggins',
26
- interest_rate: 1.0,
27
- is_closed: false,
28
- is_hidden: false,
29
- last_payment: 100.0,
30
- last_payment_at: '2015-10-13T17:57:37.000Z',
31
- loan_amount: 1000.0,
32
- matures_on: '2015-10-13T17:57:37.000Z',
33
- member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
34
- minimum_balance: 100.0,
35
- minimum_payment: 10.0,
36
- name: 'Test account 2',
37
- original_balance: 10.0,
38
- pay_out_amount: 10.0,
39
- payment_due_at: '2015-10-13T17:57:37.000Z',
40
- payoff_balance: 10.0,
41
- premium_amount: 1.0,
42
- started_on: '2015-10-13T17:57:37.000Z',
43
- subtype: 'NONE',
44
- total_account_value: 1.0,
45
- type: 'SAVINGS',
46
- updated_at: '2016-10-13T18:08:00.000Z',
47
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
48
- }
49
- end
50
- let(:list_user_accounts_options) do
51
- {
52
- page: 1,
53
- records_per_page: 10,
54
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
55
- }
56
- end
57
- let(:read_account_options) do
58
- {
59
- account_guid: 'ACT-06d7f44b-caae-0f6e-1384-01f52e75dcb1',
60
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
61
- }
62
- end
63
- let(:update_account_options) do
64
- {
65
- account_guid: 'ACT-06d7f44b-caae-0f6e-1384-01f52e75dcb1',
66
- is_hidden: false,
67
- member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
68
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
69
- }
70
- end
71
- let(:pagination_attributes) do
72
- {
73
- 'current_page' => 1,
74
- 'per_page' => 25,
75
- 'total_pages' => 1,
76
- 'total_entries' => 1
77
- }
78
- end
79
-
80
- context 'list_user_accounts endpoints' do
81
- let(:list_user_accounts_response) do
82
- {
83
- 'accounts' => [account_attributes],
84
- 'pagination' => pagination_attributes
85
- }
86
- end
87
-
88
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_user_accounts_response) }
89
-
90
- describe 'list_user_accounts' do
91
- it 'returns a list of accounts' do
92
- response = described_class.list_user_accounts
93
-
94
- expect(response).to be_kind_of(::MXPlatformRuby::Page)
95
- expect(response.first).to be_kind_of(::MXPlatformRuby::Account)
96
- expect(response.first.account_number).to eq(account_attributes[:account_number])
97
- expect(response.first.apr).to eq(account_attributes[:apr])
98
- expect(response.first.apy).to eq(account_attributes[:apy])
99
- expect(response.first.available_balance).to eq(account_attributes[:available_balance])
100
- expect(response.first.available_credit).to eq(account_attributes[:available_credit])
101
- expect(response.first.balance).to eq(account_attributes[:balance])
102
- expect(response.first.cash_balance).to eq(account_attributes[:cash_balance])
103
- expect(response.first.cash_surrender_value).to eq(account_attributes[:cash_surrender_value])
104
- expect(response.first.created_at).to eq(account_attributes[:created_at])
105
- expect(response.first.credit_limit).to eq(account_attributes[:credit_limit])
106
- expect(response.first.currency_code).to eq(account_attributes[:currency_code])
107
- expect(response.first.day_payment_is_due).to eq(account_attributes[:day_payment_is_due])
108
- expect(response.first.death_benefit).to eq(account_attributes[:death_benefit])
109
- expect(response.first.guid).to eq(account_attributes[:guid])
110
- expect(response.first.holdings_value).to eq(account_attributes[:holdings_value])
111
- expect(response.first.id).to eq(account_attributes[:id])
112
- expect(response.first.institution_code).to eq(account_attributes[:institution_code])
113
- expect(response.first.insured_name).to eq(account_attributes[:insured_name])
114
- expect(response.first.interest_rate).to eq(account_attributes[:interest_rate])
115
- expect(response.first.is_closed).to eq(account_attributes[:is_closed])
116
- expect(response.first.is_hidden).to eq(account_attributes[:is_hidden])
117
- expect(response.first.last_payment).to eq(account_attributes[:last_payment])
118
- expect(response.first.last_payment_at).to eq(account_attributes[:last_payment_at])
119
- expect(response.first.loan_amount).to eq(account_attributes[:loan_amount])
120
- expect(response.first.matures_on).to eq(account_attributes[:matures_on])
121
- expect(response.first.member_guid).to eq(account_attributes[:member_guid])
122
- expect(response.first.minimum_balance).to eq(account_attributes[:minimum_balance])
123
- expect(response.first.minimum_payment).to eq(account_attributes[:minimum_payment])
124
- expect(response.first.name).to eq(account_attributes[:name])
125
- expect(response.first.original_balance).to eq(account_attributes[:original_balance])
126
- expect(response.first.pay_out_amount).to eq(account_attributes[:pay_out_amount])
127
- expect(response.first.payment_due_at).to eq(account_attributes[:payment_due_at])
128
- expect(response.first.payoff_balance).to eq(account_attributes[:payoff_balance])
129
- expect(response.first.premium_amount).to eq(account_attributes[:premium_amount])
130
- expect(response.first.started_on).to eq(account_attributes[:started_on])
131
- expect(response.first.subtype).to eq(account_attributes[:subtype])
132
- expect(response.first.total_account_value).to eq(account_attributes[:total_account_value])
133
- expect(response.first.type).to eq(account_attributes[:type])
134
- expect(response.first.updated_at).to eq(account_attributes[:updated_at])
135
- expect(response.first.user_guid).to eq(account_attributes[:user_guid])
136
- expect(response.length).to eq(1)
137
- end
138
- end
139
- end
140
-
141
- describe 'read_account' do
142
- let(:read_account_response) { { 'account' => account_attributes } }
143
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(read_account_response) }
144
-
145
- it 'returns account' do
146
- response = described_class.read_account
147
-
148
- expect(response).to be_kind_of(::MXPlatformRuby::Account)
149
- expect(response.account_number).to eq(account_attributes[:account_number])
150
- expect(response.apr).to eq(account_attributes[:apr])
151
- expect(response.apy).to eq(account_attributes[:apy])
152
- expect(response.available_balance).to eq(account_attributes[:available_balance])
153
- expect(response.available_credit).to eq(account_attributes[:available_credit])
154
- expect(response.balance).to eq(account_attributes[:balance])
155
- expect(response.cash_balance).to eq(account_attributes[:cash_balance])
156
- expect(response.cash_surrender_value).to eq(account_attributes[:cash_surrender_value])
157
- expect(response.created_at).to eq(account_attributes[:created_at])
158
- expect(response.credit_limit).to eq(account_attributes[:credit_limit])
159
- expect(response.currency_code).to eq(account_attributes[:currency_code])
160
- expect(response.day_payment_is_due).to eq(account_attributes[:day_payment_is_due])
161
- expect(response.death_benefit).to eq(account_attributes[:death_benefit])
162
- expect(response.guid).to eq(account_attributes[:guid])
163
- expect(response.holdings_value).to eq(account_attributes[:holdings_value])
164
- expect(response.id).to eq(account_attributes[:id])
165
- expect(response.institution_code).to eq(account_attributes[:institution_code])
166
- expect(response.insured_name).to eq(account_attributes[:insured_name])
167
- expect(response.interest_rate).to eq(account_attributes[:interest_rate])
168
- expect(response.is_closed).to eq(account_attributes[:is_closed])
169
- expect(response.is_hidden).to eq(account_attributes[:is_hidden])
170
- expect(response.last_payment).to eq(account_attributes[:last_payment])
171
- expect(response.last_payment_at).to eq(account_attributes[:last_payment_at])
172
- expect(response.loan_amount).to eq(account_attributes[:loan_amount])
173
- expect(response.matures_on).to eq(account_attributes[:matures_on])
174
- expect(response.member_guid).to eq(account_attributes[:member_guid])
175
- expect(response.minimum_balance).to eq(account_attributes[:minimum_balance])
176
- expect(response.minimum_payment).to eq(account_attributes[:minimum_payment])
177
- expect(response.name).to eq(account_attributes[:name])
178
- expect(response.original_balance).to eq(account_attributes[:original_balance])
179
- expect(response.pay_out_amount).to eq(account_attributes[:pay_out_amount])
180
- expect(response.payment_due_at).to eq(account_attributes[:payment_due_at])
181
- expect(response.payoff_balance).to eq(account_attributes[:payoff_balance])
182
- expect(response.premium_amount).to eq(account_attributes[:premium_amount])
183
- expect(response.started_on).to eq(account_attributes[:started_on])
184
- expect(response.subtype).to eq(account_attributes[:subtype])
185
- expect(response.total_account_value).to eq(account_attributes[:total_account_value])
186
- expect(response.type).to eq(account_attributes[:type])
187
- expect(response.updated_at).to eq(account_attributes[:updated_at])
188
- expect(response.user_guid).to eq(account_attributes[:user_guid])
189
- end
190
-
191
- it 'makes a client request with the expected params' do
192
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
193
- {
194
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/accounts/ACT-06d7f44b-caae-0f6e-1384-01f52e75dcb1',
195
- http_method: :get
196
- }
197
- )
198
- described_class.read_account(read_account_options)
199
- end
200
- end
201
-
202
- describe 'update_account' do
203
- let(:update_account_response) { { 'account' => account_attributes } }
204
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(update_account_response) }
205
-
206
- it 'returns account' do
207
- response = described_class.update_account
208
-
209
- expect(response).to be_kind_of(::MXPlatformRuby::Account)
210
- expect(response.account_number).to eq(account_attributes[:account_number])
211
- expect(response.apr).to eq(account_attributes[:apr])
212
- expect(response.apy).to eq(account_attributes[:apy])
213
- expect(response.available_balance).to eq(account_attributes[:available_balance])
214
- expect(response.available_credit).to eq(account_attributes[:available_credit])
215
- expect(response.balance).to eq(account_attributes[:balance])
216
- expect(response.cash_balance).to eq(account_attributes[:cash_balance])
217
- expect(response.cash_surrender_value).to eq(account_attributes[:cash_surrender_value])
218
- expect(response.created_at).to eq(account_attributes[:created_at])
219
- expect(response.credit_limit).to eq(account_attributes[:credit_limit])
220
- expect(response.currency_code).to eq(account_attributes[:currency_code])
221
- expect(response.day_payment_is_due).to eq(account_attributes[:day_payment_is_due])
222
- expect(response.death_benefit).to eq(account_attributes[:death_benefit])
223
- expect(response.guid).to eq(account_attributes[:guid])
224
- expect(response.holdings_value).to eq(account_attributes[:holdings_value])
225
- expect(response.id).to eq(account_attributes[:id])
226
- expect(response.institution_code).to eq(account_attributes[:institution_code])
227
- expect(response.insured_name).to eq(account_attributes[:insured_name])
228
- expect(response.interest_rate).to eq(account_attributes[:interest_rate])
229
- expect(response.is_closed).to eq(account_attributes[:is_closed])
230
- expect(response.is_hidden).to eq(account_attributes[:is_hidden])
231
- expect(response.last_payment).to eq(account_attributes[:last_payment])
232
- expect(response.last_payment_at).to eq(account_attributes[:last_payment_at])
233
- expect(response.loan_amount).to eq(account_attributes[:loan_amount])
234
- expect(response.matures_on).to eq(account_attributes[:matures_on])
235
- expect(response.member_guid).to eq(account_attributes[:member_guid])
236
- expect(response.minimum_balance).to eq(account_attributes[:minimum_balance])
237
- expect(response.minimum_payment).to eq(account_attributes[:minimum_payment])
238
- expect(response.name).to eq(account_attributes[:name])
239
- expect(response.original_balance).to eq(account_attributes[:original_balance])
240
- expect(response.pay_out_amount).to eq(account_attributes[:pay_out_amount])
241
- expect(response.payment_due_at).to eq(account_attributes[:payment_due_at])
242
- expect(response.payoff_balance).to eq(account_attributes[:payoff_balance])
243
- expect(response.premium_amount).to eq(account_attributes[:premium_amount])
244
- expect(response.started_on).to eq(account_attributes[:started_on])
245
- expect(response.subtype).to eq(account_attributes[:subtype])
246
- expect(response.total_account_value).to eq(account_attributes[:total_account_value])
247
- expect(response.type).to eq(account_attributes[:type])
248
- expect(response.updated_at).to eq(account_attributes[:updated_at])
249
- expect(response.user_guid).to eq(account_attributes[:user_guid])
250
- end
251
-
252
- it 'makes a client request with the expected params' do
253
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
254
- {
255
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/members/MBR-7c6f361b-e582-15b6-60c0-358f12466b4b/accounts/ACT-06d7f44b-caae-0f6e-1384-01f52e75dcb1',
256
- http_method: :put,
257
- request_body: {
258
- account: {
259
- is_hidden: false
260
- }
261
- }
262
- }
263
- )
264
- described_class.update_account(update_account_options)
265
- end
266
- end
267
- end
@@ -1,244 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe ::MXPlatformRuby::Category do
6
- let(:category_attributes) do
7
- {
8
- created_at: '2015-04-13T18:01:23.000Z',
9
- guid: 'CAT-7829f71c-2e8c-afa5-2f55-fa3634b89874',
10
- is_default: true,
11
- is_income: false,
12
- metadata: 'some metadata',
13
- name: 'Auto Insurance',
14
- parent_guid: 'CAT-7829f71c-2e8c-afa5-2f55-fa3634b89874',
15
- updated_at: '2015-05-13T18:01:23.000Z'
16
- }
17
- end
18
- let(:create_category_options) do
19
- {
20
- metadata: 'some metadata',
21
- name: 'Online Shopping',
22
- parent_guid: 'CAT-aad51b46-d6f7-3da5-fd6e-492328b3023f',
23
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
24
- }
25
- end
26
- let(:delete_category_options) do
27
- {
28
- category_guid: 'CAT-7829f71c-2e8c-afa5-2f55-fa3634b89874',
29
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
30
- }
31
- end
32
- let(:list_categories_options) do
33
- {
34
- page: 1,
35
- records_per_page: 10,
36
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
37
- }
38
- end
39
- let(:list_default_categories_options) do
40
- {
41
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
42
- }
43
- end
44
- let(:read_category_options) do
45
- {
46
- category_guid: 'CAT-7829f71c-2e8c-afa5-2f55-fa3634b89874',
47
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
48
- }
49
- end
50
- let(:update_category_options) do
51
- {
52
- category_guid: 'CAT-7829f71c-2e8c-afa5-2f55-fa3634b89874',
53
- metadata: 'some metadata',
54
- name: 'Web shopping',
55
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
56
- }
57
- end
58
- let(:pagination_attributes) do
59
- {
60
- 'current_page' => 1,
61
- 'per_page' => 25,
62
- 'total_pages' => 1,
63
- 'total_entries' => 1
64
- }
65
- end
66
-
67
- describe 'create_category' do
68
- let(:create_category_response) { { 'category' => category_attributes } }
69
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(create_category_response) }
70
-
71
- it 'returns category' do
72
- response = described_class.create_category
73
-
74
- expect(response).to be_kind_of(::MXPlatformRuby::Category)
75
- expect(response.created_at).to eq(category_attributes[:created_at])
76
- expect(response.guid).to eq(category_attributes[:guid])
77
- expect(response.is_default).to eq(category_attributes[:is_default])
78
- expect(response.is_income).to eq(category_attributes[:is_income])
79
- expect(response.metadata).to eq(category_attributes[:metadata])
80
- expect(response.name).to eq(category_attributes[:name])
81
- expect(response.parent_guid).to eq(category_attributes[:parent_guid])
82
- expect(response.updated_at).to eq(category_attributes[:updated_at])
83
- end
84
-
85
- it 'makes a client request with the expected params' do
86
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
87
- {
88
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/categories',
89
- http_method: :post,
90
- request_body: {
91
- category: {
92
- metadata: 'some metadata',
93
- name: 'Online Shopping',
94
- parent_guid: 'CAT-aad51b46-d6f7-3da5-fd6e-492328b3023f'
95
- }
96
- }
97
- }
98
- )
99
- described_class.create_category(create_category_options)
100
- end
101
- end
102
-
103
- describe 'delete_category' do
104
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(nil) }
105
-
106
- it 'returns nil' do
107
- response = described_class.delete_category
108
-
109
- expect(response).to be(nil)
110
- end
111
-
112
- it 'makes a client request with the expected params' do
113
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
114
- {
115
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/categories/CAT-7829f71c-2e8c-afa5-2f55-fa3634b89874',
116
- http_method: :delete
117
- }
118
- )
119
- described_class.delete_category(delete_category_options)
120
- end
121
- end
122
-
123
- context 'list_categories endpoints' do
124
- let(:list_categories_response) do
125
- {
126
- 'categories' => [category_attributes],
127
- 'pagination' => pagination_attributes
128
- }
129
- end
130
-
131
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_categories_response) }
132
-
133
- describe 'list_categories' do
134
- it 'returns a list of categorys' do
135
- response = described_class.list_categories
136
-
137
- expect(response).to be_kind_of(::MXPlatformRuby::Page)
138
- expect(response.first).to be_kind_of(::MXPlatformRuby::Category)
139
- expect(response.first.created_at).to eq(category_attributes[:created_at])
140
- expect(response.first.guid).to eq(category_attributes[:guid])
141
- expect(response.first.is_default).to eq(category_attributes[:is_default])
142
- expect(response.first.is_income).to eq(category_attributes[:is_income])
143
- expect(response.first.metadata).to eq(category_attributes[:metadata])
144
- expect(response.first.name).to eq(category_attributes[:name])
145
- expect(response.first.parent_guid).to eq(category_attributes[:parent_guid])
146
- expect(response.first.updated_at).to eq(category_attributes[:updated_at])
147
- expect(response.length).to eq(1)
148
- end
149
- end
150
- end
151
-
152
- context 'list_default_categories endpoints' do
153
- let(:list_default_categories_response) do
154
- {
155
- 'categories' => [category_attributes],
156
- 'pagination' => pagination_attributes
157
- }
158
- end
159
-
160
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_default_categories_response) }
161
-
162
- describe 'list_default_categories' do
163
- it 'returns a list of categorys' do
164
- response = described_class.list_default_categories
165
-
166
- expect(response).to be_kind_of(::MXPlatformRuby::Page)
167
- expect(response.first).to be_kind_of(::MXPlatformRuby::Category)
168
- expect(response.first.created_at).to eq(category_attributes[:created_at])
169
- expect(response.first.guid).to eq(category_attributes[:guid])
170
- expect(response.first.is_default).to eq(category_attributes[:is_default])
171
- expect(response.first.is_income).to eq(category_attributes[:is_income])
172
- expect(response.first.metadata).to eq(category_attributes[:metadata])
173
- expect(response.first.name).to eq(category_attributes[:name])
174
- expect(response.first.parent_guid).to eq(category_attributes[:parent_guid])
175
- expect(response.first.updated_at).to eq(category_attributes[:updated_at])
176
- expect(response.length).to eq(1)
177
- end
178
- end
179
- end
180
-
181
- describe 'read_category' do
182
- let(:read_category_response) { { 'category' => category_attributes } }
183
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(read_category_response) }
184
-
185
- it 'returns category' do
186
- response = described_class.read_category
187
-
188
- expect(response).to be_kind_of(::MXPlatformRuby::Category)
189
- expect(response.created_at).to eq(category_attributes[:created_at])
190
- expect(response.guid).to eq(category_attributes[:guid])
191
- expect(response.is_default).to eq(category_attributes[:is_default])
192
- expect(response.is_income).to eq(category_attributes[:is_income])
193
- expect(response.metadata).to eq(category_attributes[:metadata])
194
- expect(response.name).to eq(category_attributes[:name])
195
- expect(response.parent_guid).to eq(category_attributes[:parent_guid])
196
- expect(response.updated_at).to eq(category_attributes[:updated_at])
197
- end
198
-
199
- it 'makes a client request with the expected params' do
200
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
201
- {
202
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/categories/CAT-7829f71c-2e8c-afa5-2f55-fa3634b89874',
203
- http_method: :get
204
- }
205
- )
206
- described_class.read_category(read_category_options)
207
- end
208
- end
209
-
210
- describe 'update_category' do
211
- let(:update_category_response) { { 'category' => category_attributes } }
212
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(update_category_response) }
213
-
214
- it 'returns category' do
215
- response = described_class.update_category
216
-
217
- expect(response).to be_kind_of(::MXPlatformRuby::Category)
218
- expect(response.created_at).to eq(category_attributes[:created_at])
219
- expect(response.guid).to eq(category_attributes[:guid])
220
- expect(response.is_default).to eq(category_attributes[:is_default])
221
- expect(response.is_income).to eq(category_attributes[:is_income])
222
- expect(response.metadata).to eq(category_attributes[:metadata])
223
- expect(response.name).to eq(category_attributes[:name])
224
- expect(response.parent_guid).to eq(category_attributes[:parent_guid])
225
- expect(response.updated_at).to eq(category_attributes[:updated_at])
226
- end
227
-
228
- it 'makes a client request with the expected params' do
229
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
230
- {
231
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/categories/CAT-7829f71c-2e8c-afa5-2f55-fa3634b89874',
232
- http_method: :put,
233
- request_body: {
234
- category: {
235
- metadata: 'some metadata',
236
- name: 'Web shopping'
237
- }
238
- }
239
- }
240
- )
241
- described_class.update_category(update_category_options)
242
- end
243
- end
244
- end