wealthforge2-ruby 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9c15664dbc495646a2c8e9bfa596cc2ab1a8a192d43c94e3ff0ef224db100c48
4
+ data.tar.gz: 8de6206258bf6fdb6ef601521c45adc2b4487541a91691c5af063927579d8da1
5
+ SHA512:
6
+ metadata.gz: 40ae2fc8dc5d7ae2aa5d62dbdbe4e2505f10c0883a44c95e68ae0e8b88b3abdcdd82ba1aeb120f4448d53066b7a456873dcddb78116018d72a8068a1122f0e5c
7
+ data.tar.gz: 24e8a40aea060a85462e04f29fda8f9abdc7be584a7e396b3c9ac5acebc57f392e98e59ec240f0d360dbf337b70fe724db9af9707da16d7a7fa573b4e033fe79
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Dino Simone
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # WealthForge API Client for Ruby
2
+
3
+ This client seamlessly integrates into your Ruby application to provide an interface to the WealthForge API web service.
4
+
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'wealthforge2-ruby'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install wealthforge2-ruby
21
+
22
+
23
+ ## Configuration
24
+
25
+ Before you can use this gem, you'll need to configure it with the key and cert, which you'll have after registering with WealthForge. If using with Rails, put this code in the initializer.
26
+
27
+ ```ruby
28
+ WealthForge2.configure do |config|
29
+ config.session_id = '[assigned-session-id]'
30
+ config.environment = 'development'
31
+ end
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ ### Available Calls
37
+
38
+ #### Investment
39
+
40
+ ```ruby
41
+ WealthForge2::Investment.create
42
+ WealthForge2::Investment.get
43
+ WealthForge2::Investment.cancel_subscription
44
+ WealthForge2::Investment.file_upload
45
+ ```
46
+
47
+ #### Offering
48
+
49
+ ```ruby
50
+ WealthForge2::Offering.create
51
+ WealthForge2::Offering.get
52
+ ```
53
+
54
+ ## Contributing
55
+
56
+ Bug reports and pull requests are welcome on GitHub at https://github.com/dinosimone/wealthforge2-ruby.
57
+
58
+
59
+ ## Tests
60
+
61
+ All tests can be run by typing `rspec`. Prior to running tests, you'll need to set your secret and client ID.:
62
+
63
+ ## License
64
+
65
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
66
+
67
+
68
+ ## Disclaimer
69
+
70
+ This project and the code therein was not created by and is not supported by WealthForge.
71
+
72
+
73
+ ## Author
74
+
75
+ Dino Simone (dino@simone.is) | dinosimone.com
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "wealthforge-ruby"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,7 @@
1
+ class WealthForge2::ApiException < StandardError
2
+ def initialize(e = nil)
3
+ puts "API error: #{e.inspect}"
4
+ super e
5
+ set_backtrace e.backtrace if e
6
+ end
7
+ end
@@ -0,0 +1,18 @@
1
+ module WealthForge2
2
+ class Configuration
3
+ attr_accessor :session_id
4
+ attr_accessor :api_url
5
+ attr_accessor :environment
6
+ attr_accessor :version
7
+ attr_accessor :production_url
8
+ attr_accessor :sandbox_url
9
+
10
+ def initialize
11
+ @session_id = nil
12
+ @environment = nil
13
+ @api_url = nil
14
+ @production_url = "https://wealthforgeprod01.decisions.com/Primary/restapi/Flow/"
15
+ @sandbox_url = "https://wealthforgedev01.decisions.com/decisions/Primary/restapi/Flow"
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,56 @@
1
+ require "openssl"
2
+ require "faraday"
3
+ require "json"
4
+ require "csv"
5
+ require "timeout"
6
+ require "resolv-replace"
7
+ require "jwt"
8
+
9
+ class WealthForge2::Connection
10
+ def self.post(endpoint, params)
11
+ begin
12
+ response = connection.post do |req|
13
+ req.url endpoint
14
+ req.headers["Content-Type"] = "application/json"
15
+ req.body = params.to_json
16
+ end
17
+ rescue => e
18
+ raise WealthForge2::ApiException.new(e)
19
+ end
20
+ JSON.parse(response.body)
21
+ end
22
+
23
+ def self.get(endpoint, params)
24
+ begin
25
+ response = connection.get do |req|
26
+ req.url endpoint
27
+ req.headers["Content-Type"] = "application/json"
28
+ req.body = params.to_json
29
+ end
30
+ rescue => e
31
+ raise WealthForge2::ApiException.new(e)
32
+ end
33
+ JSON.parse(response.body)
34
+ end
35
+
36
+ def self.connection
37
+ Faraday.new(url: WealthForge2.configuration.api_url) do |faraday|
38
+ faraday.request :url_encoded
39
+ faraday.options.timeout = 5
40
+ faraday.options.open_timeout = 5
41
+ faraday.use CustomErrors
42
+ faraday.adapter Faraday.default_adapter
43
+ end
44
+ end
45
+ end
46
+
47
+ class CustomErrors < Faraday::Response::RaiseError
48
+ def on_complete(env)
49
+ case env[:status]
50
+ when 400...600
51
+ JSON.parse(env[:body])
52
+ else
53
+ super
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,17 @@
1
+ class WealthForge2::Investment
2
+ def self.create(params)
3
+ WealthForge2::Connection.post "ce6bf0cf-ff79-11eb-8466-00155d0b8b06", params
4
+ end
5
+
6
+ def self.get(params)
7
+ WealthForge2::Connection.post "51029a96-124b-11ec-8466-00155d0b8b06", params
8
+ end
9
+
10
+ def self.file_upload(params)
11
+ WealthForge2::Connection.post "bcf7264c-2124-11ec-8467-00155d0b8b06", params
12
+ end
13
+
14
+ def self.cancel_subscription(params)
15
+ WealthForge2::Connection.post "df3deb53-2512-11ec-8467-00155d0b8b06", params
16
+ end
17
+ end
@@ -0,0 +1,9 @@
1
+ class WealthForge2::Offering
2
+ def self.create(params)
3
+ WealthForge2::Connection.post "fe47bb35-feb3-11eb-8466-00155d0b8b06", params
4
+ end
5
+
6
+ def self.get(params)
7
+ WealthForge2::Connection.post "1c3d79e5-1fb8-11ec-8467-00155d0b8b06", params
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module WealthForge2
2
+ VERSION = "2.0.0"
3
+ end
@@ -0,0 +1,24 @@
1
+ require "wealthforge/configuration"
2
+ require "wealthforge/api_exception"
3
+ require "wealthforge/connection"
4
+ require "wealthforge/investment"
5
+ require "wealthforge/offering"
6
+
7
+ module WealthForge2
8
+ class << self
9
+ attr_accessor :configuration
10
+ end
11
+
12
+ def self.configuration
13
+ @configuration ||= Configuration.new
14
+ end
15
+
16
+ def self.reset
17
+ @configuration = Configuration.new
18
+ end
19
+
20
+ def self.configure
21
+ yield(configuration)
22
+ configuration.api_url = configuration.environment == "production" ? configuration.production_url : configuration.sandbox_url
23
+ end
24
+ end
metadata ADDED
@@ -0,0 +1,233 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wealthforge2-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Dino Simone | dinosimone.com
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-11-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.5.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.5'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.5.1
33
+ - !ruby/object:Gem::Dependency
34
+ name: mime-types
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '3.3'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 3.3.1
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '3.3'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 3.3.1
53
+ - !ruby/object:Gem::Dependency
54
+ name: jwt
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '2.2'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 2.2.3
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '2.2'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 2.2.3
73
+ - !ruby/object:Gem::Dependency
74
+ name: openssl
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: '2.2'
80
+ type: :runtime
81
+ prerelease: false
82
+ version_requirements: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - "~>"
85
+ - !ruby/object:Gem::Version
86
+ version: '2.2'
87
+ - !ruby/object:Gem::Dependency
88
+ name: json
89
+ requirement: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - "~>"
92
+ - !ruby/object:Gem::Version
93
+ version: '2.5'
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 2.5.1
97
+ type: :runtime
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '2.5'
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: 2.5.1
107
+ - !ruby/object:Gem::Dependency
108
+ name: rake
109
+ requirement: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - "~>"
112
+ - !ruby/object:Gem::Version
113
+ version: '13.0'
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: 13.0.6
117
+ type: :development
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '13.0'
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: 13.0.6
127
+ - !ruby/object:Gem::Dependency
128
+ name: rspec
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - "~>"
132
+ - !ruby/object:Gem::Version
133
+ version: '3.10'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - "~>"
139
+ - !ruby/object:Gem::Version
140
+ version: '3.10'
141
+ - !ruby/object:Gem::Dependency
142
+ name: vcr
143
+ requirement: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - "~>"
146
+ - !ruby/object:Gem::Version
147
+ version: '6.0'
148
+ type: :development
149
+ prerelease: false
150
+ version_requirements: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - "~>"
153
+ - !ruby/object:Gem::Version
154
+ version: '6.0'
155
+ - !ruby/object:Gem::Dependency
156
+ name: webmock
157
+ requirement: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - "~>"
160
+ - !ruby/object:Gem::Version
161
+ version: '3.13'
162
+ type: :development
163
+ prerelease: false
164
+ version_requirements: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - "~>"
167
+ - !ruby/object:Gem::Version
168
+ version: '3.13'
169
+ - !ruby/object:Gem::Dependency
170
+ name: factory_bot
171
+ requirement: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - "~>"
174
+ - !ruby/object:Gem::Version
175
+ version: '4.8'
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ version: 4.8.2
179
+ type: :development
180
+ prerelease: false
181
+ version_requirements: !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - "~>"
184
+ - !ruby/object:Gem::Version
185
+ version: '4.8'
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ version: 4.8.2
189
+ description: The WealthForge API acts as a connection between WealthForge's back-end
190
+ transaction engine, CapitalForge, and your front-end website.
191
+ email:
192
+ - dino@simone.is
193
+ executables:
194
+ - console
195
+ - setup
196
+ extensions: []
197
+ extra_rdoc_files: []
198
+ files:
199
+ - LICENSE
200
+ - README.md
201
+ - bin/console
202
+ - bin/setup
203
+ - lib/wealthforge/api_exception.rb
204
+ - lib/wealthforge/configuration.rb
205
+ - lib/wealthforge/connection.rb
206
+ - lib/wealthforge/investment.rb
207
+ - lib/wealthforge/offering.rb
208
+ - lib/wealthforge/version.rb
209
+ - lib/wealthforge2-ruby.rb
210
+ homepage: https://github.com/dinosimone/wealthforge-ruby
211
+ licenses:
212
+ - MIT
213
+ metadata: {}
214
+ post_install_message:
215
+ rdoc_options: []
216
+ require_paths:
217
+ - lib
218
+ required_ruby_version: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ required_rubygems_version: !ruby/object:Gem::Requirement
224
+ requirements:
225
+ - - ">="
226
+ - !ruby/object:Gem::Version
227
+ version: '0'
228
+ requirements: []
229
+ rubygems_version: 3.0.3
230
+ signing_key:
231
+ specification_version: 4
232
+ summary: WealthForge API Client
233
+ test_files: []