increase 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: c94e77f42a4d8c725f5518af02301564c6cbff71f90015063313e983aeac5124
4
- data.tar.gz: 1d5ec565ec368dd713b47f18a41d5eb1363e624ef6792c05b87952f9fe368695
3
+ metadata.gz: 5dab8c774d39cce112627bc75d36a10947419d640db56e45dfc4f2cd75330656
4
+ data.tar.gz: a93d12bf1e5a64938dcf41b339a1de33c36c82ad8b5430169156cb868e0cf87a
5
5
  SHA512:
6
- metadata.gz: 4dd0a71c6eac5742ca4f63237eb8bbccffc8eefe625ce63e345b97cb4431b3cba04744e9acd426665757ab0d1240637a4fb02311cda84cbe7dc8fa1f2657c7bf
7
- data.tar.gz: cba66503cbbeaf4fd7bdc6541899d033126a2efbc20a7ce70cb8b14f42a78a30628b3ea40b3da1b7b176e4d8219291d800846061f3004c70c2d0e96f4b548a64
6
+ metadata.gz: f74f1fd78799702a1dfed5180e93155ca7595a4f8d758545e483f3aee5db6cac853ff044fe043bcc33918eb85dd17c4544ea359654adfa1b52448240e1a38d42
7
+ data.tar.gz: ce8aacf00abb9d1660cff928a80ecc5f74900f6ea998cb47a512dedb080cfd252740e4c7f15d982580dae0f026c172948d3948fcbd9438a0348e6b8dd2ee28f6
data/README.md CHANGED
@@ -98,7 +98,7 @@ rescue Increase::ApiError => e
98
98
  puts e.detail # "No resource of type transaction was found with ID transaction_1234abcd."
99
99
  puts e.status # 404
100
100
 
101
- puts e.response # This contains the full response from the API, including headers! (its a Faraday::Env object)
101
+ puts e.response # This contains the full response from the API, including headers! (its a Faraday::Response object)
102
102
 
103
103
  puts e.class # Increase::ObjectNotFoundError (it's a subclass of Increase::ApiError!)
104
104
  end
@@ -129,15 +129,58 @@ Increase.api_key = 'terabytes_of_cash' # Default: nil (you'll need one tho!)
129
129
  Increase.base_url = :production # Default: :production
130
130
  Increase.raise_api_errors = true # Default: true
131
131
 
132
- # Or, you can use a block
132
+ # Or, you can pass in a hash
133
+ Increase.configure(api_key: 'just_my_two_cents')
134
+
135
+ # Or, you can use a block!
133
136
  Increase.configure do |config|
134
137
  config.api_key = 'digital_dough'
135
- config.base_url = :sandbox
136
- config.raise_api_errors = false
138
+ config.base_url = :sandbox # Default: :production
139
+ config.raise_api_errors = false # Default: true
137
140
  end
141
+ ```
138
142
 
139
- # Or, you can pass in a hash
140
- Increase.configure(api_key: 'just_my_two_cents')
143
+ If you are using Rails, the recommended way is to set your configurations as a block in an initializer.
144
+
145
+ ```ruby
146
+ # config/initializers/increase.rb
147
+
148
+ Increase.configure do |config|
149
+ config.api_key = 'money_cant_buy_happiness'
150
+ config.base_url = :production
151
+ end
152
+ ```
153
+
154
+ ### Webhooks
155
+
156
+ **Increase**'s webhooks include a `Increase-Webhook-Signature` header for securing your webhook endpoint. Although not
157
+ required, it's strongly recommended that you verify the signature to ensure the request is coming from **Increase**.
158
+
159
+ Here is an example for Rails.
160
+
161
+ ```ruby
162
+
163
+ class IncreaseController < ApplicationController
164
+ protect_from_forgery except: :webhook # Ignore CSRF checks
165
+
166
+ def webhook
167
+ payload = request.body.read
168
+ sig_header = request.headers['Increase-Webhook-Signature']
169
+ secret = Rails.application.credentials.dig(:increase, :webhook_secret)
170
+
171
+ Increase::Webhook::Signature.verify?(
172
+ payload: payload,
173
+ signature_header: sig_header,
174
+ secret: secret
175
+ )
176
+
177
+ # It's a valid webhook! Do something with it...
178
+
179
+ render json: {success: true}
180
+ rescue Increase::WebhookSignatureVerificationError => e
181
+ render json: {error: 'Webhook signature verification failed'}, status: :bad_request
182
+ end
183
+ end
141
184
  ```
142
185
 
143
186
  ### Idempotency
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "increase/resource"
4
+
5
+ module Increase
6
+ class CheckTransfers < Resource
7
+ create
8
+ list
9
+ retrieve
10
+ endpoint :approve, :post, with: :id
11
+ endpoint :cancel, :post, with: :id
12
+ endpoint :stop_payment, :post, with: :id
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "increase/resource"
4
+
5
+ module Increase
6
+ class Limits < Resource
7
+ create
8
+ list
9
+ update
10
+ retrieve
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "increase/resource"
4
+
5
+ module Increase
6
+ class RoutingNumbers < Resource
7
+ list
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Increase
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: increase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gary Tou
@@ -133,8 +133,11 @@ files:
133
133
  - lib/increase/resources/accounts.rb
134
134
  - lib/increase/resources/ach_transfers.rb
135
135
  - lib/increase/resources/cards.rb
136
+ - lib/increase/resources/check_transfers.rb
136
137
  - lib/increase/resources/events.rb
138
+ - lib/increase/resources/limits.rb
137
139
  - lib/increase/resources/pending_transactions.rb
140
+ - lib/increase/resources/routing_numbers.rb
138
141
  - lib/increase/resources/transactions.rb
139
142
  - lib/increase/response_hash.rb
140
143
  - lib/increase/util.rb