quovo 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d5dc88ba2b46017ab91e3df989dd7514dcd8428
4
- data.tar.gz: de815ba227df562d12bafb7741e3133fe6c5a294
3
+ metadata.gz: b880b5ba6b9a4c0fddcc69d78618307bf641ce3f
4
+ data.tar.gz: b16bdad0fad1d53ab9de5eec146cb053bb484f7b
5
5
  SHA512:
6
- metadata.gz: 6e917add2f8db567386671ddf68936df3cea763aa6e7e556aeb7348a08a9955db6b4a116f5302ff6582577c60c325b15ea739df6da33c864728b0e7f53c672a3
7
- data.tar.gz: 8cc7a83e0ffa0cee92ace60a85a7432ab8257e182088091a12e4614b971f9197e2238434efc67f53fb9d74883bd32b38ed3767de4492e5f79f67c305e34952fe
6
+ metadata.gz: a701f6edf07195f0f5f26d2ad88e3c3a5541bf34472459cf809ef69e0b0b7b9bb103d6c47ce96090a1c6fb0b717632f9af2d87d2126dc40876529822e39da288
7
+ data.tar.gz: 563f33ef04d56a9702300dc3ba8c9936344d50d7befda8b79b406400b14c901151f58dfaa517e9988178339695782cb526e9ad87fe573f79fda0dc107a27e736
data/README.md CHANGED
@@ -169,6 +169,27 @@ Hook is a registered callback that invokes when web request happens.
169
169
  client.iframe_token.create(user_id)
170
170
  ```
171
171
 
172
+ ### Webhooks
173
+ ```ruby
174
+ client.webhooks.all
175
+ client.webhooks.create(options)
176
+ # Options:
177
+ # events: - a list of events to subscribe to. Default is ['*']
178
+ # is_active: - whether the webhook is enabled or not. Default is 'true'
179
+ # secret: - the string used to calculate the signature on each webhook delivery (required)
180
+ # name: - a unique name (required)
181
+ # url: - the URL the webhook should POST data to. (required)
182
+ client.webhooks.update(name, options)
183
+ # Options:
184
+ # events: - a list of events to subscribe to. Default is ['*']
185
+ # is_active: - whether the webhook is enabled or not
186
+ # secret: - the string used to calculate the signature on each webhook delivery
187
+ # name: - a unique name (required)
188
+ # url: - the URL the webhook should POST data to.
189
+ client.webhooks.delete(name)
190
+ ```
191
+
192
+
172
193
  ## Contributors
173
194
  * Canopy Financials [https://www.canopyfa.com](https://www.canopyfa.com)
174
195
  * Castle Digital Partners [https://castle.co](https://castle.co)
@@ -36,6 +36,7 @@ require 'quovo/models/user'
36
36
  require 'quovo/models/position'
37
37
  require 'quovo/models/transaction'
38
38
  require 'quovo/models/iframe_token'
39
+ require 'quovo/models/webhook'
39
40
 
40
41
  require 'quovo/api/base'
41
42
  require 'quovo/api/brokerages'
@@ -46,6 +47,7 @@ require 'quovo/api/users'
46
47
  require 'quovo/api/positions'
47
48
  require 'quovo/api/history'
48
49
  require 'quovo/api/iframe_token'
50
+ require 'quovo/api/webhooks'
49
51
  require 'quovo/api'
50
52
 
51
53
  module Quovo
@@ -31,5 +31,9 @@ module Quovo
31
31
  def iframe_token
32
32
  @iframe_token ||= Quovo::Api::IframeToken.new
33
33
  end
34
+
35
+ def webhooks
36
+ @webhooks ||= Quovo::Api::Webhooks.new
37
+ end
34
38
  end
35
39
  end
@@ -0,0 +1,38 @@
1
+ module Quovo
2
+ module Api
3
+ class Webhooks < Base
4
+ using Quovo::Refinements::Cast
5
+ using Quovo::Refinements::Require
6
+ using Quovo::Refinements::Permit
7
+
8
+ def all
9
+ api(:get, '/webhooks')
10
+ .fetch('webhooks')
11
+ .cast(Webhook)
12
+ end
13
+
14
+ def create(params)
15
+ params
16
+ .permit!(:events, :is_active, :secret, :name, :url)
17
+ .require!(:secret, :name, :url)
18
+ api(:post, '/webhooks', params)
19
+ .fetch('webhook')
20
+ .cast(Webhook)
21
+ end
22
+
23
+ def update(name, params)
24
+ name.require!(as: :name)
25
+ params.permit!(:events, :is_active, :secret, :url)
26
+ params[:name] = name
27
+ api(:put, '/webhooks', params)
28
+ .fetch('webhook')
29
+ .cast(Webhook)
30
+ end
31
+
32
+ def delete(name)
33
+ name.require!(as: :name)
34
+ api(:delete, '/webhooks', name: name)
35
+ end
36
+ end
37
+ end
38
+ end
@@ -12,6 +12,8 @@ module Quovo
12
12
  fees
13
13
  fxrate
14
14
  id
15
+ is_cancel
16
+ is_pending
15
17
  memo
16
18
  portfolio
17
19
  price
@@ -0,0 +1,13 @@
1
+ module Quovo
2
+ module Models
3
+ class Webhook < Base
4
+ fields %i(
5
+ events
6
+ is_active
7
+ secret
8
+ name
9
+ url
10
+ )
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Quovo
2
- VERSION = '1.0.8'.freeze
2
+ VERSION = '1.0.9'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quovo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Gorkunov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-04-25 00:00:00.000000000 Z
12
+ date: 2017-05-15 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Quovo RESTful API client, configurable, thread-safe and well-tested
15
15
  email:
@@ -35,6 +35,7 @@ files:
35
35
  - lib/quovo/api/portfolios.rb
36
36
  - lib/quovo/api/positions.rb
37
37
  - lib/quovo/api/users.rb
38
+ - lib/quovo/api/webhooks.rb
38
39
  - lib/quovo/config.rb
39
40
  - lib/quovo/errors.rb
40
41
  - lib/quovo/fake.rb
@@ -52,6 +53,7 @@ files:
52
53
  - lib/quovo/models/sync.rb
53
54
  - lib/quovo/models/transaction.rb
54
55
  - lib/quovo/models/user.rb
56
+ - lib/quovo/models/webhook.rb
55
57
  - lib/quovo/refinements/cast.rb
56
58
  - lib/quovo/refinements/compact.rb
57
59
  - lib/quovo/refinements/permit.rb