<commit_before>## Initialization

```ruby
require 'synapse_pay_rest'

options = {
  'oauth_key' => OAUTH_KEY, # Optional
  'fingerprint' => FINGERPRINT,
  'client_id' => CLIENT_ID,
  'client_secret' => CLIENT_SECRET,
  'ip_address' => IP_ADDRESS,
  'development_mode' => true # true will ping sandbox.synapsepay.com while false will ping synapsepay.com
}

USER_ID = USER_ID # Optional (it the client will automatically update it after a GET or UPDATE call)

client = SynapsePayRest::Client.new options: options, user_id: USER_ID

```

## User API Calls

```ruby


# Get All Users

users_response = client.users.get


# Create User

create_payload = {
  "logins" =>  [
    {
      "email" =>  "<EMAIL>",
      "password" =>  "<PASSWORD>",
      "read_only" => false
    }
  ],
  "phone_numbers" =>  [
    "901.111.1111"
  ],
  "legal_names" =>  [
    "<NAME>"
  ],
  "extra" =>  {
    "note" =>  "Interesting user",
    "supp_id" =>  "122eddfgbeafrfvbbb",
    "is_business" =>  false
  }
}

create_user_response = client.users.create(payload: create_payload)


# Get User

user_response = client.users.get(user_id: create_user_response['_id'])



# Refresh User

oauth_payload = {
  "refresh_token" => user_response['refresh_token']
}

oauth_response = client.users.refresh(payload: oauth_payload)


# Update a User

update_payload = {
  "refresh_token" => user_response['refresh_token'],
  "update" => {
    "login" => {
      "email" => "<EMAIL>",
      "password" => "<PASSWORD>",
      "read_only" => true
    },
    "phone_number" => "9019411111",
    "legal_name" => "<NAME>"
  }
}

client.users.update(payload: update_payload)


# Add Documents

# use users#encode_attachment to base64 encode a file for inclusion in the payload
govt_id_attachment = client.users.encode_attachment(file_path: FILE_PATH)
selfie_attachment  = client.users.encode_attachment(file_path: FILE_PATH)

add_documents_payload = {
  'documents' => [{
    'email' => '<EMAIL>',
    'phone_number' => '901-942-8167',
    'ip' => '12134323',
    'name' => 'Snoopie',
    'alias' => 'Meow',
    'entity_type' => 'M',
    'entity_scope' => 'Arts & Entertainment',
    'day' => 2,
    'month' => 5,
    'year' => 2009,
    'address_street' => 'Some Farm',
    'address_city' => 'SF',
    'address_subdivision' => 'CA',
    'address_postal_code' => '94114',
    'address_country_code' => 'US',
    'virtual_docs' => [{
      'document_value' => '111-111-3333',
      'document_type' => 'SSN'
    }],
    'physical_docs' => [{
      'document_value' => govt_id_attachment,
      'document_type' => 'GOVT_ID'
    },
    {
      'document_value' => selfie_attachment,
      'document_type' => 'SELFIE'
    }],
    'social_docs' => [{
      'document_value' => 'https://www.facebook.com/sankaet',
      'document_type' => 'FACEBOOK'
    }]
  }]
}

add_docs_response = client.users.update(payload: add_documents_payload)


# Answer KBA Questions

kyc_document = add_docs_response['documents'].last   # to get most recent (or only) submitted set of KYC docs

ssn = kyc_document['virtual_docs'].find { |doc| doc['status'] == 'SUBMITTED|MFA_PENDING'}

kba_payload = {
  'documents' => [{
    'id' => kyc_document['id'],
    'virtual_docs' => [{
      'id' => ssn['id'],
      'meta' => {
        'question_set' => {
          'answers' => [
            { 'question_id' => 1, 'answer_id' => 1 },
            { 'question_id' => 2, 'answer_id' => 1 },
            { 'question_id' => 3, 'answer_id' => 1 },
            { 'question_id' => 4, 'answer_id' => 1 },
            { 'question_id' => 5, 'answer_id' => 1 }
          ]
        }
      }
    }]
  }]
}

kba_response = client.users.update(payload: kba_payload)


## Node API Calls

```ruby


# Get All Nodes

nodes_response = client.nodes.get


# Add SYNAPSE-US Node

