synapsis_v3 0.1.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/README.md +10 -33
- data/lib/synapsis_v3/api_resource.rb +11 -2
- data/lib/synapsis_v3/user.rb +10 -0
- data/lib/synapsis_v3/version.rb +1 -1
- data/lib/synapsis_v3.rb +11 -5
- data/synapsis_v3.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 724c68fcd11ae1a462c6c00849cb46bf9fc821d4
|
4
|
+
data.tar.gz: 668d2978dbf8c66f931a699abe2396bc320d3bbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a92724b124e96d312d10d66c3fd89873192188186d84ce8f83f3e204cb7964b9804cb8d3722d4bf37f03b3bf55f966b9e3444693ad4a912b03dff3b19d97531d
|
7
|
+
data.tar.gz: f337994e970ef538506e720d1cceac3ccace529b320b82fd5c0837db6072bbef2e1d76ff93943849363f0e7bbe2c72a6a7eefe6c44a8409d9a39eca420d70d7f
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,39 +1,16 @@
|
|
1
1
|
# SynapsisV3
|
2
2
|
|
3
|
-
|
3
|
+
Ruby wrapper to the SynapsePay API
|
4
4
|
|
5
|
-
|
5
|
+
## Running the Gem
|
6
6
|
|
7
|
-
|
7
|
+
Synapsis.configure do |config|
|
8
|
+
config.client_id = 'YOUR CLIENT ID'
|
9
|
+
config.client_secret = 'YOUR CLIENT SECRET'
|
10
|
+
config.environment = 'YOUR ENVIRONMENT--defaults to test, set to "production" to access the production URL'
|
11
|
+
config.logging = true # false by default, logs request and response data when set to true
|
12
|
+
end
|
8
13
|
|
9
|
-
|
14
|
+
## Running the tests
|
10
15
|
|
11
|
-
|
12
|
-
gem 'synapsis_v3'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install synapsis_v3
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
1. Fork it ( https://github.com/[my-github-username]/synapsis_v3/fork )
|
36
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
-
5. Create a new Pull Request
|
16
|
+
To run tests, sign up for a SynapsePay account, and create a spec/config-test.yml with a client_id and a client_secret.
|
@@ -1,8 +1,17 @@
|
|
1
1
|
class Synapsis::APIResource
|
2
|
-
def self.request(method
|
3
|
-
|
2
|
+
def self.request(method, url, params, oauth_key: nil, fingerprint: nil, ip_address: nil)
|
4
3
|
Synapsis.connection.send(method) do |req|
|
5
4
|
req.headers['Content-Type'] = 'application/json'
|
5
|
+
req.headers['X-SP-GATEWAY'] = "#{Synapsis.client_id}|#{Synapsis.client_secret}"
|
6
|
+
|
7
|
+
if oauth_key && fingerprint
|
8
|
+
req.headers['X-SP-USER'] = "#{oauth_key}|#{fingerprint}"
|
9
|
+
end
|
10
|
+
|
11
|
+
if ip_address
|
12
|
+
req.headers['X-SP-USER-IP'] = ip_address
|
13
|
+
end
|
14
|
+
|
6
15
|
req.url url
|
7
16
|
req.body = JSON.generate(params)
|
8
17
|
end
|
data/lib/synapsis_v3/user.rb
CHANGED
@@ -4,6 +4,16 @@ require 'base64'
|
|
4
4
|
class Synapsis::User < Synapsis::APIResource
|
5
5
|
extend Synapsis::APIOperations::Create
|
6
6
|
|
7
|
+
module DocumentStatus
|
8
|
+
MISSING_INVALID = 'MISSING|INVALID'
|
9
|
+
RESUBMIT_INVALID = 'RESUBMIT|INVALID'
|
10
|
+
SUBMITTED = 'SUBMITTED'
|
11
|
+
SUBMITTED_REVIEWING = 'SUBMITTED|REVIEWING'
|
12
|
+
SUBMITTED_MFA_PENDING = 'SUBMITTED|MFA_PENDING'
|
13
|
+
SUBMITTED_INVALID = 'SUBMITTED|INVALID'
|
14
|
+
SUBMITTED_VALID = 'SUBMITTED|VALID'
|
15
|
+
end
|
16
|
+
|
7
17
|
def self.create(params)
|
8
18
|
payload = params.merge(client_credentials)
|
9
19
|
|
data/lib/synapsis_v3/version.rb
CHANGED
data/lib/synapsis_v3.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'faraday'
|
2
|
+
require 'faraday/detailed_logger'
|
2
3
|
require 'ostruct'
|
3
4
|
|
4
5
|
# Namespacing
|
@@ -20,14 +21,19 @@ API_V3_PATH = 'api/v3/'
|
|
20
21
|
|
21
22
|
module Synapsis
|
22
23
|
class << self
|
23
|
-
attr_accessor :client_id, :client_secret, :environment
|
24
|
+
attr_accessor :client_id, :client_secret, :environment, :logging
|
24
25
|
|
25
26
|
def connection
|
26
27
|
@connection ||= Faraday.new(url: synapse_url) do |faraday|
|
27
|
-
faraday.request :multipart
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
faraday.request :multipart # form-encode POST params
|
29
|
+
|
30
|
+
if Synapsis.logging
|
31
|
+
faraday.response :detailed_logger # form-encode POST params
|
32
|
+
end
|
33
|
+
|
34
|
+
faraday.request :url_encoded # form-encode POST params
|
35
|
+
faraday.response :logger # log requests to STDOUT
|
36
|
+
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
|
31
37
|
end
|
32
38
|
end
|
33
39
|
|
data/synapsis_v3.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synapsis_v3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daryll Santos
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: faraday-detailed_logger
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
description: Ruby interface to the SynapsePayments API (v3)
|
126
140
|
email:
|
127
141
|
- daryll.santos@gmail.com
|