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,112 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module MXPlatformRuby
4
- class TransactionRule
5
- extend ::MXPlatformRuby::Pageable
6
- include ::ActiveAttr::Model
7
-
8
- attribute :category_guid
9
- attribute :created_at
10
- attribute :description
11
- attribute :guid
12
- attribute :match_description
13
- attribute :updated_at
14
- attribute :user_guid
15
-
16
- def self.create_transaction_rule(options = {})
17
- create_transaction_rule_options = create_transaction_rule_options(options)
18
- response = ::MXPlatformRuby.client.make_request(create_transaction_rule_options)
19
-
20
- transaction_rule_params = response['transaction_rule']
21
- ::MXPlatformRuby::TransactionRule.new(transaction_rule_params)
22
- end
23
-
24
- def self.delete_transaction_rule(options = {})
25
- delete_transaction_rule_options = delete_transaction_rule_options(options)
26
- ::MXPlatformRuby.client.make_request(delete_transaction_rule_options)
27
- end
28
-
29
- def self.list_transaction_rules_by_user(options = {})
30
- options = list_transaction_rules_by_user_options(options)
31
-
32
- paginate(options)
33
- end
34
-
35
- def self.read_transaction_rule(options = {})
36
- read_transaction_rule_options = read_transaction_rule_options(options)
37
- response = ::MXPlatformRuby.client.make_request(read_transaction_rule_options)
38
-
39
- transaction_rule_params = response['transaction_rule']
40
- ::MXPlatformRuby::TransactionRule.new(transaction_rule_params)
41
- end
42
-
43
- def self.update_transaction_rule(options = {})
44
- update_transaction_rule_options = update_transaction_rule_options(options)
45
- response = ::MXPlatformRuby.client.make_request(update_transaction_rule_options)
46
-
47
- transaction_rule_params = response['transaction_rule']
48
- ::MXPlatformRuby::TransactionRule.new(transaction_rule_params)
49
- end
50
-
51
- # Private class methods
52
-
53
- def self.create_transaction_rule_options(options)
54
- {
55
- endpoint: "/users/#{options[:user_guid]}/transaction_rules",
56
- http_method: :post,
57
- request_body: {
58
- transaction_rule: {
59
- category_guid: options[:category_guid],
60
- description: options[:description],
61
- match_description: options[:match_description]
62
- }.compact
63
- }
64
- }
65
- end
66
- private_class_method :create_transaction_rule_options
67
-
68
- def self.delete_transaction_rule_options(options)
69
- {
70
- endpoint: "/users/#{options[:user_guid]}/transaction_rules/#{options[:transaction_rule_guid]}",
71
- http_method: :delete
72
- }
73
- end
74
- private_class_method :delete_transaction_rule_options
75
-
76
- def self.list_transaction_rules_by_user_options(options)
77
- {
78
- endpoint: "/users/#{options[:user_guid]}/transaction_rules",
79
- http_method: :get,
80
- query_params: {
81
- page: options[:page],
82
- records_per_page: options[:records_per_page]
83
- }.compact,
84
- resource: 'transaction_rules'
85
- }
86
- end
87
- private_class_method :list_transaction_rules_by_user_options
88
-
89
- def self.read_transaction_rule_options(options)
90
- {
91
- endpoint: "/users/#{options[:user_guid]}/transaction_rules/#{options[:transaction_rule_guid]}",
92
- http_method: :get
93
- }
94
- end
95
- private_class_method :read_transaction_rule_options
96
-
97
- def self.update_transaction_rule_options(options)
98
- {
99
- endpoint: "/users/#{options[:user_guid]}/transaction_rules/#{options[:transaction_rule_guid]}",
100
- http_method: :put,
101
- request_body: {
102
- transaction_rule: {
103
- category_guid: options[:category_guid],
104
- description: options[:description],
105
- match_description: options[:match_description]
106
- }.compact
107
- }
108
- }
109
- end
110
- private_class_method :update_transaction_rule_options
111
- end
112
- end
@@ -1,112 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module MXPlatformRuby
4
- class User
5
- extend ::MXPlatformRuby::Pageable
6
- include ::ActiveAttr::Model
7
-
8
- attribute :email
9
- attribute :guid
10
- attribute :id
11
- attribute :is_disabled
12
- attribute :metadata
13
-
14
- def self.create_user(options = {})
15
- create_user_options = create_user_options(options)
16
- response = ::MXPlatformRuby.client.make_request(create_user_options)
17
-
18
- user_params = response['user']
19
- ::MXPlatformRuby::User.new(user_params)
20
- end
21
-
22
- def self.delete_user(options = {})
23
- delete_user_options = delete_user_options(options)
24
- ::MXPlatformRuby.client.make_request(delete_user_options)
25
- end
26
-
27
- def self.list_users(options = {})
28
- options = list_users_options(options)
29
-
30
- paginate(options)
31
- end
32
-
33
- def self.read_user(options = {})
34
- read_user_options = read_user_options(options)
35
- response = ::MXPlatformRuby.client.make_request(read_user_options)
36
-
37
- user_params = response['user']
38
- ::MXPlatformRuby::User.new(user_params)
39
- end
40
-
41
- def self.update_user(options = {})
42
- update_user_options = update_user_options(options)
43
- response = ::MXPlatformRuby.client.make_request(update_user_options)
44
-
45
- user_params = response['user']
46
- ::MXPlatformRuby::User.new(user_params)
47
- end
48
-
49
- # Private class methods
50
-
51
- def self.create_user_options(options)
52
- {
53
- endpoint: '/users',
54
- http_method: :post,
55
- request_body: {
56
- user: {
57
- email: options[:email],
58
- id: options[:id],
59
- is_disabled: options[:is_disabled],
60
- metadata: options[:metadata]
61
- }.compact
62
- }
63
- }
64
- end
65
- private_class_method :create_user_options
66
-
67
- def self.delete_user_options(options)
68
- {
69
- endpoint: "/users/#{options[:user_guid]}",
70
- http_method: :delete
71
- }
72
- end
73
- private_class_method :delete_user_options
74
-
75
- def self.list_users_options(options)
76
- {
77
- endpoint: '/users',
78
- http_method: :get,
79
- query_params: {
80
- page: options[:page],
81
- records_per_page: options[:records_per_page]
82
- }.compact,
83
- resource: 'users'
84
- }
85
- end
86
- private_class_method :list_users_options
87
-
88
- def self.read_user_options(options)
89
- {
90
- endpoint: "/users/#{options[:user_guid]}",
91
- http_method: :get
92
- }
93
- end
94
- private_class_method :read_user_options
95
-
96
- def self.update_user_options(options)
97
- {
98
- endpoint: "/users/#{options[:user_guid]}",
99
- http_method: :put,
100
- request_body: {
101
- user: {
102
- email: options[:email],
103
- id: options[:id],
104
- is_disabled: options[:is_disabled],
105
- metadata: options[:metadata]
106
- }.compact
107
- }
108
- }
109
- end
110
- private_class_method :update_user_options
111
- end
112
- end
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module MXPlatformRuby
4
- class Widget
5
- include ::ActiveAttr::Model
6
-
7
- attribute :type
8
- attribute :url
9
- attribute :user_id
10
-
11
- def self.request_widget_url(options = {})
12
- request_widget_url_options = request_widget_url_options(options)
13
- response = ::MXPlatformRuby.client.make_request(request_widget_url_options)
14
-
15
- widget_url_params = response['widget_url']
16
- ::MXPlatformRuby::Widget.new(widget_url_params)
17
- end
18
-
19
- # Private class methods
20
-
21
- def self.request_widget_url_options(options)
22
- {
23
- endpoint: "/users/#{options[:user_guid]}/widget_urls",
24
- headers: {
25
- 'Accept-Language': options[:accept_language]
26
- }.compact,
27
- http_method: :post,
28
- request_body: {
29
- widget_url: {
30
- color_scheme: options[:color_scheme],
31
- current_institution_code: options[:current_institution_code],
32
- current_institution_guid: options[:current_institution_guid],
33
- current_member_guid: options[:current_member_guid],
34
- disable_institution_search: options[:disable_institution_search],
35
- include_transactions: options[:include_transactions],
36
- is_mobile_webview: options[:is_mobile_webview],
37
- mode: options[:mode],
38
- ui_message_version: options[:ui_message_version],
39
- ui_message_webview_url_scheme: options[:ui_message_webview_url_scheme],
40
- update_credentials: options[:update_credentials],
41
- wait_for_full_aggregation: options[:wait_for_full_aggregation],
42
- widget_type: options[:widget_type]
43
- }.compact
44
- }
45
- }
46
- end
47
- private_class_method :request_widget_url_options
48
- end
49
- end
@@ -1,100 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe ::MXPlatformRuby::AccountNumber do
6
- let(:account_number_attributes) do
7
- {
8
- account_guid: 'ACT-06d7f44b-caae-0f6e-1384-01f52e75dcb1',
9
- account_number: '10001',
10
- guid: 'ACN-8899832e-e5b4-42cd-aa25-bbf1dc889a8f',
11
- institution_number: '123',
12
- member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
13
- routing_number: '68899990000000',
14
- transit_number: '12345',
15
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
16
- }
17
- end
18
- let(:list_account_numbers_by_account_options) do
19
- {
20
- account_guid: 'ACT-06d7f44b-caae-0f6e-1384-01f52e75dcb1',
21
- page: 1,
22
- records_per_page: 10,
23
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
24
- }
25
- end
26
- let(:list_account_numbers_by_member_options) do
27
- {
28
- member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
29
- page: 1,
30
- records_per_page: 10,
31
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
32
- }
33
- end
34
- let(:pagination_attributes) do
35
- {
36
- 'current_page' => 1,
37
- 'per_page' => 25,
38
- 'total_pages' => 1,
39
- 'total_entries' => 1
40
- }
41
- end
42
-
43
- context 'list_account_numbers_by_account endpoints' do
44
- let(:list_account_numbers_by_account_response) do
45
- {
46
- 'account_numbers' => [account_number_attributes],
47
- 'pagination' => pagination_attributes
48
- }
49
- end
50
-
51
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_account_numbers_by_account_response) }
52
-
53
- describe 'list_account_numbers_by_account' do
54
- it 'returns a list of account_numbers' do
55
- response = described_class.list_account_numbers_by_account
56
-
57
- expect(response).to be_kind_of(::MXPlatformRuby::Page)
58
- expect(response.first).to be_kind_of(::MXPlatformRuby::AccountNumber)
59
- expect(response.first.account_guid).to eq(account_number_attributes[:account_guid])
60
- expect(response.first.account_number).to eq(account_number_attributes[:account_number])
61
- expect(response.first.guid).to eq(account_number_attributes[:guid])
62
- expect(response.first.institution_number).to eq(account_number_attributes[:institution_number])
63
- expect(response.first.member_guid).to eq(account_number_attributes[:member_guid])
64
- expect(response.first.routing_number).to eq(account_number_attributes[:routing_number])
65
- expect(response.first.transit_number).to eq(account_number_attributes[:transit_number])
66
- expect(response.first.user_guid).to eq(account_number_attributes[:user_guid])
67
- expect(response.length).to eq(1)
68
- end
69
- end
70
- end
71
-
72
- context 'list_account_numbers_by_member endpoints' do
73
- let(:list_account_numbers_by_member_response) do
74
- {
75
- 'account_numbers' => [account_number_attributes],
76
- 'pagination' => pagination_attributes
77
- }
78
- end
79
-
80
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_account_numbers_by_member_response) }
81
-
82
- describe 'list_account_numbers_by_member' do
83
- it 'returns a list of account_numbers' do
84
- response = described_class.list_account_numbers_by_member
85
-
86
- expect(response).to be_kind_of(::MXPlatformRuby::Page)
87
- expect(response.first).to be_kind_of(::MXPlatformRuby::AccountNumber)
88
- expect(response.first.account_guid).to eq(account_number_attributes[:account_guid])
89
- expect(response.first.account_number).to eq(account_number_attributes[:account_number])
90
- expect(response.first.guid).to eq(account_number_attributes[:guid])
91
- expect(response.first.institution_number).to eq(account_number_attributes[:institution_number])
92
- expect(response.first.member_guid).to eq(account_number_attributes[:member_guid])
93
- expect(response.first.routing_number).to eq(account_number_attributes[:routing_number])
94
- expect(response.first.transit_number).to eq(account_number_attributes[:transit_number])
95
- expect(response.first.user_guid).to eq(account_number_attributes[:user_guid])
96
- expect(response.length).to eq(1)
97
- end
98
- end
99
- end
100
- end
@@ -1,71 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe ::MXPlatformRuby::AccountOwner do
6
- let(:account_owner_attributes) do
7
- {
8
- account_guid: 'ACT-06d7f44b-caae-0f6e-1384-01f52e75dcb1',
9
- address: '123 This Way',
10
- city: 'Middlesex',
11
- country: 'US',
12
- email: 'donnie@darko.co',
13
- guid: 'ACO-63dc7714-6fc0-4aa2-a069-c06cdccd1af9',
14
- member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
15
- owner_name: 'Donnie Darko',
16
- phone: '555-555-5555',
17
- postal_code: '00000-0000',
18
- state: 'VA',
19
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
20
- }
21
- end
22
- let(:list_account_owners_options) do
23
- {
24
- member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
25
- page: 1,
26
- records_per_page: 10,
27
- user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
28
- }
29
- end
30
- let(:pagination_attributes) do
31
- {
32
- 'current_page' => 1,
33
- 'per_page' => 25,
34
- 'total_pages' => 1,
35
- 'total_entries' => 1
36
- }
37
- end
38
-
39
- context 'list_account_owners endpoints' do
40
- let(:list_account_owners_response) do
41
- {
42
- 'account_owners' => [account_owner_attributes],
43
- 'pagination' => pagination_attributes
44
- }
45
- end
46
-
47
- before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_account_owners_response) }
48
-
49
- describe 'list_account_owners' do
50
- it 'returns a list of account_owners' do
51
- response = described_class.list_account_owners
52
-
53
- expect(response).to be_kind_of(::MXPlatformRuby::Page)
54
- expect(response.first).to be_kind_of(::MXPlatformRuby::AccountOwner)
55
- expect(response.first.account_guid).to eq(account_owner_attributes[:account_guid])
56
- expect(response.first.address).to eq(account_owner_attributes[:address])
57
- expect(response.first.city).to eq(account_owner_attributes[:city])
58
- expect(response.first.country).to eq(account_owner_attributes[:country])
59
- expect(response.first.email).to eq(account_owner_attributes[:email])
60
- expect(response.first.guid).to eq(account_owner_attributes[:guid])
61
- expect(response.first.member_guid).to eq(account_owner_attributes[:member_guid])
62
- expect(response.first.owner_name).to eq(account_owner_attributes[:owner_name])
63
- expect(response.first.phone).to eq(account_owner_attributes[:phone])
64
- expect(response.first.postal_code).to eq(account_owner_attributes[:postal_code])
65
- expect(response.first.state).to eq(account_owner_attributes[:state])
66
- expect(response.first.user_guid).to eq(account_owner_attributes[:user_guid])
67
- expect(response.length).to eq(1)
68
- end
69
- end
70
- end
71
- end