synapse_node_payload = {<commit_msg>Minor formatting changes<commit_after>## Initialization

```ruby
require 'synapse_pay_rest'

options = {
  'oauth_key' => OAUTH_KEY, # Optional
  'fingerprint' => FINGERPRINT,
  'client_id' => CLIENT_ID,
  'client_secret' => CLIENT_SECRET,
  'ip_address' => IP_ADDRESS,
  'development_mode' => true # true will ping sandbox.synapsepay.com while false will ping synapsepay.com
}

USER_ID = USER_ID # Optional (it the client will automatically update it after a GET or UPDATE call)

client = SynapsePayRest::Client.new options: options, user_id: USER_ID

```

## User API Calls

```ruby


# Get All Users

users_response = client.users.get


# Create User

create_payload = {
  "logins" =>  [
    {
      "email" =>  "<EMAIL>",
      "password" =>  "<PASSWORD>",
      "read_only" => false
    }
  ],
  "phone_numbers" =>  [
    "901.111.1111"
  ],
  "legal_names" =>  [
    "<NAME>"
  ],
  "extra" =>  {
    "note" =>  "Interesting user",
    "supp_id" =>  "122eddfgbeafrfvbbb",
    "is_business" =>  false
  }
}

create_user_response = client.users.create(payload: create_payload)


# Get User

user_response = client.users.get(user_id: create_user_response['_id'])



# Refresh User

oauth_payload = {
  "refresh_token" => user_response['refresh_token']
}

oauth_response = client.users.refresh(payload: oauth_payload)


# Update a User

update_payload = {
  "refresh_token" => user_response['refresh_token'],
  "update" => {
    "login" => {
      "email" => "<EMAIL>",
      "password" => "<PASSWORD>",
      "read_only" => true
    },
    "phone_number" => "9019411111",
    "legal_name" => "Some new name"
  }
}

client.users.update(payload: update_payload)


# Add Documents

# use Users#encode_attachment to base64 encode a file for inclusion in the payload
govt_id_attachment = client.users.encode_attachment(file_path: FILE_PATH)
selfie_attachment  = client.users.encode_attachment(file_path: FILE_PATH)

add_documents_payload = {
  'documents' => [{
    'email' => '<EMAIL>',
    'phone_number' => '901-942-8167',
    'ip' => '12134323',
    'name' => 'Snoopie',
    'alias' => 'Meow',
    'entity_type' => 'M',
    'entity_scope' => 'Arts & Entertainment',
    'day' => 2,
    'month' => 5,
    'year' => 2009,
    'address_street' => 'Some Farm',
    'address_city' => 'SF',
    'address_subdivision' => 'CA',
    'address_postal_code' => '94114',
    'address_country_code' => 'US',
    'virtual_docs' => [{
      'document_value' => '111-111-3333',
      'document_type' => 'SSN'
    }],
    'physical_docs' => [{
      'document_value' => govt_id_attachment,
      'document_type' => 'GOVT_ID'
    },
    {
      'document_value' => selfie_attachment,
      'document_type' => 'SELFIE'
    }],
    'social_docs' => [{
      'document_value' => 'https://www.facebook.com/sankaet',
      'document_type' => 'FACEBOOK'
    }]
  }]
}

add_docs_response = client.users.update(payload: add_documents_payload)


# Answer KBA Questions

kyc_document = add_docs_response['documents'].last   # to get most recent (or only) submitted set of KYC docs

ssn = kyc_document['virtual_docs'].find { |doc| doc['status'] == 'SUBMITTED|MFA_PENDING'}

kba_payload = {
  'documents' => [{
    'id' => kyc_document['id'],
    'virtual_docs' => [{
      'id' => ssn['id'],
      'meta' => {
        'question_set' => {
          'answers' => [
            { 'question_id' => 1, 'answer_id' => 1 },
            { 'question_id' => 2, 'answer_id' => 1 },
            { 'question_id' => 3, 'answer_id' => 1 },
            { 'question_id' => 4, 'answer_id' => 1 },
            { 'question_id' => 5, 'answer_id' => 1 }
          ]
        }
      }
    }]
  }]
}

kba_response = client.users.update(payload: kba_payload)

```

## Node API Calls

```ruby


# Get All Nodes

nodes_response = client.nodes.get


# Add SYNAPSE-US Node

synapse_node_payload = {
{'fraction_non_alphanumeric': 0.1664490861618799, 'fraction_numerical': 0.019321148825065273, 'mean_word_length': 3.1909190371991247, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 154, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1393386', 'n_tokens_mistral': 2938, 'n_tokens_neox': 2756, 'n_words': 524}