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,76 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe ::MXPlatformRuby::MemberStatus do
6
- let(:member_status_attributes) do
7
- {
8
- aggregated_at: '2016-10-13T18:07:57.000Z',
9
- challenges: [
10
- {
11
- field_name: 'Who is this guy?',
12
- guid: 'CRD-ce76d2e3-86bd-ec4a-ec52-eb53b5194bf5',
13
- image_data: 'Who is this guy?',
14
- image_options: [
15
- {
16
- data_uri: 'data:image/png;base64,iVBORw0KGgoAAAANSUh ... more image data ...',
17
- label: 'IMAGE_1',
18
- value: 'image_data'
19
- }
20
- ],
21
- label: 'Who is this guy?',
22
- options: [
23
- {
24
- label: 'IMAGE_1',
25
- value: 'image_data'
26
- }
27
- ],
28
- type: 'IMAGE_DATA'
29
- }
30
- ],
31
- connection_status: 'CONNECTED',
32
- guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
33
- has_processed_accounts: true,
34
- has_processed_transactions: false,
35
- is_authenticated: false,
36
- is_being_aggregated: false,
37
- successfully_aggregated_at: '2016-10-13T17:57:38.000Z'
38
- }
39
- end
40
- let(:read_member_status_options) do
41
- {
42
- member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
43
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
44
- }
45
- end
46
-
47
- describe 'read_member_status' do
48
- let(:read_member_status_response) { { 'member' => member_status_attributes } }
49
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(read_member_status_response) }
50
-
51
- it 'returns member_status' do
52
- response = described_class.read_member_status
53
-
54
- expect(response).to be_kind_of(::MXPlatformRuby::MemberStatus)
55
- expect(response.aggregated_at).to eq(member_status_attributes[:aggregated_at])
56
- expect(response.challenges).to eq(member_status_attributes[:challenges])
57
- expect(response.connection_status).to eq(member_status_attributes[:connection_status])
58
- expect(response.guid).to eq(member_status_attributes[:guid])
59
- expect(response.has_processed_accounts).to eq(member_status_attributes[:has_processed_accounts])
60
- expect(response.has_processed_transactions).to eq(member_status_attributes[:has_processed_transactions])
61
- expect(response.is_authenticated).to eq(member_status_attributes[:is_authenticated])
62
- expect(response.is_being_aggregated).to eq(member_status_attributes[:is_being_aggregated])
63
- expect(response.successfully_aggregated_at).to eq(member_status_attributes[:successfully_aggregated_at])
64
- end
65
-
66
- it 'makes a client request with the expected params' do
67
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
68
- {
69
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/members/MBR-7c6f361b-e582-15b6-60c0-358f12466b4b/status',
70
- http_method: :get
71
- }
72
- )
73
- described_class.read_member_status(read_member_status_options)
74
- end
75
- end
76
- end
@@ -1,89 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe ::MXPlatformRuby::Merchant do
6
- let(:merchant_attributes) do
7
- {
8
- created_at: '2017-04-20T19:30:12.000Z',
9
- guid: 'MCH-7ed79542-884d-2b1b-dd74-501c5cc9d25b',
10
- logo_url: 'https://s3.amazonaws.com/MD_Assets/merchant_logos/comcast.png',
11
- name: 'Comcast',
12
- updated_at: '2018-09-28T21:13:53.000Z',
13
- website_url: 'https://www.xfinity.com'
14
- }
15
- end
16
- let(:list_merchants_options) do
17
- {
18
- page: 1,
19
- records_per_page: 10
20
- }
21
- end
22
- let(:read_merchant_options) do
23
- {
24
- merchant_guid: 'MCH-7ed79542-884d-2b1b-dd74-501c5cc9d25b'
25
- }
26
- end
27
- let(:pagination_attributes) do
28
- {
29
- 'current_page' => 1,
30
- 'per_page' => 25,
31
- 'total_pages' => 1,
32
- 'total_entries' => 1
33
- }
34
- end
35
-
36
- context 'list_merchants endpoints' do
37
- let(:list_merchants_response) do
38
- {
39
- 'merchants' => [merchant_attributes],
40
- 'pagination' => pagination_attributes
41
- }
42
- end
43
-
44
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_merchants_response) }
45
-
46
- describe 'list_merchants' do
47
- it 'returns a list of merchants' do
48
- response = described_class.list_merchants
49
-
50
- expect(response).to be_kind_of(::MXPlatformRuby::Page)
51
- expect(response.first).to be_kind_of(::MXPlatformRuby::Merchant)
52
- expect(response.first.created_at).to eq(merchant_attributes[:created_at])
53
- expect(response.first.guid).to eq(merchant_attributes[:guid])
54
- expect(response.first.logo_url).to eq(merchant_attributes[:logo_url])
55
- expect(response.first.name).to eq(merchant_attributes[:name])
56
- expect(response.first.updated_at).to eq(merchant_attributes[:updated_at])
57
- expect(response.first.website_url).to eq(merchant_attributes[:website_url])
58
- expect(response.length).to eq(1)
59
- end
60
- end
61
- end
62
-
63
- describe 'read_merchant' do
64
- let(:read_merchant_response) { { 'merchant' => merchant_attributes } }
65
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(read_merchant_response) }
66
-
67
- it 'returns merchant' do
68
- response = described_class.read_merchant
69
-
70
- expect(response).to be_kind_of(::MXPlatformRuby::Merchant)
71
- expect(response.created_at).to eq(merchant_attributes[:created_at])
72
- expect(response.guid).to eq(merchant_attributes[:guid])
73
- expect(response.logo_url).to eq(merchant_attributes[:logo_url])
74
- expect(response.name).to eq(merchant_attributes[:name])
75
- expect(response.updated_at).to eq(merchant_attributes[:updated_at])
76
- expect(response.website_url).to eq(merchant_attributes[:website_url])
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: '/merchants/MCH-7ed79542-884d-2b1b-dd74-501c5cc9d25b',
83
- http_method: :get
84
- }
85
- )
86
- described_class.read_merchant(read_merchant_options)
87
- end
88
- end
89
- end
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe ::MXPlatformRuby::OAuthWindow do
6
- let(:oauth_window_attributes) do
7
- {
8
- guid: 'MBR-df96fd60-7122-4464-b3c2-ff11d8c74f6f',
9
- oauth_window_uri: 'int-widgets.moneydesktop.com/oauth/predirect_to/MBR-df96fd60-7122-4464-b3c2-ff11d8c74f6f/zgknnw5k7dmztn2njmwlgz574mZlnft6vdrv7kzn9ptj325th6c5p0w6c7j83Ap1bqg01mhsr1bqjgf2fry3ly9wff497c6fcczbyrfgj7s39cygw95Akl7vlpmcAy2kmvh1mlkytg7jA1z3vnw1w3zx2r1wt65s6f6r3ryqqrysl9qA1kr6cAj6vhr1zl325Azz6hx52j1ll3vwbvvbv5xzy7d6csplyw25brA7147vAfq29ArjjAj4qmc6r6h457hkcj2946m0kjp2xzpkz6hz55lsp3Avmdb8dsq4xzqmzzqk68s6bp5tj9jsskw4wvcb95vm4fwh9w8phgp67hfj2flrtwcy5bxbtk74?skip_aggregation=false'
10
- }
11
- end
12
- let(:request_oauth_window_options) do
13
- {
14
- member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
15
- referral_source: 'APP',
16
- ui_message_webview_url_scheme: 'mx',
17
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
18
- }
19
- end
20
-
21
- describe 'request_oauth_window' do
22
- let(:request_oauth_window_response) { { 'member' => oauth_window_attributes } }
23
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(request_oauth_window_response) }
24
-
25
- it 'returns oauth_window' do
26
- response = described_class.request_oauth_window
27
-
28
- expect(response).to be_kind_of(::MXPlatformRuby::OAuthWindow)
29
- expect(response.guid).to eq(oauth_window_attributes[:guid])
30
- expect(response.oauth_window_uri).to eq(oauth_window_attributes[:oauth_window_uri])
31
- end
32
-
33
- it 'makes a client request with the expected params' do
34
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
35
- {
36
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/members/MBR-7c6f361b-e582-15b6-60c0-358f12466b4b/oauth_window_uri',
37
- http_method: :get,
38
- query_params: {
39
- referral_source: 'APP',
40
- ui_message_webview_url_scheme: 'mx'
41
- }.compact
42
- }
43
- )
44
- described_class.request_oauth_window(request_oauth_window_options)
45
- end
46
- end
47
- end
@@ -1,75 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- class Record
6
- extend ::MXPlatformRuby::Pageable
7
- include ::ActiveAttr::Model
8
- attribute :record_attribute
9
- end
10
-
11
- RSpec.describe ::MXPlatformRuby::Pageable do
12
- subject { ::Record }
13
-
14
- let(:accept_header) { { 'Accept' => 'application/json' } }
15
- let(:empty_response) do
16
- {
17
- 'records' => [],
18
- 'pagination' => {
19
- 'current_page' => 1,
20
- 'per_page' => per_page,
21
- 'total_entries' => 0,
22
- 'total_pages' => 1
23
- }
24
- }
25
- end
26
- let(:first) { 1 }
27
- let(:first_page) { ::MXPlatformRuby::Page.new(2, record) }
28
- let(:first_page_response) do
29
- {
30
- 'records' => ::Array.new(2, record_response),
31
- 'pagination' => {
32
- 'current_page' => first,
33
- 'per_page' => per_page,
34
- 'total_entries' => total_entries,
35
- 'total_pages' => total_pages
36
- }
37
- }
38
- end
39
- let(:options) do
40
- {
41
- accept_header: 'application/json',
42
- endpoint: '/records',
43
- resource: 'records'
44
- }
45
- end
46
- let(:record) { ::Record.new('record_attribute' => 'record_value') }
47
- let(:record_response) { { 'record_attribute' => 'record_value' } }
48
- let(:per_page) { 2 }
49
- let(:total_entries) { 3 }
50
- let(:total_pages) { 2 }
51
-
52
- before do
53
- allow(::MXPlatformRuby.client).to receive(:make_request).with({ accept_header: 'application/json', endpoint: '/records', resource: 'records' })
54
- .and_return(first_page_response)
55
- end
56
-
57
- describe '.paginate' do
58
- it 'returns the first Page' do
59
- page = subject.paginate(options)
60
- expect(page).to eq(first_page)
61
- expect(page.current_page).to eq(first)
62
- expect(page.per_page).to eq(per_page)
63
- expect(page.total_entries).to eq(total_entries)
64
- expect(page.total_pages).to eq(total_pages)
65
- end
66
-
67
- context 'with no results' do
68
- it 'returns an empty Page' do
69
- allow(::MXPlatformRuby.client).to receive(:make_request).and_return(empty_response)
70
- page = subject.paginate(options)
71
- expect(page).to eq(::MXPlatformRuby::Page.new)
72
- end
73
- end
74
- end
75
- end
@@ -1,130 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe ::MXPlatformRuby::Statement do
6
- let(:statement_attributes) do
7
- {
8
- account_guid: 'ACT-06d7f44b-caae-0f6e-1384-01f52e75dcb1',
9
- content_hash: 'ca53785b812d00ef821c3d94bfd6e5bbc0020504410589b7ea8552169f021981',
10
- created_at: '2016-10-13T18:08:00+00:00',
11
- guid: 'STA-737a344b-caae-0f6e-1384-01f52e75dcb1',
12
- member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
13
- updated_at: '2016-10-13T18:09:00+00:00',
14
- uri: 'uri/to/statement',
15
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
16
- }
17
- end
18
- let(:download_statement_pdf_options) do
19
- {
20
- member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
21
- statement_guid: 'STA-737a344b-caae-0f6e-1384-01f52e75dcb1',
22
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
23
- }
24
- end
25
- let(:list_statements_by_member_options) do
26
- {
27
- member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
28
- page: 1,
29
- records_per_page: 10,
30
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
31
- }
32
- end
33
- let(:read_statement_by_member_options) do
34
- {
35
- member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
36
- statement_guid: 'STA-737a344b-caae-0f6e-1384-01f52e75dcb1',
37
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
38
- }
39
- end
40
- let(:pagination_attributes) do
41
- {
42
- 'current_page' => 1,
43
- 'per_page' => 25,
44
- 'total_pages' => 1,
45
- 'total_entries' => 1
46
- }
47
- end
48
-
49
- describe 'download_statement_pdf' do
50
- let(:statement_file) { ::Tempfile.new('spec/sample.pdf') }
51
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(statement_file) }
52
-
53
- it 'returns statement file' do
54
- response = described_class.download_statement_pdf
55
-
56
- expect(response).to be(statement_file)
57
- end
58
-
59
- it 'makes a client request with the expected params' do
60
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
61
- {
62
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/members/MBR-7c6f361b-e582-15b6-60c0-358f12466b4b/statements/STA-737a344b-caae-0f6e-1384-01f52e75dcb1.pdf',
63
- headers: {
64
- 'Accept': 'application/vnd.mx.api.v1+pdf'
65
- },
66
- http_method: :get
67
- }
68
- )
69
- described_class.download_statement_pdf(download_statement_pdf_options)
70
- end
71
- end
72
-
73
- context 'list_statements_by_member endpoints' do
74
- let(:list_statements_by_member_response) do
75
- {
76
- 'statements' => [statement_attributes],
77
- 'pagination' => pagination_attributes
78
- }
79
- end
80
-
81
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_statements_by_member_response) }
82
-
83
- describe 'list_statements_by_member' do
84
- it 'returns a list of statements' do
85
- response = described_class.list_statements_by_member
86
-
87
- expect(response).to be_kind_of(::MXPlatformRuby::Page)
88
- expect(response.first).to be_kind_of(::MXPlatformRuby::Statement)
89
- expect(response.first.account_guid).to eq(statement_attributes[:account_guid])
90
- expect(response.first.content_hash).to eq(statement_attributes[:content_hash])
91
- expect(response.first.created_at).to eq(statement_attributes[:created_at])
92
- expect(response.first.guid).to eq(statement_attributes[:guid])
93
- expect(response.first.member_guid).to eq(statement_attributes[:member_guid])
94
- expect(response.first.updated_at).to eq(statement_attributes[:updated_at])
95
- expect(response.first.uri).to eq(statement_attributes[:uri])
96
- expect(response.first.user_guid).to eq(statement_attributes[:user_guid])
97
- expect(response.length).to eq(1)
98
- end
99
- end
100
- end
101
-
102
- describe 'read_statement_by_member' do
103
- let(:read_statement_by_member_response) { { 'statement' => statement_attributes } }
104
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(read_statement_by_member_response) }
105
-
106
- it 'returns statement' do
107
- response = described_class.read_statement_by_member
108
-
109
- expect(response).to be_kind_of(::MXPlatformRuby::Statement)
110
- expect(response.account_guid).to eq(statement_attributes[:account_guid])
111
- expect(response.content_hash).to eq(statement_attributes[:content_hash])
112
- expect(response.created_at).to eq(statement_attributes[:created_at])
113
- expect(response.guid).to eq(statement_attributes[:guid])
114
- expect(response.member_guid).to eq(statement_attributes[:member_guid])
115
- expect(response.updated_at).to eq(statement_attributes[:updated_at])
116
- expect(response.uri).to eq(statement_attributes[:uri])
117
- expect(response.user_guid).to eq(statement_attributes[:user_guid])
118
- end
119
-
120
- it 'makes a client request with the expected params' do
121
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
122
- {
123
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/members/MBR-7c6f361b-e582-15b6-60c0-358f12466b4b/statements/STA-737a344b-caae-0f6e-1384-01f52e75dcb1',
124
- http_method: :get
125
- }
126
- )
127
- described_class.read_statement_by_member(read_statement_by_member_options)
128
- end
129
- end
130
- end
@@ -1,179 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe ::MXPlatformRuby::Tag do
6
- let(:tag_attributes) do
7
- {
8
- guid: 'TAG-aef36e72-6294-4c38-844d-e573e80aed52',
9
- name: 'MY TAG',
10
- user_guid: 'USR-11141024-90b3-1bce-cac9-c06ced52ab4c'
11
- }
12
- end
13
- let(:create_tag_options) do
14
- {
15
- name: 'MY TAG',
16
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
17
- }
18
- end
19
- let(:delete_tag_options) do
20
- {
21
- tag_guid: 'TAG-aef36e72-6294-4c38-844d-e573e80aed52',
22
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
23
- }
24
- end
25
- let(:list_tags_options) do
26
- {
27
- page: 1,
28
- records_per_page: 10,
29
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
30
- }
31
- end
32
- let(:read_tag_options) do
33
- {
34
- tag_guid: 'TAG-aef36e72-6294-4c38-844d-e573e80aed52',
35
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
36
- }
37
- end
38
- let(:update_tag_options) do
39
- {
40
- name: 'MY TAG',
41
- tag_guid: 'TAG-aef36e72-6294-4c38-844d-e573e80aed52',
42
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
43
- }
44
- end
45
- let(:pagination_attributes) do
46
- {
47
- 'current_page' => 1,
48
- 'per_page' => 25,
49
- 'total_pages' => 1,
50
- 'total_entries' => 1
51
- }
52
- end
53
-
54
- describe 'create_tag' do
55
- let(:create_tag_response) { { 'tag' => tag_attributes } }
56
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(create_tag_response) }
57
-
58
- it 'returns tag' do
59
- response = described_class.create_tag
60
-
61
- expect(response).to be_kind_of(::MXPlatformRuby::Tag)
62
- expect(response.guid).to eq(tag_attributes[:guid])
63
- expect(response.name).to eq(tag_attributes[:name])
64
- expect(response.user_guid).to eq(tag_attributes[:user_guid])
65
- end
66
-
67
- it 'makes a client request with the expected params' do
68
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
69
- {
70
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/tags',
71
- http_method: :post,
72
- request_body: {
73
- tag: {
74
- name: 'MY TAG'
75
- }
76
- }
77
- }
78
- )
79
- described_class.create_tag(create_tag_options)
80
- end
81
- end
82
-
83
- describe 'delete_tag' do
84
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(nil) }
85
-
86
- it 'returns nil' do
87
- response = described_class.delete_tag
88
-
89
- expect(response).to be(nil)
90
- end
91
-
92
- it 'makes a client request with the expected params' do
93
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
94
- {
95
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/tags/TAG-aef36e72-6294-4c38-844d-e573e80aed52',
96
- http_method: :delete
97
- }
98
- )
99
- described_class.delete_tag(delete_tag_options)
100
- end
101
- end
102
-
103
- context 'list_tags endpoints' do
104
- let(:list_tags_response) do
105
- {
106
- 'tags' => [tag_attributes],
107
- 'pagination' => pagination_attributes
108
- }
109
- end
110
-
111
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_tags_response) }
112
-
113
- describe 'list_tags' do
114
- it 'returns a list of tags' do
115
- response = described_class.list_tags
116
-
117
- expect(response).to be_kind_of(::MXPlatformRuby::Page)
118
- expect(response.first).to be_kind_of(::MXPlatformRuby::Tag)
119
- expect(response.first.guid).to eq(tag_attributes[:guid])
120
- expect(response.first.name).to eq(tag_attributes[:name])
121
- expect(response.first.user_guid).to eq(tag_attributes[:user_guid])
122
- expect(response.length).to eq(1)
123
- end
124
- end
125
- end
126
-
127
- describe 'read_tag' do
128
- let(:read_tag_response) { { 'tag' => tag_attributes } }
129
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(read_tag_response) }
130
-
131
- it 'returns tag' do
132
- response = described_class.read_tag
133
-
134
- expect(response).to be_kind_of(::MXPlatformRuby::Tag)
135
- expect(response.guid).to eq(tag_attributes[:guid])
136
- expect(response.name).to eq(tag_attributes[:name])
137
- expect(response.user_guid).to eq(tag_attributes[:user_guid])
138
- end
139
-
140
- it 'makes a client request with the expected params' do
141
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
142
- {
143
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/tags/TAG-aef36e72-6294-4c38-844d-e573e80aed52',
144
- http_method: :get
145
- }
146
- )
147
- described_class.read_tag(read_tag_options)
148
- end
149
- end
150
-
151
- describe 'update_tag' do
152
- let(:update_tag_response) { { 'tag' => tag_attributes } }
153
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(update_tag_response) }
154
-
155
- it 'returns tag' do
156
- response = described_class.update_tag
157
-
158
- expect(response).to be_kind_of(::MXPlatformRuby::Tag)
159
- expect(response.guid).to eq(tag_attributes[:guid])
160
- expect(response.name).to eq(tag_attributes[:name])
161
- expect(response.user_guid).to eq(tag_attributes[:user_guid])
162
- end
163
-
164
- it 'makes a client request with the expected params' do
165
- expect(::MXPlatformRuby.client).to receive(:make_request).with(
166
- {
167
- endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/tags/TAG-aef36e72-6294-4c38-844d-e573e80aed52',
168
- http_method: :put,
169
- request_body: {
170
- tag: {
171
- name: 'MY TAG'
172
- }
173
- }
174
- }
175
- )
176
- described_class.update_tag(update_tag_options)
177
- end
178
- end
179
- end