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,59 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module MXPlatformRuby
4
- class Client
5
- BASE_URL = 'https://int-api.mx.com'
6
-
7
- attr_accessor :base_url, :password, :username
8
-
9
- def initialize(base_url = BASE_URL, password = nil, username = nil)
10
- @base_url = base_url
11
- @password = password
12
- @username = username
13
- end
14
-
15
- def http_client
16
- @http_client ||= ::HTTPClient.new
17
- end
18
-
19
- def make_request(options = {})
20
- body = ::JSON.dump(options[:request_body]) if options[:request_body]
21
- headers = default_headers.merge(options[:headers] || {})
22
- url = "#{base_url}#{options[:endpoint]}"
23
- url = "#{url}?#{::URI.encode_www_form(options[:query_params])}" if options[:query_params]
24
- method = options[:http_method]
25
-
26
- response = http_client.public_send(method, url, body, headers)
27
-
28
- handle_response(response)
29
- end
30
-
31
- private
32
-
33
- def default_headers
34
- {
35
- 'Accept': 'application/vnd.mx.api.v1+json',
36
- 'Authorization': "Basic #{::Base64.urlsafe_encode64("#{username}:#{password}")}",
37
- 'Content-Type': 'application/json'
38
- }
39
- end
40
-
41
- def format_response_body(body)
42
- ::JSON.parse(body)
43
- rescue JSON::ParserError
44
- file = ::Tempfile.new
45
- file.write(body)
46
- file.close
47
- file
48
- end
49
-
50
- def handle_response(response)
51
- # Handle 200-206 responses as acceptable
52
- raise ::MXPlatformRuby::Error, "#{response.status}: #{response.body}" unless response.status.between?(200, 206)
53
-
54
- return if response.body.empty?
55
-
56
- format_response_body(response.body)
57
- end
58
- end
59
- end
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module MXPlatformRuby
4
- class ConnectWidget
5
- include ::ActiveAttr::Model
6
-
7
- attribute :connect_widget_url
8
- attribute :guid
9
-
10
- def self.request_connect_widget_url(options = {})
11
- request_connect_widget_url_options = request_connect_widget_url_options(options)
12
- response = ::MXPlatformRuby.client.make_request(request_connect_widget_url_options)
13
-
14
- user_params = response['user']
15
- ::MXPlatformRuby::ConnectWidget.new(user_params)
16
- end
17
-
18
- # Private class methods
19
-
20
- def self.request_connect_widget_url_options(options)
21
- {
22
- endpoint: "/users/#{options[:user_guid]}/connect_widget_url",
23
- http_method: :post,
24
- request_body: {
25
- config: {
26
- color_scheme: options[:color_scheme],
27
- current_institution_code: options[:current_institution_code],
28
- current_member_guid: options[:current_member_guid],
29
- disable_institution_search: options[:disable_institution_search],
30
- include_transactions: options[:include_transactions],
31
- is_mobile_webview: options[:is_mobile_webview],
32
- mode: options[:mode],
33
- ui_message_version: options[:ui_message_version],
34
- ui_message_webview_url_scheme: options[:ui_message_webview_url_scheme],
35
- update_credentials: options[:update_credentials],
36
- wait_for_full_aggregation: options[:wait_for_full_aggregation]
37
- }.compact
38
- }
39
- }
40
- end
41
- private_class_method :request_connect_widget_url_options
42
- end
43
- end
@@ -1,54 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module MXPlatformRuby
4
- class Credential
5
- extend ::MXPlatformRuby::Pageable
6
- include ::ActiveAttr::Model
7
-
8
- attribute :display_order
9
- attribute :field_name
10
- attribute :field_type
11
- attribute :guid
12
- attribute :label
13
-
14
- def self.list_institution_required_credentials(options = {})
15
- options = list_institution_required_credentials_options(options)
16
-
17
- paginate(options)
18
- end
19
-
20
- def self.list_member_credentials(options = {})
21
- options = list_member_credentials_options(options)
22
-
23
- paginate(options)
24
- end
25
-
26
- # Private class methods
27
-
28
- def self.list_institution_required_credentials_options(options)
29
- {
30
- endpoint: "/institutions/#{options[:institution_code]}/credentials",
31
- http_method: :get,
32
- query_params: {
33
- page: options[:page],
34
- records_per_page: options[:records_per_page]
35
- }.compact,
36
- resource: 'credentials'
37
- }
38
- end
39
- private_class_method :list_institution_required_credentials_options
40
-
41
- def self.list_member_credentials_options(options)
42
- {
43
- endpoint: "/users/#{options[:user_guid]}/members/#{options[:member_guid]}/credentials",
44
- http_method: :get,
45
- query_params: {
46
- page: options[:page],
47
- records_per_page: options[:records_per_page]
48
- }.compact,
49
- resource: 'credentials'
50
- }
51
- end
52
- private_class_method :list_member_credentials_options
53
- end
54
- end
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module MXPlatformRuby
4
- class EnhancedTransaction
5
- include ::ActiveAttr::Model
6
-
7
- attribute :amount
8
- attribute :category
9
- attribute :description
10
- attribute :id
11
- attribute :is_bill_pay
12
- attribute :is_direct_deposit
13
- attribute :is_expense
14
- attribute :is_fee
15
- attribute :is_income
16
- attribute :is_international
17
- attribute :is_overdraft_fee
18
- attribute :is_payroll_advance
19
- attribute :merchant_category_code
20
- attribute :merchant_guid
21
- attribute :original_description
22
- attribute :type
23
-
24
- def self.enhance_transactions(options = {})
25
- enhance_transactions_options = enhance_transactions_options(options)
26
- response = ::MXPlatformRuby.client.make_request(enhance_transactions_options)
27
-
28
- response['transactions'].map { |attributes| ::MXPlatformRuby::EnhancedTransaction.new(attributes) }
29
- end
30
-
31
- # Private class methods
32
-
33
- def self.enhance_transactions_options(options)
34
- {
35
- endpoint: '/transactions/enhance',
36
- http_method: :post,
37
- request_body: {
38
- transactions: options[:transactions]
39
- }.compact
40
- }
41
- end
42
- private_class_method :enhance_transactions_options
43
- end
44
- end
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module MXPlatformRuby
4
- class Error < StandardError
5
- end
6
- end
@@ -1,87 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module MXPlatformRuby
4
- class Holding
5
- extend ::MXPlatformRuby::Pageable
6
- include ::ActiveAttr::Model
7
-
8
- attribute :account_guid
9
- attribute :cost_basis
10
- attribute :created_at
11
- attribute :currency_code
12
- attribute :cusip
13
- attribute :daily_change
14
- attribute :description
15
- attribute :guid
16
- attribute :holding_type
17
- attribute :id
18
- attribute :market_value
19
- attribute :member_guid
20
- attribute :metadata
21
- attribute :purchase_price
22
- attribute :shares
23
- attribute :symbol
24
- attribute :updated_at
25
- attribute :user_guid
26
-
27
- def self.list_holdings_by_member(options = {})
28
- options = list_holdings_by_member_options(options)
29
-
30
- paginate(options)
31
- end
32
-
33
- def self.list_holdings_by_user(options = {})
34
- options = list_holdings_by_user_options(options)
35
-
36
- paginate(options)
37
- end
38
-
39
- def self.read_holding(options = {})
40
- read_holding_options = read_holding_options(options)
41
- response = ::MXPlatformRuby.client.make_request(read_holding_options)
42
-
43
- holding_params = response['holding']
44
- ::MXPlatformRuby::Holding.new(holding_params)
45
- end
46
-
47
- # Private class methods
48
-
49
- def self.list_holdings_by_member_options(options)
50
- {
51
- endpoint: "/users/#{options[:user_guid]}/members/#{options[:member_guid]}/holdings",
52
- http_method: :get,
53
- query_params: {
54
- from_date: options[:from_date],
55
- page: options[:page],
56
- records_per_page: options[:records_per_page],
57
- to_date: options[:to_date]
58
- }.compact,
59
- resource: 'holdings'
60
- }
61
- end
62
- private_class_method :list_holdings_by_member_options
63
-
64
- def self.list_holdings_by_user_options(options)
65
- {
66
- endpoint: "/users/#{options[:user_guid]}/holdings",
67
- http_method: :get,
68
- query_params: {
69
- from_date: options[:from_date],
70
- page: options[:page],
71
- records_per_page: options[:records_per_page],
72
- to_date: options[:to_date]
73
- }.compact,
74
- resource: 'holdings'
75
- }
76
- end
77
- private_class_method :list_holdings_by_user_options
78
-
79
- def self.read_holding_options(options)
80
- {
81
- endpoint: "/users/#{options[:user_guid]}/holdings/#{options[:holding_guid]}",
82
- http_method: :get
83
- }
84
- end
85
- private_class_method :read_holding_options
86
- end
87
- end
@@ -1,78 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module MXPlatformRuby
4
- class Institution
5
- extend ::MXPlatformRuby::Pageable
6
- include ::ActiveAttr::Model
7
-
8
- attribute :code
9
- attribute :medium_logo_url
10
- attribute :name
11
- attribute :small_logo_url
12
- attribute :supports_account_identification
13
- attribute :supports_account_statement
14
- attribute :supports_account_verification
15
- attribute :supports_oauth
16
- attribute :supports_transaction_history
17
- attribute :url
18
-
19
- def self.list_favorites(options = {})
20
- options = list_favorites_options(options)
21
-
22
- paginate(options)
23
- end
24
-
25
- def self.list_institutions(options = {})
26
- options = list_institutions_options(options)
27
-
28
- paginate(options)
29
- end
30
-
31
- def self.read_institution(options = {})
32
- read_institution_options = read_institution_options(options)
33
- response = ::MXPlatformRuby.client.make_request(read_institution_options)
34
-
35
- institution_params = response['institution']
36
- ::MXPlatformRuby::Institution.new(institution_params)
37
- end
38
-
39
- # Private class methods
40
-
41
- def self.list_favorites_options(options)
42
- {
43
- endpoint: '/institutions/favorites',
44
- http_method: :get,
45
- query_params: {
46
- page: options[:page],
47
- records_per_page: options[:records_per_page]
48
- }.compact,
49
- resource: 'institutions'
50
- }
51
- end
52
- private_class_method :list_favorites_options
53
-
54
- def self.list_institutions_options(options)
55
- {
56
- endpoint: '/institutions',
57
- http_method: :get,
58
- query_params: {
59
- name: options[:name],
60
- supports_account_identification: options[:supports_account_identification],
61
- supports_account_statement: options[:supports_account_statement],
62
- supports_account_verification: options[:supports_account_verification],
63
- supports_transaction_history: options[:supports_transaction_history]
64
- }.compact,
65
- resource: 'institutions'
66
- }
67
- end
68
- private_class_method :list_institutions_options
69
-
70
- def self.read_institution_options(options)
71
- {
72
- endpoint: "/institutions/#{options[:institution_code]}",
73
- http_method: :get
74
- }
75
- end
76
- private_class_method :read_institution_options
77
- end
78
- end
@@ -1,242 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module MXPlatformRuby
4
- class Member
5
- extend ::MXPlatformRuby::Pageable
6
- include ::ActiveAttr::Model
7
-
8
- attribute :aggregated_at
9
- attribute :connection_status
10
- attribute :guid
11
- attribute :id
12
- attribute :institution_code
13
- attribute :is_being_aggregated
14
- attribute :is_oauth
15
- attribute :metadata
16
- attribute :name
17
- attribute :oauth_window_uri
18
- attribute :successfully_aggregated_at
19
- attribute :user_guid
20
-
21
- def self.aggregate_member(options = {})
22
- aggregate_member_options = aggregate_member_options(options)
23
- response = ::MXPlatformRuby.client.make_request(aggregate_member_options)
24
-
25
- member_params = response['member']
26
- ::MXPlatformRuby::Member.new(member_params)
27
- end
28
-
29
- def self.check_balances(options = {})
30
- check_balances_options = check_balances_options(options)
31
- response = ::MXPlatformRuby.client.make_request(check_balances_options)
32
-
33
- member_params = response['member']
34
- ::MXPlatformRuby::Member.new(member_params)
35
- end
36
-
37
- def self.create_member(options = {})
38
- create_member_options = create_member_options(options)
39
- response = ::MXPlatformRuby.client.make_request(create_member_options)
40
-
41
- member_params = response['member']
42
- ::MXPlatformRuby::Member.new(member_params)
43
- end
44
-
45
- def self.delete_member(options = {})
46
- delete_member_options = delete_member_options(options)
47
- ::MXPlatformRuby.client.make_request(delete_member_options)
48
- end
49
-
50
- def self.extend_history(options = {})
51
- extend_history_options = extend_history_options(options)
52
- response = ::MXPlatformRuby.client.make_request(extend_history_options)
53
-
54
- member_params = response['member']
55
- ::MXPlatformRuby::Member.new(member_params)
56
- end
57
-
58
- def self.fetch_statements_by_member(options = {})
59
- fetch_statements_by_member_options = fetch_statements_by_member_options(options)
60
- response = ::MXPlatformRuby.client.make_request(fetch_statements_by_member_options)
61
-
62
- member_params = response['member']
63
- ::MXPlatformRuby::Member.new(member_params)
64
- end
65
-
66
- def self.identify_member(options = {})
67
- identify_member_options = identify_member_options(options)
68
- response = ::MXPlatformRuby.client.make_request(identify_member_options)
69
-
70
- member_params = response['member']
71
- ::MXPlatformRuby::Member.new(member_params)
72
- end
73
-
74
- def self.list_members(options = {})
75
- options = list_members_options(options)
76
-
77
- paginate(options)
78
- end
79
-
80
- def self.read_member(options = {})
81
- read_member_options = read_member_options(options)
82
- response = ::MXPlatformRuby.client.make_request(read_member_options)
83
-
84
- member_params = response['member']
85
- ::MXPlatformRuby::Member.new(member_params)
86
- end
87
-
88
- def self.resume_aggregation(options = {})
89
- resume_aggregation_options = resume_aggregation_options(options)
90
- response = ::MXPlatformRuby.client.make_request(resume_aggregation_options)
91
-
92
- member_params = response['member']
93
- ::MXPlatformRuby::Member.new(member_params)
94
- end
95
-
96
- def self.update_member(options = {})
97
- update_member_options = update_member_options(options)
98
- response = ::MXPlatformRuby.client.make_request(update_member_options)
99
-
100
- member_params = response['member']
101
- ::MXPlatformRuby::Member.new(member_params)
102
- end
103
-
104
- def self.verify_member(options = {})
105
- verify_member_options = verify_member_options(options)
106
- response = ::MXPlatformRuby.client.make_request(verify_member_options)
107
-
108
- member_params = response['member']
109
- ::MXPlatformRuby::Member.new(member_params)
110
- end
111
-
112
- # Private class methods
113
-
114
- def self.aggregate_member_options(options)
115
- {
116
- endpoint: "/users/#{options[:user_guid]}/members/#{options[:member_guid]}/aggregate",
117
- http_method: :post
118
- }
119
- end
120
- private_class_method :aggregate_member_options
121
-
122
- def self.check_balances_options(options)
123
- {
124
- endpoint: "/users/#{options[:user_guid]}/members/#{options[:member_guid]}/check_balance",
125
- http_method: :post
126
- }
127
- end
128
- private_class_method :check_balances_options
129
-
130
- def self.create_member_options(options)
131
- {
132
- endpoint: "/users/#{options[:user_guid]}/members",
133
- http_method: :post,
134
- request_body: {
135
- member: {
136
- background_aggregation_is_disabled: options[:background_aggregation_is_disabled],
137
- credentials: options[:credentials],
138
- id: options[:id],
139
- institution_code: options[:institution_code],
140
- is_oauth: options[:is_oauth],
141
- metadata: options[:metadata],
142
- skip_aggregation: options[:skip_aggregation]
143
- }.compact,
144
- referral_source: options[:referral_source],
145
- ui_message_webview_url_scheme: options[:ui_message_webview_url_scheme]
146
- }.compact
147
- }
148
- end
149
- private_class_method :create_member_options
150
-
151
- def self.delete_member_options(options)
152
- {
153
- endpoint: "/users/#{options[:user_guid]}/members/#{options[:member_guid]}",
154
- http_method: :delete
155
- }
156
- end
157
- private_class_method :delete_member_options
158
-
159
- def self.extend_history_options(options)
160
- {
161
- endpoint: "/users/#{options[:user_guid]}/members/#{options[:member_guid]}/extend_history",
162
- http_method: :post
163
- }
164
- end
165
- private_class_method :extend_history_options
166
-
167
- def self.fetch_statements_by_member_options(options)
168
- {
169
- endpoint: "/users/#{options[:user_guid]}/members/#{options[:member_guid]}/fetch_statements",
170
- http_method: :post
171
- }
172
- end
173
- private_class_method :fetch_statements_by_member_options
174
-
175
- def self.identify_member_options(options)
176
- {
177
- endpoint: "/users/#{options[:user_guid]}/members/#{options[:member_guid]}/identify",
178
- http_method: :post
179
- }
180
- end
181
- private_class_method :identify_member_options
182
-
183
- def self.list_members_options(options)
184
- {
185
- endpoint: "/users/#{options[:user_guid]}/members",
186
- http_method: :get,
187
- query_params: {
188
- page: options[:page],
189
- records_per_page: options[:records_per_page]
190
- }.compact,
191
- resource: 'members'
192
- }
193
- end
194
- private_class_method :list_members_options
195
-
196
- def self.read_member_options(options)
197
- {
198
- endpoint: "/users/#{options[:user_guid]}/members/#{options[:member_guid]}",
199
- http_method: :get
200
- }
201
- end
202
- private_class_method :read_member_options
203
-
204
- def self.resume_aggregation_options(options)
205
- {
206
- endpoint: "/users/#{options[:user_guid]}/members/#{options[:member_guid]}/resume",
207
- http_method: :put,
208
- request_body: {
209
- member: {
210
- challenges: options[:challenges]
211
- }.compact
212
- }
213
- }
214
- end
215
- private_class_method :resume_aggregation_options
216
-
217
- def self.update_member_options(options)
218
- {
219
- endpoint: "/users/#{options[:user_guid]}/members/#{options[:member_guid]}",
220
- http_method: :put,
221
- request_body: {
222
- member: {
223
- background_aggregation_is_disabled: options[:background_aggregation_is_disabled],
224
- credentials: options[:credentials],
225
- id: options[:id],
226
- metadata: options[:metadata],
227
- skip_aggregation: options[:skip_aggregation]
228
- }.compact
229
- }
230
- }
231
- end
232
- private_class_method :update_member_options
233
-
234
- def self.verify_member_options(options)
235
- {
236
- endpoint: "/users/#{options[:user_guid]}/members/#{options[:member_guid]}/verify",
237
- http_method: :post
238
- }
239
- end
240
- private_class_method :verify_member_options
241
- end
242
- end