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,191 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe ::MXPlatformRuby::Tagging do
6
- let(:tagging_attributes) do
7
- {
8
- guid: 'TGN-007f5486-17e1-45fc-8b87-8f03984430fe',
9
- member_is_managed_by_user: false,
10
- tag_guid: 'TAG-40faf068-abb4-405c-8f6a-e883ed541fff',
11
- transaction_guid: 'TRN-810828b0-5210-4878-9bd3-f4ce514f90c4',
12
- user_guid: 'USR-11141024-90b3-1bce-cac9-c06ced52ab4c'
13
- }
14
- end
15
- let(:create_tagging_options) do
16
- {
17
- tag_guid: 'TAG-40faf068-abb4-405c-8f6a-e883ed541fff',
18
- transaction_guid: 'TRN-810828b0-5210-4878-9bd3-f4ce514f90c4',
19
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
20
- }
21
- end
22
- let(:delete_tagging_options) do
23
- {
24
- tagging_guid: 'TGN-007f5486-17e1-45fc-8b87-8f03984430fe',
25
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
26
- }
27
- end
28
- let(:list_taggings_options) do
29
- {
30
- page: 1,
31
- records_per_page: 10,
32
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
33
- }
34
- end
35
- let(:read_tagging_options) do
36
- {
37
- tagging_guid: 'TGN-007f5486-17e1-45fc-8b87-8f03984430fe',
38
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
39
- }
40
- end
41
- let(:update_tagging_options) do
42
- {
43
- tag_guid: 'TAG-40faf068-abb4-405c-8f6a-e883ed541fff',
44
- tagging_guid: 'TGN-007f5486-17e1-45fc-8b87-8f03984430fe',
45
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
46
- }
47
- end
48
- let(:pagination_attributes) do
49
- {
50
- 'current_page' => 1,
51
- 'per_page' => 25,
52
- 'total_pages' => 1,
53
- 'total_entries' => 1
54
- }
55
- end
56
-
57
- describe 'create_tagging' do
58
- let(:create_tagging_response) { { 'tagging' => tagging_attributes } }
59
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(create_tagging_response) }
60
-
61
- it 'returns tagging' do
62
- response = described_class.create_tagging
63
-
64
- expect(response).to be_kind_of(::MXPlatformRuby::Tagging)
65
- expect(response.guid).to eq(tagging_attributes[:guid])
66
- expect(response.member_is_managed_by_user).to eq(tagging_attributes[:member_is_managed_by_user])
67
- expect(response.tag_guid).to eq(tagging_attributes[:tag_guid])
68
- expect(response.transaction_guid).to eq(tagging_attributes[:transaction_guid])
69
- expect(response.user_guid).to eq(tagging_attributes[:user_guid])
70
- end
71
-
72
- it 'makes a client request with the expected params' do
73
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
74
- {
75
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/taggings',
76
- http_method: :post,
77
- request_body: {
78
- tagging: {
79
- tag_guid: 'TAG-40faf068-abb4-405c-8f6a-e883ed541fff',
80
- transaction_guid: 'TRN-810828b0-5210-4878-9bd3-f4ce514f90c4'
81
- }
82
- }
83
- }
84
- )
85
- described_class.create_tagging(create_tagging_options)
86
- end
87
- end
88
-
89
- describe 'delete_tagging' do
90
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(nil) }
91
-
92
- it 'returns nil' do
93
- response = described_class.delete_tagging
94
-
95
- expect(response).to be(nil)
96
- end
97
-
98
- it 'makes a client request with the expected params' do
99
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
100
- {
101
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/taggings/TGN-007f5486-17e1-45fc-8b87-8f03984430fe',
102
- http_method: :delete
103
- }
104
- )
105
- described_class.delete_tagging(delete_tagging_options)
106
- end
107
- end
108
-
109
- context 'list_taggings endpoints' do
110
- let(:list_taggings_response) do
111
- {
112
- 'taggings' => [tagging_attributes],
113
- 'pagination' => pagination_attributes
114
- }
115
- end
116
-
117
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_taggings_response) }
118
-
119
- describe 'list_taggings' do
120
- it 'returns a list of taggings' do
121
- response = described_class.list_taggings
122
-
123
- expect(response).to be_kind_of(::MXPlatformRuby::Page)
124
- expect(response.first).to be_kind_of(::MXPlatformRuby::Tagging)
125
- expect(response.first.guid).to eq(tagging_attributes[:guid])
126
- expect(response.first.member_is_managed_by_user).to eq(tagging_attributes[:member_is_managed_by_user])
127
- expect(response.first.tag_guid).to eq(tagging_attributes[:tag_guid])
128
- expect(response.first.transaction_guid).to eq(tagging_attributes[:transaction_guid])
129
- expect(response.first.user_guid).to eq(tagging_attributes[:user_guid])
130
- expect(response.length).to eq(1)
131
- end
132
- end
133
- end
134
-
135
- describe 'read_tagging' do
136
- let(:read_tagging_response) { { 'tagging' => tagging_attributes } }
137
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(read_tagging_response) }
138
-
139
- it 'returns tagging' do
140
- response = described_class.read_tagging
141
-
142
- expect(response).to be_kind_of(::MXPlatformRuby::Tagging)
143
- expect(response.guid).to eq(tagging_attributes[:guid])
144
- expect(response.member_is_managed_by_user).to eq(tagging_attributes[:member_is_managed_by_user])
145
- expect(response.tag_guid).to eq(tagging_attributes[:tag_guid])
146
- expect(response.transaction_guid).to eq(tagging_attributes[:transaction_guid])
147
- expect(response.user_guid).to eq(tagging_attributes[:user_guid])
148
- end
149
-
150
- it 'makes a client request with the expected params' do
151
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
152
- {
153
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/taggings/TGN-007f5486-17e1-45fc-8b87-8f03984430fe',
154
- http_method: :get
155
- }
156
- )
157
- described_class.read_tagging(read_tagging_options)
158
- end
159
- end
160
-
161
- describe 'update_tagging' do
162
- let(:update_tagging_response) { { 'tagging' => tagging_attributes } }
163
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(update_tagging_response) }
164
-
165
- it 'returns tagging' do
166
- response = described_class.update_tagging
167
-
168
- expect(response).to be_kind_of(::MXPlatformRuby::Tagging)
169
- expect(response.guid).to eq(tagging_attributes[:guid])
170
- expect(response.member_is_managed_by_user).to eq(tagging_attributes[:member_is_managed_by_user])
171
- expect(response.tag_guid).to eq(tagging_attributes[:tag_guid])
172
- expect(response.transaction_guid).to eq(tagging_attributes[:transaction_guid])
173
- expect(response.user_guid).to eq(tagging_attributes[:user_guid])
174
- end
175
-
176
- it 'makes a client request with the expected params' do
177
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
178
- {
179
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/taggings/TGN-007f5486-17e1-45fc-8b87-8f03984430fe',
180
- http_method: :put,
181
- request_body: {
182
- tagging: {
183
- tag_guid: 'TAG-40faf068-abb4-405c-8f6a-e883ed541fff'
184
- }
185
- }
186
- }
187
- )
188
- described_class.update_tagging(update_tagging_options)
189
- end
190
- end
191
- end
@@ -1,207 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe ::MXPlatformRuby::TransactionRule do
6
- let(:transaction_rule_attributes) do
7
- {
8
- category_guid: 'CAT-b1de2a04-db08-b6ed-f6fe-ca2f5b11c2d0',
9
- created_at: '2018-10-02T22:00:50+00:00',
10
- description: 'Wal-mart food storage',
11
- guid: 'TXR-a080e0f9-a2d4-4d6f-9e03-672cc357a4d3',
12
- match_description: 'Wal-mart',
13
- updated_at: '2018-10-02T23:54:40+00:00',
14
- user_guid: 'USR-22fc3203-b3e6-8340-43db-8e50b2f56995'
15
- }
16
- end
17
- let(:create_transaction_rule_options) do
18
- {
19
- category_guid: 'CAT-b1de2a04-db08-b6ed-f6fe-ca2f5b11c2d0',
20
- description: 'Wal-mart food storage',
21
- match_description: 'Wal-mart',
22
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
23
- }
24
- end
25
- let(:delete_transaction_rule_options) do
26
- {
27
- transaction_rule_guid: 'TXR-a080e0f9-a2d4-4d6f-9e03-672cc357a4d3',
28
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
29
- }
30
- end
31
- let(:list_transaction_rules_by_user_options) do
32
- {
33
- page: 1,
34
- records_per_page: 10,
35
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
36
- }
37
- end
38
- let(:read_transaction_rule_options) do
39
- {
40
- transaction_rule_guid: 'TXR-a080e0f9-a2d4-4d6f-9e03-672cc357a4d3',
41
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
42
- }
43
- end
44
- let(:update_transaction_rule_options) do
45
- {
46
- category_guid: 'CAT-b1de2a04-db08-b6ed-f6fe-ca2f5b11c2d0',
47
- description: 'Wal-mart food storage',
48
- match_description: 'Wal-mart',
49
- transaction_rule_guid: 'TXR-a080e0f9-a2d4-4d6f-9e03-672cc357a4d3',
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
- describe 'create_transaction_rule' do
63
- let(:create_transaction_rule_response) { { 'transaction_rule' => transaction_rule_attributes } }
64
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(create_transaction_rule_response) }
65
-
66
- it 'returns transaction_rule' do
67
- response = described_class.create_transaction_rule
68
-
69
- expect(response).to be_kind_of(::MXPlatformRuby::TransactionRule)
70
- expect(response.category_guid).to eq(transaction_rule_attributes[:category_guid])
71
- expect(response.created_at).to eq(transaction_rule_attributes[:created_at])
72
- expect(response.description).to eq(transaction_rule_attributes[:description])
73
- expect(response.guid).to eq(transaction_rule_attributes[:guid])
74
- expect(response.match_description).to eq(transaction_rule_attributes[:match_description])
75
- expect(response.updated_at).to eq(transaction_rule_attributes[:updated_at])
76
- expect(response.user_guid).to eq(transaction_rule_attributes[:user_guid])
77
- end
78
-
79
- it 'makes a client request with the expected params' do
80
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
81
- {
82
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/transaction_rules',
83
- http_method: :post,
84
- request_body: {
85
- transaction_rule: {
86
- category_guid: 'CAT-b1de2a04-db08-b6ed-f6fe-ca2f5b11c2d0',
87
- description: 'Wal-mart food storage',
88
- match_description: 'Wal-mart'
89
- }
90
- }
91
- }
92
- )
93
- described_class.create_transaction_rule(create_transaction_rule_options)
94
- end
95
- end
96
-
97
- describe 'delete_transaction_rule' do
98
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(nil) }
99
-
100
- it 'returns nil' do
101
- response = described_class.delete_transaction_rule
102
-
103
- expect(response).to be(nil)
104
- end
105
-
106
- it 'makes a client request with the expected params' do
107
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
108
- {
109
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/transaction_rules/TXR-a080e0f9-a2d4-4d6f-9e03-672cc357a4d3',
110
- http_method: :delete
111
- }
112
- )
113
- described_class.delete_transaction_rule(delete_transaction_rule_options)
114
- end
115
- end
116
-
117
- context 'list_transaction_rules_by_user endpoints' do
118
- let(:list_transaction_rules_by_user_response) do
119
- {
120
- 'transaction_rules' => [transaction_rule_attributes],
121
- 'pagination' => pagination_attributes
122
- }
123
- end
124
-
125
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_transaction_rules_by_user_response) }
126
-
127
- describe 'list_transaction_rules_by_user' do
128
- it 'returns a list of transaction_rules' do
129
- response = described_class.list_transaction_rules_by_user
130
-
131
- expect(response).to be_kind_of(::MXPlatformRuby::Page)
132
- expect(response.first).to be_kind_of(::MXPlatformRuby::TransactionRule)
133
- expect(response.first.category_guid).to eq(transaction_rule_attributes[:category_guid])
134
- expect(response.first.created_at).to eq(transaction_rule_attributes[:created_at])
135
- expect(response.first.description).to eq(transaction_rule_attributes[:description])
136
- expect(response.first.guid).to eq(transaction_rule_attributes[:guid])
137
- expect(response.first.match_description).to eq(transaction_rule_attributes[:match_description])
138
- expect(response.first.updated_at).to eq(transaction_rule_attributes[:updated_at])
139
- expect(response.first.user_guid).to eq(transaction_rule_attributes[:user_guid])
140
- expect(response.length).to eq(1)
141
- end
142
- end
143
- end
144
-
145
- describe 'read_transaction_rule' do
146
- let(:read_transaction_rule_response) { { 'transaction_rule' => transaction_rule_attributes } }
147
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(read_transaction_rule_response) }
148
-
149
- it 'returns transaction_rule' do
150
- response = described_class.read_transaction_rule
151
-
152
- expect(response).to be_kind_of(::MXPlatformRuby::TransactionRule)
153
- expect(response.category_guid).to eq(transaction_rule_attributes[:category_guid])
154
- expect(response.created_at).to eq(transaction_rule_attributes[:created_at])
155
- expect(response.description).to eq(transaction_rule_attributes[:description])
156
- expect(response.guid).to eq(transaction_rule_attributes[:guid])
157
- expect(response.match_description).to eq(transaction_rule_attributes[:match_description])
158
- expect(response.updated_at).to eq(transaction_rule_attributes[:updated_at])
159
- expect(response.user_guid).to eq(transaction_rule_attributes[:user_guid])
160
- end
161
-
162
- it 'makes a client request with the expected params' do
163
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
164
- {
165
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/transaction_rules/TXR-a080e0f9-a2d4-4d6f-9e03-672cc357a4d3',
166
- http_method: :get
167
- }
168
- )
169
- described_class.read_transaction_rule(read_transaction_rule_options)
170
- end
171
- end
172
-
173
- describe 'update_transaction_rule' do
174
- let(:update_transaction_rule_response) { { 'transaction_rule' => transaction_rule_attributes } }
175
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(update_transaction_rule_response) }
176
-
177
- it 'returns transaction_rule' do
178
- response = described_class.update_transaction_rule
179
-
180
- expect(response).to be_kind_of(::MXPlatformRuby::TransactionRule)
181
- expect(response.category_guid).to eq(transaction_rule_attributes[:category_guid])
182
- expect(response.created_at).to eq(transaction_rule_attributes[:created_at])
183
- expect(response.description).to eq(transaction_rule_attributes[:description])
184
- expect(response.guid).to eq(transaction_rule_attributes[:guid])
185
- expect(response.match_description).to eq(transaction_rule_attributes[:match_description])
186
- expect(response.updated_at).to eq(transaction_rule_attributes[:updated_at])
187
- expect(response.user_guid).to eq(transaction_rule_attributes[:user_guid])
188
- end
189
-
190
- it 'makes a client request with the expected params' do
191
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
192
- {
193
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/transaction_rules/TXR-a080e0f9-a2d4-4d6f-9e03-672cc357a4d3',
194
- http_method: :put,
195
- request_body: {
196
- transaction_rule: {
197
- category_guid: 'CAT-b1de2a04-db08-b6ed-f6fe-ca2f5b11c2d0',
198
- description: 'Wal-mart food storage',
199
- match_description: 'Wal-mart'
200
- }
201
- }
202
- }
203
- )
204
- described_class.update_transaction_rule(update_transaction_rule_options)
205
- end
206
- end
207
- end
@@ -1,449 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe ::MXPlatformRuby::Transaction do
6
- let(:transaction_attributes) do
7
- {
8
- account_guid: 'ACT-06d7f44b-caae-0f6e-1384-01f52e75dcb1',
9
- amount: 61.11,
10
- category: 'Groceries',
11
- check_number_string: '6812',
12
- created_at: '2016-10-06T09:43:42.000Z',
13
- currency_code: 'USD',
14
- date: '2013-09-23T00:00:00.000Z',
15
- description: 'Whole foods',
16
- guid: 'TRN-265abee9-889b-af6a-c69b-25157db2bdd9',
17
- id: 'transaction-265abee9-889b-af6a-c69b-25157db2bdd9',
18
- is_bill_pay: false,
19
- is_direct_deposit: false,
20
- is_expense: true,
21
- is_fee: false,
22
- is_income: false,
23
- is_international: false,
24
- is_overdraft_fee: false,
25
- is_payroll_advance: false,
26
- is_recurring: false,
27
- is_subscription: false,
28
- latitude: -43.2075,
29
- localized_description: 'This is a localized_description',
30
- localized_memo: 'This is a localized_memo',
31
- longitude: 139.691706,
32
- member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
33
- memo: 'This is a memo',
34
- merchant_category_code: 5411,
35
- merchant_guid: 'MCH-7ed79542-884d-2b1b-dd74-501c5cc9d25b',
36
- original_description: 'WHOLEFDS TSQ 102',
37
- posted_at: '2016-10-07T06:00:00.000Z',
38
- status: 'POSTED',
39
- top_level_category: 'Food & Dining',
40
- transacted_at: '2016-10-06T13:00:00.000Z',
41
- type: 'DEBIT',
42
- updated_at: '2016-10-07T05:49:12.000Z',
43
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
44
- }
45
- end
46
- let(:list_transactions_by_account_options) do
47
- {
48
- account_guid: 'ACT-06d7f44b-caae-0f6e-1384-01f52e75dcb1',
49
- from_date: '2015-09-20',
50
- page: 1,
51
- records_per_page: 10,
52
- to_date: '2019-10-20',
53
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
54
- }
55
- end
56
- let(:list_transactions_by_member_options) do
57
- {
58
- from_date: '2015-09-20',
59
- member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
60
- page: 1,
61
- records_per_page: 10,
62
- to_date: '2019-10-20',
63
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
64
- }
65
- end
66
- let(:list_transactions_by_tag_options) do
67
- {
68
- tag_guid: 'TAG-aef36e72-6294-4c38-844d-e573e80aed52',
69
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
70
- }
71
- end
72
- let(:list_transactions_by_user_options) do
73
- {
74
- from_date: '2015-09-20',
75
- page: 1,
76
- records_per_page: 10,
77
- to_date: '2019-10-20',
78
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
79
- }
80
- end
81
- let(:read_transaction_options) do
82
- {
83
- transaction_guid: 'TRN-810828b0-5210-4878-9bd3-f4ce514f90c4',
84
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
85
- }
86
- end
87
- let(:update_transaction_options) do
88
- {
89
- description: 'new description',
90
- transaction_guid: 'TRN-810828b0-5210-4878-9bd3-f4ce514f90c4',
91
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
92
- }
93
- end
94
- let(:pagination_attributes) do
95
- {
96
- 'current_page' => 1,
97
- 'per_page' => 25,
98
- 'total_pages' => 1,
99
- 'total_entries' => 1
100
- }
101
- end
102
-
103
- context 'list_transactions_by_account endpoints' do
104
- let(:list_transactions_by_account_response) do
105
- {
106
- 'transactions' => [transaction_attributes],
107
- 'pagination' => pagination_attributes
108
- }
109
- end
110
-
111
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_transactions_by_account_response) }
112
-
113
- describe 'list_transactions_by_account' do
114
- it 'returns a list of transactions' do
115
- response = described_class.list_transactions_by_account
116
-
117
- expect(response).to be_kind_of(::MXPlatformRuby::Page)
118
- expect(response.first).to be_kind_of(::MXPlatformRuby::Transaction)
119
- expect(response.first.account_guid).to eq(transaction_attributes[:account_guid])
120
- expect(response.first.amount).to eq(transaction_attributes[:amount])
121
- expect(response.first.category).to eq(transaction_attributes[:category])
122
- expect(response.first.check_number_string).to eq(transaction_attributes[:check_number_string])
123
- expect(response.first.created_at).to eq(transaction_attributes[:created_at])
124
- expect(response.first.currency_code).to eq(transaction_attributes[:currency_code])
125
- expect(response.first.date).to eq(transaction_attributes[:date])
126
- expect(response.first.description).to eq(transaction_attributes[:description])
127
- expect(response.first.guid).to eq(transaction_attributes[:guid])
128
- expect(response.first.id).to eq(transaction_attributes[:id])
129
- expect(response.first.is_bill_pay).to eq(transaction_attributes[:is_bill_pay])
130
- expect(response.first.is_direct_deposit).to eq(transaction_attributes[:is_direct_deposit])
131
- expect(response.first.is_expense).to eq(transaction_attributes[:is_expense])
132
- expect(response.first.is_fee).to eq(transaction_attributes[:is_fee])
133
- expect(response.first.is_income).to eq(transaction_attributes[:is_income])
134
- expect(response.first.is_international).to eq(transaction_attributes[:is_international])
135
- expect(response.first.is_overdraft_fee).to eq(transaction_attributes[:is_overdraft_fee])
136
- expect(response.first.is_payroll_advance).to eq(transaction_attributes[:is_payroll_advance])
137
- expect(response.first.is_recurring).to eq(transaction_attributes[:is_recurring])
138
- expect(response.first.is_subscription).to eq(transaction_attributes[:is_subscription])
139
- expect(response.first.latitude).to eq(transaction_attributes[:latitude])
140
- expect(response.first.localized_description).to eq(transaction_attributes[:localized_description])
141
- expect(response.first.localized_memo).to eq(transaction_attributes[:localized_memo])
142
- expect(response.first.longitude).to eq(transaction_attributes[:longitude])
143
- expect(response.first.member_guid).to eq(transaction_attributes[:member_guid])
144
- expect(response.first.memo).to eq(transaction_attributes[:memo])
145
- expect(response.first.merchant_category_code).to eq(transaction_attributes[:merchant_category_code])
146
- expect(response.first.merchant_guid).to eq(transaction_attributes[:merchant_guid])
147
- expect(response.first.original_description).to eq(transaction_attributes[:original_description])
148
- expect(response.first.posted_at).to eq(transaction_attributes[:posted_at])
149
- expect(response.first.status).to eq(transaction_attributes[:status])
150
- expect(response.first.top_level_category).to eq(transaction_attributes[:top_level_category])
151
- expect(response.first.transacted_at).to eq(transaction_attributes[:transacted_at])
152
- expect(response.first.type).to eq(transaction_attributes[:type])
153
- expect(response.first.updated_at).to eq(transaction_attributes[:updated_at])
154
- expect(response.first.user_guid).to eq(transaction_attributes[:user_guid])
155
- expect(response.length).to eq(1)
156
- end
157
- end
158
- end
159
-
160
- context 'list_transactions_by_member endpoints' do
161
- let(:list_transactions_by_member_response) do
162
- {
163
- 'transactions' => [transaction_attributes],
164
- 'pagination' => pagination_attributes
165
- }
166
- end
167
-
168
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_transactions_by_member_response) }
169
-
170
- describe 'list_transactions_by_member' do
171
- it 'returns a list of transactions' do
172
- response = described_class.list_transactions_by_member
173
-
174
- expect(response).to be_kind_of(::MXPlatformRuby::Page)
175
- expect(response.first).to be_kind_of(::MXPlatformRuby::Transaction)
176
- expect(response.first.account_guid).to eq(transaction_attributes[:account_guid])
177
- expect(response.first.amount).to eq(transaction_attributes[:amount])
178
- expect(response.first.category).to eq(transaction_attributes[:category])
179
- expect(response.first.check_number_string).to eq(transaction_attributes[:check_number_string])
180
- expect(response.first.created_at).to eq(transaction_attributes[:created_at])
181
- expect(response.first.currency_code).to eq(transaction_attributes[:currency_code])
182
- expect(response.first.date).to eq(transaction_attributes[:date])
183
- expect(response.first.description).to eq(transaction_attributes[:description])
184
- expect(response.first.guid).to eq(transaction_attributes[:guid])
185
- expect(response.first.id).to eq(transaction_attributes[:id])
186
- expect(response.first.is_bill_pay).to eq(transaction_attributes[:is_bill_pay])
187
- expect(response.first.is_direct_deposit).to eq(transaction_attributes[:is_direct_deposit])
188
- expect(response.first.is_expense).to eq(transaction_attributes[:is_expense])
189
- expect(response.first.is_fee).to eq(transaction_attributes[:is_fee])
190
- expect(response.first.is_income).to eq(transaction_attributes[:is_income])
191
- expect(response.first.is_international).to eq(transaction_attributes[:is_international])
192
- expect(response.first.is_overdraft_fee).to eq(transaction_attributes[:is_overdraft_fee])
193
- expect(response.first.is_payroll_advance).to eq(transaction_attributes[:is_payroll_advance])
194
- expect(response.first.is_recurring).to eq(transaction_attributes[:is_recurring])
195
- expect(response.first.is_subscription).to eq(transaction_attributes[:is_subscription])
196
- expect(response.first.latitude).to eq(transaction_attributes[:latitude])
197
- expect(response.first.localized_description).to eq(transaction_attributes[:localized_description])
198
- expect(response.first.localized_memo).to eq(transaction_attributes[:localized_memo])
199
- expect(response.first.longitude).to eq(transaction_attributes[:longitude])
200
- expect(response.first.member_guid).to eq(transaction_attributes[:member_guid])
201
- expect(response.first.memo).to eq(transaction_attributes[:memo])
202
- expect(response.first.merchant_category_code).to eq(transaction_attributes[:merchant_category_code])
203
- expect(response.first.merchant_guid).to eq(transaction_attributes[:merchant_guid])
204
- expect(response.first.original_description).to eq(transaction_attributes[:original_description])
205
- expect(response.first.posted_at).to eq(transaction_attributes[:posted_at])
206
- expect(response.first.status).to eq(transaction_attributes[:status])
207
- expect(response.first.top_level_category).to eq(transaction_attributes[:top_level_category])
208
- expect(response.first.transacted_at).to eq(transaction_attributes[:transacted_at])
209
- expect(response.first.type).to eq(transaction_attributes[:type])
210
- expect(response.first.updated_at).to eq(transaction_attributes[:updated_at])
211
- expect(response.first.user_guid).to eq(transaction_attributes[:user_guid])
212
- expect(response.length).to eq(1)
213
- end
214
- end
215
- end
216
-
217
- context 'list_transactions_by_tag endpoints' do
218
- let(:list_transactions_by_tag_response) do
219
- {
220
- 'transactions' => [transaction_attributes],
221
- 'pagination' => pagination_attributes
222
- }
223
- end
224
-
225
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_transactions_by_tag_response) }
226
-
227
- describe 'list_transactions_by_tag' do
228
- it 'returns a list of transactions' do
229
- response = described_class.list_transactions_by_tag
230
-
231
- expect(response).to be_kind_of(::MXPlatformRuby::Page)
232
- expect(response.first).to be_kind_of(::MXPlatformRuby::Transaction)
233
- expect(response.first.account_guid).to eq(transaction_attributes[:account_guid])
234
- expect(response.first.amount).to eq(transaction_attributes[:amount])
235
- expect(response.first.category).to eq(transaction_attributes[:category])
236
- expect(response.first.check_number_string).to eq(transaction_attributes[:check_number_string])
237
- expect(response.first.created_at).to eq(transaction_attributes[:created_at])
238
- expect(response.first.currency_code).to eq(transaction_attributes[:currency_code])
239
- expect(response.first.date).to eq(transaction_attributes[:date])
240
- expect(response.first.description).to eq(transaction_attributes[:description])
241
- expect(response.first.guid).to eq(transaction_attributes[:guid])
242
- expect(response.first.id).to eq(transaction_attributes[:id])
243
- expect(response.first.is_bill_pay).to eq(transaction_attributes[:is_bill_pay])
244
- expect(response.first.is_direct_deposit).to eq(transaction_attributes[:is_direct_deposit])
245
- expect(response.first.is_expense).to eq(transaction_attributes[:is_expense])
246
- expect(response.first.is_fee).to eq(transaction_attributes[:is_fee])
247
- expect(response.first.is_income).to eq(transaction_attributes[:is_income])
248
- expect(response.first.is_international).to eq(transaction_attributes[:is_international])
249
- expect(response.first.is_overdraft_fee).to eq(transaction_attributes[:is_overdraft_fee])
250
- expect(response.first.is_payroll_advance).to eq(transaction_attributes[:is_payroll_advance])
251
- expect(response.first.is_recurring).to eq(transaction_attributes[:is_recurring])
252
- expect(response.first.is_subscription).to eq(transaction_attributes[:is_subscription])
253
- expect(response.first.latitude).to eq(transaction_attributes[:latitude])
254
- expect(response.first.localized_description).to eq(transaction_attributes[:localized_description])
255
- expect(response.first.localized_memo).to eq(transaction_attributes[:localized_memo])
256
- expect(response.first.longitude).to eq(transaction_attributes[:longitude])
257
- expect(response.first.member_guid).to eq(transaction_attributes[:member_guid])
258
- expect(response.first.memo).to eq(transaction_attributes[:memo])
259
- expect(response.first.merchant_category_code).to eq(transaction_attributes[:merchant_category_code])
260
- expect(response.first.merchant_guid).to eq(transaction_attributes[:merchant_guid])
261
- expect(response.first.original_description).to eq(transaction_attributes[:original_description])
262
- expect(response.first.posted_at).to eq(transaction_attributes[:posted_at])
263
- expect(response.first.status).to eq(transaction_attributes[:status])
264
- expect(response.first.top_level_category).to eq(transaction_attributes[:top_level_category])
265
- expect(response.first.transacted_at).to eq(transaction_attributes[:transacted_at])
266
- expect(response.first.type).to eq(transaction_attributes[:type])
267
- expect(response.first.updated_at).to eq(transaction_attributes[:updated_at])
268
- expect(response.first.user_guid).to eq(transaction_attributes[:user_guid])
269
- expect(response.length).to eq(1)
270
- end
271
- end
272
- end
273
-
274
- context 'list_transactions_by_user endpoints' do
275
- let(:list_transactions_by_user_response) do
276
- {
277
- 'transactions' => [transaction_attributes],
278
- 'pagination' => pagination_attributes
279
- }
280
- end
281
-
282
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_transactions_by_user_response) }
283
-
284
- describe 'list_transactions_by_user' do
285
- it 'returns a list of transactions' do
286
- response = described_class.list_transactions_by_user
287
-
288
- expect(response).to be_kind_of(::MXPlatformRuby::Page)
289
- expect(response.first).to be_kind_of(::MXPlatformRuby::Transaction)
290
- expect(response.first.account_guid).to eq(transaction_attributes[:account_guid])
291
- expect(response.first.amount).to eq(transaction_attributes[:amount])
292
- expect(response.first.category).to eq(transaction_attributes[:category])
293
- expect(response.first.check_number_string).to eq(transaction_attributes[:check_number_string])
294
- expect(response.first.created_at).to eq(transaction_attributes[:created_at])
295
- expect(response.first.currency_code).to eq(transaction_attributes[:currency_code])
296
- expect(response.first.date).to eq(transaction_attributes[:date])
297
- expect(response.first.description).to eq(transaction_attributes[:description])
298
- expect(response.first.guid).to eq(transaction_attributes[:guid])
299
- expect(response.first.id).to eq(transaction_attributes[:id])
300
- expect(response.first.is_bill_pay).to eq(transaction_attributes[:is_bill_pay])
301
- expect(response.first.is_direct_deposit).to eq(transaction_attributes[:is_direct_deposit])
302
- expect(response.first.is_expense).to eq(transaction_attributes[:is_expense])
303
- expect(response.first.is_fee).to eq(transaction_attributes[:is_fee])
304
- expect(response.first.is_income).to eq(transaction_attributes[:is_income])
305
- expect(response.first.is_international).to eq(transaction_attributes[:is_international])
306
- expect(response.first.is_overdraft_fee).to eq(transaction_attributes[:is_overdraft_fee])
307
- expect(response.first.is_payroll_advance).to eq(transaction_attributes[:is_payroll_advance])
308
- expect(response.first.is_recurring).to eq(transaction_attributes[:is_recurring])
309
- expect(response.first.is_subscription).to eq(transaction_attributes[:is_subscription])
310
- expect(response.first.latitude).to eq(transaction_attributes[:latitude])
311
- expect(response.first.localized_description).to eq(transaction_attributes[:localized_description])
312
- expect(response.first.localized_memo).to eq(transaction_attributes[:localized_memo])
313
- expect(response.first.longitude).to eq(transaction_attributes[:longitude])
314
- expect(response.first.member_guid).to eq(transaction_attributes[:member_guid])
315
- expect(response.first.memo).to eq(transaction_attributes[:memo])
316
- expect(response.first.merchant_category_code).to eq(transaction_attributes[:merchant_category_code])
317
- expect(response.first.merchant_guid).to eq(transaction_attributes[:merchant_guid])
318
- expect(response.first.original_description).to eq(transaction_attributes[:original_description])
319
- expect(response.first.posted_at).to eq(transaction_attributes[:posted_at])
320
- expect(response.first.status).to eq(transaction_attributes[:status])
321
- expect(response.first.top_level_category).to eq(transaction_attributes[:top_level_category])
322
- expect(response.first.transacted_at).to eq(transaction_attributes[:transacted_at])
323
- expect(response.first.type).to eq(transaction_attributes[:type])
324
- expect(response.first.updated_at).to eq(transaction_attributes[:updated_at])
325
- expect(response.first.user_guid).to eq(transaction_attributes[:user_guid])
326
- expect(response.length).to eq(1)
327
- end
328
- end
329
- end
330
-
331
- describe 'read_transaction' do
332
- let(:read_transaction_response) { { 'transaction' => transaction_attributes } }
333
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(read_transaction_response) }
334
-
335
- it 'returns transaction' do
336
- response = described_class.read_transaction
337
-
338
- expect(response).to be_kind_of(::MXPlatformRuby::Transaction)
339
- expect(response.account_guid).to eq(transaction_attributes[:account_guid])
340
- expect(response.amount).to eq(transaction_attributes[:amount])
341
- expect(response.category).to eq(transaction_attributes[:category])
342
- expect(response.check_number_string).to eq(transaction_attributes[:check_number_string])
343
- expect(response.created_at).to eq(transaction_attributes[:created_at])
344
- expect(response.currency_code).to eq(transaction_attributes[:currency_code])
345
- expect(response.date).to eq(transaction_attributes[:date])
346
- expect(response.description).to eq(transaction_attributes[:description])
347
- expect(response.guid).to eq(transaction_attributes[:guid])
348
- expect(response.id).to eq(transaction_attributes[:id])
349
- expect(response.is_bill_pay).to eq(transaction_attributes[:is_bill_pay])
350
- expect(response.is_direct_deposit).to eq(transaction_attributes[:is_direct_deposit])
351
- expect(response.is_expense).to eq(transaction_attributes[:is_expense])
352
- expect(response.is_fee).to eq(transaction_attributes[:is_fee])
353
- expect(response.is_income).to eq(transaction_attributes[:is_income])
354
- expect(response.is_international).to eq(transaction_attributes[:is_international])
355
- expect(response.is_overdraft_fee).to eq(transaction_attributes[:is_overdraft_fee])
356
- expect(response.is_payroll_advance).to eq(transaction_attributes[:is_payroll_advance])
357
- expect(response.is_recurring).to eq(transaction_attributes[:is_recurring])
358
- expect(response.is_subscription).to eq(transaction_attributes[:is_subscription])
359
- expect(response.latitude).to eq(transaction_attributes[:latitude])
360
- expect(response.localized_description).to eq(transaction_attributes[:localized_description])
361
- expect(response.localized_memo).to eq(transaction_attributes[:localized_memo])
362
- expect(response.longitude).to eq(transaction_attributes[:longitude])
363
- expect(response.member_guid).to eq(transaction_attributes[:member_guid])
364
- expect(response.memo).to eq(transaction_attributes[:memo])
365
- expect(response.merchant_category_code).to eq(transaction_attributes[:merchant_category_code])
366
- expect(response.merchant_guid).to eq(transaction_attributes[:merchant_guid])
367
- expect(response.original_description).to eq(transaction_attributes[:original_description])
368
- expect(response.posted_at).to eq(transaction_attributes[:posted_at])
369
- expect(response.status).to eq(transaction_attributes[:status])
370
- expect(response.top_level_category).to eq(transaction_attributes[:top_level_category])
371
- expect(response.transacted_at).to eq(transaction_attributes[:transacted_at])
372
- expect(response.type).to eq(transaction_attributes[:type])
373
- expect(response.updated_at).to eq(transaction_attributes[:updated_at])
374
- expect(response.user_guid).to eq(transaction_attributes[:user_guid])
375
- end
376
-
377
- it 'makes a client request with the expected params' do
378
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
379
- {
380
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/transactions/TRN-810828b0-5210-4878-9bd3-f4ce514f90c4',
381
- http_method: :get
382
- }
383
- )
384
- described_class.read_transaction(read_transaction_options)
385
- end
386
- end
387
-
388
- describe 'update_transaction' do
389
- let(:update_transaction_response) { { 'transaction' => transaction_attributes } }
390
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(update_transaction_response) }
391
-
392
- it 'returns transaction' do
393
- response = described_class.update_transaction
394
-
395
- expect(response).to be_kind_of(::MXPlatformRuby::Transaction)
396
- expect(response.account_guid).to eq(transaction_attributes[:account_guid])
397
- expect(response.amount).to eq(transaction_attributes[:amount])
398
- expect(response.category).to eq(transaction_attributes[:category])
399
- expect(response.check_number_string).to eq(transaction_attributes[:check_number_string])
400
- expect(response.created_at).to eq(transaction_attributes[:created_at])
401
- expect(response.currency_code).to eq(transaction_attributes[:currency_code])
402
- expect(response.date).to eq(transaction_attributes[:date])
403
- expect(response.description).to eq(transaction_attributes[:description])
404
- expect(response.guid).to eq(transaction_attributes[:guid])
405
- expect(response.id).to eq(transaction_attributes[:id])
406
- expect(response.is_bill_pay).to eq(transaction_attributes[:is_bill_pay])
407
- expect(response.is_direct_deposit).to eq(transaction_attributes[:is_direct_deposit])
408
- expect(response.is_expense).to eq(transaction_attributes[:is_expense])
409
- expect(response.is_fee).to eq(transaction_attributes[:is_fee])
410
- expect(response.is_income).to eq(transaction_attributes[:is_income])
411
- expect(response.is_international).to eq(transaction_attributes[:is_international])
412
- expect(response.is_overdraft_fee).to eq(transaction_attributes[:is_overdraft_fee])
413
- expect(response.is_payroll_advance).to eq(transaction_attributes[:is_payroll_advance])
414
- expect(response.is_recurring).to eq(transaction_attributes[:is_recurring])
415
- expect(response.is_subscription).to eq(transaction_attributes[:is_subscription])
416
- expect(response.latitude).to eq(transaction_attributes[:latitude])
417
- expect(response.localized_description).to eq(transaction_attributes[:localized_description])
418
- expect(response.localized_memo).to eq(transaction_attributes[:localized_memo])
419
- expect(response.longitude).to eq(transaction_attributes[:longitude])
420
- expect(response.member_guid).to eq(transaction_attributes[:member_guid])
421
- expect(response.memo).to eq(transaction_attributes[:memo])
422
- expect(response.merchant_category_code).to eq(transaction_attributes[:merchant_category_code])
423
- expect(response.merchant_guid).to eq(transaction_attributes[:merchant_guid])
424
- expect(response.original_description).to eq(transaction_attributes[:original_description])
425
- expect(response.posted_at).to eq(transaction_attributes[:posted_at])
426
- expect(response.status).to eq(transaction_attributes[:status])
427
- expect(response.top_level_category).to eq(transaction_attributes[:top_level_category])
428
- expect(response.transacted_at).to eq(transaction_attributes[:transacted_at])
429
- expect(response.type).to eq(transaction_attributes[:type])
430
- expect(response.updated_at).to eq(transaction_attributes[:updated_at])
431
- expect(response.user_guid).to eq(transaction_attributes[:user_guid])
432
- end
433
-
434
- it 'makes a client request with the expected params' do
435
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
436
- {
437
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/transactions/TRN-810828b0-5210-4878-9bd3-f4ce514f90c4',
438
- http_method: :put,
439
- request_body: {
440
- transaction: {
441
- description: 'new description'
442
- }
443
- }
444
- }
445
- )
446
- described_class.update_transaction(update_transaction_options)
447
- end
448
- end
449
- end