Class: Synapse::User
- Inherits:
-
Object
- Object
- Synapse::User
- Defined in:
- lib/synapse_api/user.rb
Overview
Wrapper class for /users endpoints
Constant Summary collapse
- VALID_QUERY_PARAMS =
Valid optional args for #get
[:query, :page, :per_page, :type, :full_dehydrate, :ship, :force_refresh, :is_credit, :subnetid, :foreign_transaction,:amount].freeze
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#expires_in ⇒ Object
Returns the value of attribute expires_in.
-
#full_dehydrate ⇒ Object
Returns the value of attribute full_dehydrate.
-
#oauth_key ⇒ Object
Returns the value of attribute oauth_key.
-
#payload ⇒ Object
Returns the value of attribute payload.
-
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Instance Method Summary collapse
-
#ach_mfa(payload:, **options) ⇒ Synapse::Node
Submit answer to a MFA question using access token from bank login attempt Please be sure to call ach_mfa again if you have more security questions.
- #authenticate(**options) ⇒ Object
-
#cancel_transaction(node_id:, trans_id:) ⇒ Object
Cancels transaction if it has not already settled.
-
#comment_transaction(node_id:, trans_id:, payload:) ⇒ Synapse::Transaction
Adds comment to the transactions.
-
#confirm_2fa_pin(pin:, **options) ⇒ Object
Supply pin for 2FA confirmation.
-
#create_node(payload:, **options) ⇒ Synapse::Node
Creates Synapse node.
-
#create_subnet(node_id:, payload:, **options) ⇒ Synapse::Subnet
Creates subnet for a node debit card or act/rt number.
-
#create_transaction(node_id:, payload:, **options) ⇒ Synapse::Transaction
Creates a new transaction in the API belonging to the provided node.
-
#create_ubo(payload:) ⇒ Object
Allows you to upload an Ultimate Beneficial Ownership document.
- #delete_node(node_id:) ⇒ Object
-
#dispute_card_transactions(node_id:, trans_id:, payload:) ⇒ Object
Dispute a transaction for a user.
-
#dummy_transactions(node_id:, **options) ⇒ Object
Initiates dummy transactions to a node.
-
#generate_apple_pay_token(node_id:, payload:) ⇒ Object
Generate tokenized info for Apple Wallet.
-
#generate_node_statements(node_id:, payload:) ⇒ Object
Gets statement by node on demand.
-
#get_all_node_transaction(node_id:, **options) ⇒ Array<Synapse::Transaction>
Queries the API for all transactions belonging to the supplied node.
-
#get_all_subnets(node_id:, **options) ⇒ Object
Gets all node subnets.
-
#get_all_user_nodes(**options) ⇒ Array<Synapse::Nodes>
Queries Synapse API for all nodes belonging to user.
-
#get_node_statements(node_id:, **options) ⇒ Object
Gets statement by node.
-
#get_node_transaction(node_id:, trans_id:) ⇒ Synapse::Transaction
Queries the API for a transaction belonging to the supplied node by transaction id.
-
#get_subnet(node_id:, subnet_id:, **options) ⇒ Synapse::Subnet
Queries a node for a specific subnet by subnet_id.
-
#get_user_node(node_id:, **options) ⇒ Synapse::Node
Queries the API for a node belonging to user.
-
#get_user_statement(**options) ⇒ Object
Gets user statement.
- #get_user_transactions(**options) ⇒ Array<Synapse::Transactions>
-
#initialize(user_id:, refresh_token:, client:, payload:, full_dehydrate:) ⇒ User
constructor
A new instance of User.
-
#reinitiate_micro_deposit(node_id:) ⇒ Object
Reinitiate microdeposits on a node.
-
#reset_card_node(node_id:) ⇒ Synapse::Node
Resets debit card number, cvv, and expiration date.
-
#select_2fa_device(device:, **options) ⇒ Object
For registering new fingerprint Supply 2FA device which pin should be sent to.
-
#ship_card(node_id:, payload:, subnet_id:) ⇒ Synapse::Node
Request to ship user debit card [Subnet].
-
#ship_card_node(node_id:, payload:) ⇒ Synapse::Node
Request to ship CARD-US.
-
#update_node(node_id:, payload:) ⇒ Synapse::Node
Update supp_id, nickname, etc.
-
#update_subnet(node_id:, payload:, subnet_id:, **options) ⇒ Synapse::Subnet
Updates subnet debit card and act/rt number.
- #user_update(payload:) ⇒ Synapse::User
-
#verify_micro_deposit(node_id:, payload:) ⇒ Object
Verifies microdeposits for a node.
Constructor Details
#initialize(user_id:, refresh_token:, client:, payload:, full_dehydrate:) ⇒ User
Returns a new instance of User.
16 17 18 19 20 21 22 |
# File 'lib/synapse_api/user.rb', line 16 def initialize(user_id:,refresh_token:, client:,payload:, full_dehydrate:) @user_id = user_id @client = client @refresh_token = refresh_token @payload =payload @full_dehydrate =full_dehydrate end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
9 10 11 |
# File 'lib/synapse_api/user.rb', line 9 def client @client end |
#expires_in ⇒ Object
Returns the value of attribute expires_in.
9 10 11 |
# File 'lib/synapse_api/user.rb', line 9 def expires_in @expires_in end |
#full_dehydrate ⇒ Object
Returns the value of attribute full_dehydrate.
9 10 11 |
# File 'lib/synapse_api/user.rb', line 9 def full_dehydrate @full_dehydrate end |
#oauth_key ⇒ Object
Returns the value of attribute oauth_key.
9 10 11 |
# File 'lib/synapse_api/user.rb', line 9 def oauth_key @oauth_key end |
#payload ⇒ Object
Returns the value of attribute payload.
9 10 11 |
# File 'lib/synapse_api/user.rb', line 9 def payload @payload end |
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
9 10 11 |
# File 'lib/synapse_api/user.rb', line 9 def refresh_token @refresh_token end |
#user_id ⇒ Object
Returns the value of attribute user_id.
9 10 11 |
# File 'lib/synapse_api/user.rb', line 9 def user_id @user_id end |
Instance Method Details
#ach_mfa(payload:, **options) ⇒ Synapse::Node
Submit answer to a MFA question using access token from bank login attempt Please be sure to call ach_mfa again if you have more security questions
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/synapse_api/user.rb', line 249 def ach_mfa(payload:, **) path = get_user_path(user_id: self.user_id) path = path + nodes_path begin response = client.post(path,payload, ) rescue Synapse::Error::Unauthorized self.authenticate() response = client.post(path,payload, ) end if response["nodes"] nodes = response["nodes"].map { |nodes_data| Node.new(user_id: self.user_id, node_id: nodes_data["_id"], full_dehydrate: false, payload: response, type: nodes_data["type"] )} nodes = Nodes.new(page: response["page"], limit: response["limit"], page_count: response["page_count"], nodes_count: response["node_count"], payload: nodes ) else access_token = response end access_token ? access_token : nodes end |
#authenticate(**options) ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/synapse_api/user.rb', line 113 def authenticate(**) payload = { "refresh_token" => self.refresh_token } payload["scope"] = [:scope] if [:scope] path = oauth_path() oauth_response = client.post(path, payload,) oauth_key = oauth_response['oauth_key'] oauth_expires = oauth_response['expires_in'] self.oauth_key = oauth_key self.expires_in = oauth_expires client.update_headers(oauth_key: oauth_key) oauth_response end |
#cancel_transaction(node_id:, trans_id:) ⇒ Object
Cancels transaction if it has not already settled
585 586 587 588 589 590 591 592 593 594 |
# File 'lib/synapse_api/user.rb', line 585 def cancel_transaction(node_id:, trans_id:) path = trans_path(user_id: self.user_id, node_id: node_id) + "/#{trans_id}" begin response = client.delete(path) rescue Synapse::Error::Unauthorized self.authenticate() response = client.delete(path) end response end |
#comment_transaction(node_id:, trans_id:, payload:) ⇒ Synapse::Transaction
Adds comment to the transactions
569 570 571 572 573 574 575 576 577 578 579 |
# File 'lib/synapse_api/user.rb', line 569 def comment_transaction(node_id:,trans_id:,payload:) path = trans_path(user_id: self.user_id, node_id: node_id) + "/#{trans_id}" begin trans = client.patch(path, payload) rescue Synapse::Error::Unauthorized self.authenticate() trans = client.patch(path, payload) end Transaction.new(trans_id: trans['_id'], payload: trans) end |
#confirm_2fa_pin(pin:, **options) ⇒ Object
Supply pin for 2FA confirmation
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/synapse_api/user.rb', line 153 def confirm_2fa_pin(pin:, **) payload = { "refresh_token": self.refresh_token, "validation_pin": pin } payload["scope"] = [:scope] if [:scope] path = oauth_path() pin_response = client.post(path, payload, ) oauth_key = pin_response['oauth_key'] oauth_expires = pin_response['expires_in'] self.oauth_key = oauth_key self.expires_in = oauth_expires client.update_headers(oauth_key: oauth_key) pin_response end |
#create_node(payload:, **options) ⇒ Synapse::Node
Types of nodes [Card, IB/Deposit-US, Check/Wire Instructions]
Creates Synapse node
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/synapse_api/user.rb', line 213 def create_node(payload:, **) path = get_user_path(user_id: self.user_id) path = path + nodes_path begin response = client.post(path,payload, ) rescue Synapse::Error::Unauthorized self.authenticate() response = client.post(path,payload, ) end if response["nodes"] nodes = response["nodes"].map { |nodes_data| Node.new(user_id: self.user_id, node_id: nodes_data["_id"], full_dehydrate: false, payload: response, type: nodes_data["type"] )} nodes = Nodes.new(page: response["page"], limit: response["limit"], page_count: response["page_count"], nodes_count: response["node_count"], payload: nodes ) else access_token = response end access_token ? access_token : nodes end |
#create_subnet(node_id:, payload:, **options) ⇒ Synapse::Subnet
Creates subnet for a node debit card or act/rt number
618 619 620 621 622 623 624 625 626 627 |
# File 'lib/synapse_api/user.rb', line 618 def create_subnet(node_id:,payload:, **) path = subnet_path(user_id: self.user_id, node_id: node_id) begin subnet = client.post(path,payload, ) rescue Synapse::Error::Unauthorized self.authenticate() subnet = client.post(path,payload, ) end Subnet.new(subnet_id: subnet['_id'], payload: subnet, node_id: node_id) end |
#create_transaction(node_id:, payload:, **options) ⇒ Synapse::Transaction
Creates a new transaction in the API belonging to the provided node
382 383 384 385 386 387 388 389 390 391 392 393 394 |
# File 'lib/synapse_api/user.rb', line 382 def create_transaction(node_id: ,payload:, **) path = trans_path(user_id: self.user_id, node_id: node_id) begin transaction = client.post(path,payload, ) rescue Synapse::Error::Unauthorized self.authenticate() transaction = client.post(path,payload, ) end transaction = Transaction.new(trans_id: transaction['_id'], payload: transaction, node_id: node_id ) end |
#create_ubo(payload:) ⇒ Object
Allows you to upload an Ultimate Beneficial Ownership document
283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'lib/synapse_api/user.rb', line 283 def create_ubo(payload:) path = get_user_path(user_id: self.user_id) path = path + "/ubo" begin response = client.patch(path,payload) rescue Synapse::Error::Unauthorized self.authenticate() response = client.patch(path,payload) end response end |
#delete_node(node_id:) ⇒ Object
529 530 531 532 533 534 535 536 537 538 539 |
# File 'lib/synapse_api/user.rb', line 529 def delete_node(node_id:) path = node(user_id: self.user_id, node_id: node_id) begin delete = client.delete(path) rescue Synapse::Error::Unauthorized self.authenticate() delete = client.delete(path) end delete end |
#dispute_card_transactions(node_id:, trans_id:, payload:) ⇒ Object
Dispute a transaction for a user
601 602 603 604 605 606 607 608 609 610 611 |
# File 'lib/synapse_api/user.rb', line 601 def dispute_card_transactions(node_id:, trans_id:, payload:) path = trans_path(user_id: user_id, node_id: node_id) + "/#{trans_id}" path += "/dispute" begin dispute = client.patch(path, payload) rescue Synapse::Error::Unauthorized self.authenticate() dispute = client.patch(path, payload) end dispute end |
#dummy_transactions(node_id:, **options) ⇒ Object
Initiates dummy transactions to a node
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 |
# File 'lib/synapse_api/user.rb', line 548 def dummy_transactions(node_id:, **) path = node(user_id: self.user_id, node_id: node_id) + "/dummy-tran" params = VALID_QUERY_PARAMS.map do |p| [p] ? "#{p}=#{[p]}" : nil end.compact path += '?' + params.join('&') if params.any? begin response = client.get(path) rescue Synapse::Error::Unauthorized self.authenticate() response = client.get(path) end response end |
#generate_apple_pay_token(node_id:, payload:) ⇒ Object
Generate tokenized info for Apple Wallet
495 496 497 498 499 500 501 502 503 504 |
# File 'lib/synapse_api/user.rb', line 495 def generate_apple_pay_token(node_id:,payload:) path = node(user_id: self.user_id, node_id: node_id) + "/applepay" begin response = client.patch(path, payload) rescue Synapse::Error::Unauthorized self.authenticate() response = client.patch(path, payload) end response end |
#generate_node_statements(node_id:, payload:) ⇒ Object
Gets statement by node on demand
739 740 741 742 743 744 745 746 747 748 749 750 751 752 |
# File 'lib/synapse_api/user.rb', line 739 def generate_node_statements(node_id:,payload:) path = node(user_id: self.user_id, node_id: node_id) + "/statements" begin statements = client.post(path,payload) rescue Synapse::Error::Unauthorized self.authenticate() statements = client.post(path,payload) end statements end |
#get_all_node_transaction(node_id:, **options) ⇒ Array<Synapse::Transaction>
Queries the API for all transactions belonging to the supplied node
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
# File 'lib/synapse_api/user.rb', line 421 def get_all_node_transaction(node_id:, **) [[:page], [:per_page]].each do |arg| if arg && (!arg.is_a?(Integer) || arg < 1) raise ArgumentError, "#{arg} must be nil or an Integer >= 1" end end path = node(user_id: self.user_id, node_id: node_id) + "/trans" params = VALID_QUERY_PARAMS.map do |p| [p] ? "#{p}=#{[p]}" : nil end.compact path += '?' + params.join('&') if params.any? begin trans = client.get(path) rescue Synapse::Error::Unauthorized self.authenticate() trans = client.get(path) end response = trans["trans"].map { |trans_data| Transaction.new(trans_id: trans_data['_id'], payload: trans_data, node_id: node_id )} Transactions.new(limit: trans["limit"], page: trans["page"], page_count: trans["page_count"], trans_count: trans["trans_count"], payload: response ) end |
#get_all_subnets(node_id:, **options) ⇒ Object
Gets all node subnets
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 |
# File 'lib/synapse_api/user.rb', line 651 def get_all_subnets(node_id:,**) [[:page], [:per_page]].each do |arg| if arg && (!arg.is_a?(Integer) || arg < 1) raise ArgumentError, "#{arg} must be nil or an Integer >= 1" end end path = node(user_id: self.user_id, node_id: node_id) + "/subnets" params = VALID_QUERY_PARAMS.map do |p| [p] ? "#{p}=#{[p]}" : nil end.compact path += '?' + params.join('&') if params.any? begin subnets = client.get(path) rescue Synapse::Error::Unauthorized self.authenticate() subnets = client.get(path) end response = subnets["subnets"].map { |subnets_data| Subnet.new(subnet_id: subnets_data['_id'], payload: subnets, node_id: node_id )} Subnets.new(limit: subnets["limit"], page: subnets["page"], page_count: subnets["page_count"], subnets_count: subnets["subnets_count"], payload: response, node_id: node_id ) end |
#get_all_user_nodes(**options) ⇒ Array<Synapse::Nodes>
Queries Synapse API for all nodes belonging to user
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/synapse_api/user.rb', line 82 def get_all_user_nodes(**) [[:page], [:per_page]].each do |arg| if arg && (!arg.is_a?(Integer) || arg < 1) raise ArgumentError, "#{arg} must be nil or an Integer >= 1" end end path = get_user_path(user_id: self.user_id) + nodes_path() begin nodes = client.get(path) rescue Synapse::Error::Unauthorized self.authenticate() nodes = client.get(path) end return [] if nodes["nodes"].empty? response = nodes["nodes"].map { |node_data| Node.new(node_id: node_data['_id'], user_id: node_data['user_id'], payload: node_data, full_dehydrate: "no", type: node_data["type"])} nodes = Nodes.new(limit: nodes["limit"], page: nodes["page"], page_count: nodes["page_count"], nodes_count: nodes["node_count"], payload: response) end |
#get_node_statements(node_id:, **options) ⇒ Object
Gets statement by node
712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 |
# File 'lib/synapse_api/user.rb', line 712 def get_node_statements(node_id:,**) [[:page], [:per_page]].each do |arg| if arg && (!arg.is_a?(Integer) || arg < 1) raise ArgumentError, "#{arg} must be nil or an Integer >= 1" end end path = node(user_id: self.user_id, node_id: node_id) + "/statements" params = VALID_QUERY_PARAMS.map do |p| [p] ? "#{p}=#{[p]}" : nil end.compact path += '?' + params.join('&') if params.any? begin statements = client.get(path) rescue Synapse::Error::Unauthorized self.authenticate() statements = client.get(path) end statements end |
#get_node_transaction(node_id:, trans_id:) ⇒ Synapse::Transaction
Queries the API for a transaction belonging to the supplied node by transaction id
400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
# File 'lib/synapse_api/user.rb', line 400 def get_node_transaction(node_id:, trans_id:) path = node(user_id: self.user_id, node_id: node_id) + "/trans/#{trans_id}" begin trans = client.get(path) rescue Synapse::Error::Unauthorized self.authenticate() trans = client.get(path) end Transaction.new(trans_id: trans['_id'], payload: trans, node_id: node_id ) end |
#get_subnet(node_id:, subnet_id:, **options) ⇒ Synapse::Subnet
Queries a node for a specific subnet by subnet_id
689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 |
# File 'lib/synapse_api/user.rb', line 689 def get_subnet(node_id:,subnet_id:,**) path = node(user_id: self.user_id, node_id: node_id) + "/subnets/#{subnet_id}" params = VALID_QUERY_PARAMS.map do |p| [p] ? "#{p}=#{[p]}" : nil end.compact path += '?' + params.join('&') if params.any? begin subnet = client.get(path) rescue Synapse::Error::Unauthorized self.authenticate() subnet = client.get(path) end subnet = Subnet.new(subnet_id: subnet['_id'], payload: subnet, node_id: node_id) subnet end |
#get_user_node(node_id:, **options) ⇒ Synapse::Node
Queries the API for a node belonging to user
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/synapse_api/user.rb', line 51 def get_user_node(node_id:, **) [:full_dehydrate] = "yes" if [:full_dehydrate] == true [:full_dehydrate] = "no" if [:full_dehydrate] == false [:force_refresh] = "yes" if [:force_refresh] == true [:force_refresh] = "no" if [:force_refresh] == false path = node(node_id: node_id, full_dehydrate: [:full_dehydrate], force_refresh: [:force_refresh] ) begin node = client.get(path) rescue Synapse::Error::Unauthorized self.authenticate() node = client.get(path) end node = Node.new(node_id: node['_id'], user_id: self.user_id, payload: node, full_dehydrate: [:full_dehydrate] == "yes" ? true : false, type: node["type"] ) end |
#get_user_statement(**options) ⇒ Object
Gets user statement
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
# File 'lib/synapse_api/user.rb', line 301 def get_user_statement(**) path = get_user_path(user_id: self.user_id) + "/statements" params = VALID_QUERY_PARAMS.map do |p| [p] ? "#{p}=#{[p]}" : nil end.compact path += '?' + params.join('&') if params.any? begin statements = client.get(path) rescue Synapse::Error::Unauthorized self.authenticate() statements = client.get(path) end statements end |
#get_user_transactions(**options) ⇒ Array<Synapse::Transactions>
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/synapse_api/user.rb', line 177 def get_user_transactions(**) [[:page], [:per_page]].each do |arg| if arg && (!arg.is_a?(Integer) || arg < 1) raise ArgumentError, "#{arg} must be nil or an Integer >= 1" end end path = transactions_path(user_id: self.user_id, options: ) begin trans = client.get(path) rescue Synapse::Error::Unauthorized self.authenticate() trans = client.get(path) end response = trans["trans"].map { |trans_data| Transaction.new(trans_id: trans_data['_id'], payload: trans_data )} trans = Transactions.new(limit: trans["limit"], page: trans["page"], page_count: trans["page_count"], trans_count: trans["trans_count"], payload: response ) trans end |
#reinitiate_micro_deposit(node_id:) ⇒ Object
Reinitiate microdeposits on a node
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 |
# File 'lib/synapse_api/user.rb', line 475 def reinitiate_micro_deposit(node_id:) payload = {} path = node(user_id: self.user_id, node_id: node_id) + "?resend_micro=YES" begin response = client.patch(path, payload) rescue Synapse::Error::Unauthorized self.authenticate() response = client.patch(path, payload) end Node.new(user_id: self.user_id, node_id: response["_id"], full_dehydrate: false, payload: response, type: response["type"]) end |
#reset_card_node(node_id:) ⇒ Synapse::Node
Deprecated
Resets debit card number, cvv, and expiration date
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
# File 'lib/synapse_api/user.rb', line 360 def reset_card_node(node_id:) path = node(user_id: self.user_id, node_id: node_id) + "?reset=YES" payload = {} begin response = client.patch(path,payload) rescue Synapse::Error::Unauthorized self.authenticate() response = client.patch(path,payload) end Node.new(user_id: self.user_id, node_id:response["_id"], full_dehydrate: false, payload: response, type: response["type"] ) end |
#select_2fa_device(device:, **options) ⇒ Object
For registering new fingerprint Supply 2FA device which pin should be sent to
137 138 139 140 141 142 143 144 145 |
# File 'lib/synapse_api/user.rb', line 137 def select_2fa_device(device:, **) payload = { "refresh_token": self.refresh_token, "phone_number": device } path = oauth_path() device_response = client.post(path, payload, ) device_response end |
#ship_card(node_id:, payload:, subnet_id:) ⇒ Synapse::Node
Request to ship user debit card [Subnet]
343 344 345 346 347 348 349 350 351 352 353 |
# File 'lib/synapse_api/user.rb', line 343 def ship_card(node_id:, payload:, subnet_id:) path = node(user_id: self.user_id, node_id: node_id) + "/subnets/#{subnet_id}/ship" begin response = client.patch(path,payload) rescue Synapse::Error::Unauthorized self.authenticate() response = client.patch(path,payload) end Subnet.new(subnet_id: response["subnet_id"], payload: response, node_id: response["node_id"]) end |
#ship_card_node(node_id:, payload:) ⇒ Synapse::Node
Deprecated
Request to ship CARD-US
323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
# File 'lib/synapse_api/user.rb', line 323 def ship_card_node(node_id:, payload:) path = node(user_id: self.user_id, node_id: node_id) + "?ship=YES" begin response = client.patch(path,payload) rescue Synapse::Error::Unauthorized self.authenticate() response = client.patch(path,payload) end Node.new(user_id: self.user_id, node_id: response["_id"], full_dehydrate: false, payload: response, type: response["type"]) end |
#update_node(node_id:, payload:) ⇒ Synapse::Node
Update supp_id, nickname, etc. for a node
511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 |
# File 'lib/synapse_api/user.rb', line 511 def update_node(node_id:, payload:) path = node(user_id: self.user_id, node_id: node_id) begin update = client.patch(path, payload) rescue Synapse::Error::Unauthorized self.authenticate() update = client.patch(path, payload) end Node.new(node_id: node_id, user_id: self.user_id, payload: update, full_dehydrate: false, type: update["type"] ) end |
#update_subnet(node_id:, payload:, subnet_id:, **options) ⇒ Synapse::Subnet
Updates subnet debit card and act/rt number
634 635 636 637 638 639 640 641 642 643 |
# File 'lib/synapse_api/user.rb', line 634 def update_subnet(node_id:, payload:, subnet_id:, **) path = subnet_path(user_id: self.user_id, node_id: node_id, subnet_id: subnet_id) begin subnet = client.patch(path,payload) rescue Synapse::Error::Unauthorized self.authenticate() subnet = client.patch(path,payload) end Subnet.new(subnet_id: subnet['_id'], payload: subnet, node_id: node_id) end |
#user_update(payload:) ⇒ Synapse::User
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/synapse_api/user.rb', line 28 def user_update(payload:) path = get_user_path(user_id: self.user_id) begin response = client.patch(path, payload) rescue Synapse::Error::Unauthorized self.authenticate() response =client.patch(path, payload) end User.new(user_id: response['_id'], refresh_token: response['refresh_token'], client: client, full_dehydrate: false, payload: response ) end |
#verify_micro_deposit(node_id:, payload:) ⇒ Object
Verifies microdeposits for a node
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 |
# File 'lib/synapse_api/user.rb', line 457 def verify_micro_deposit(node_id:,payload:) path = node(user_id: self.user_id, node_id: node_id) begin response = client.patch(path, payload) rescue Synapse::Error::Unauthorized self.authenticate() response = client.patch(path, payload) end Node.new(user_id: self.user_id, node_id: response["_id"], full_dehydrate: false, payload: response, type: response["type"] ) end |