stannp 0.2.0 → 0.3.0

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: 59a7326c7fc932044cc7706a6e13769012cc269b253efa3ec51dae2b7c2517ea
4
- data.tar.gz: f5cb65cc496bbe21d4657a65053af6518fc812a573590648a5ccb2949e23ce02
3
+ metadata.gz: cfc91d10039a3c87a7c4e8725a764dce523dd9f26ff814a20a39757bdb86108d
4
+ data.tar.gz: 153a1c9b0a9a6fc9cfc23a4fa630ba144a01712027dc4f39865199c5eb463875
5
5
  SHA512:
6
- metadata.gz: cb4f1277029da2883fc36eea3e5ba72ba7b61d29fe10580f69d98894669952d6581d3208933d5c1ef67934a14ec4881ec194776e83e2a617da1930bb964466c4
7
- data.tar.gz: 882d0899a9beaaf8877bf944645e76fe3f32c208630da4700e5b4aa7dc26a5a02e0e7c5cbab0aa6b2f98379cc77117ce5a27cd72ef220b98307946b27d5da846
6
+ metadata.gz: 5a8c1c3a9047377908c0726dac92833007c367816d0683deed3fec3d92bc5f468b9c2b17bc957501f334f53c7ca57e7bd1d1cf8d834ecb2beac627492ec4d9fb
7
+ data.tar.gz: 992bb70c57042c83ca701a34cfb4cb843fe4f34484ee27d3eb4ff08196d980324d58dd536e05705edd4ddb23320a0a5aa2f52e2a12d87e1e34eb4d922e9b20bf
data/CHANGELOG.md CHANGED
@@ -4,3 +4,7 @@
4
4
 
5
5
  ## [0.2.0] - 2022-04-11
6
6
  - Add support for the complete Account API
7
+
8
+ ## [0.3.0] - 2022-04-11
9
+ - Add support for recipient upload
10
+ - Add the Addresses API
data/lib/stannp/client.rb CHANGED
@@ -25,6 +25,10 @@ module Stannp
25
25
  RecipientsResource.new(client: self)
26
26
  end
27
27
 
28
+ def addresses
29
+ AddressesResource.new(client: self)
30
+ end
31
+
28
32
  def connection
29
33
  @connection ||= Faraday.new do |conn|
30
34
  conn.request :json
@@ -14,14 +14,6 @@ module Stannp
14
14
  handle_response client.connection.post(url, body, headers)
15
15
  end
16
16
 
17
- def patch_request(url, body:, headers: {})
18
- handle_response client.connection.patch(url, body, headers)
19
- end
20
-
21
- def put_request(url, body:, headers: {})
22
- handle_response client.connection.put(url, body, headers)
23
- end
24
-
25
17
  private
26
18
 
27
19
  attr_reader :client
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stannp
4
+ class AddressesResource < Resource
5
+ def validate(attributes:)
6
+ url = "https://dash.stannp.com/api/v1/addresses/validate?api_key=#{client.api_key}"
7
+ post_request(url, body: attributes).body['data']['is_valid']
8
+ end
9
+ end
10
+ end
@@ -35,5 +35,11 @@ module Stannp
35
35
 
36
36
  raise e
37
37
  end
38
+
39
+ def import(group_id:, file:, options: {})
40
+ url = "https://dash.stannp.com/api/v1/recipients/import?api_key=#{client.api_key}"
41
+ body = { group_id: group_id, file: file }.merge(options)
42
+ post_request(url, body: body).body['success']
43
+ end
38
44
  end
39
45
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stannp
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
5
5
  end
data/lib/stannp.rb CHANGED
@@ -12,6 +12,7 @@ module Stannp
12
12
  autoload :AccountResource, 'stannp/resources/account'
13
13
  autoload :UserResource, 'stannp/resources/user'
14
14
  autoload :RecipientsResource, 'stannp/resources/recipients'
15
+ autoload :AddressesResource, 'stannp/resources/addresses'
15
16
  # objects
16
17
  autoload :User, 'stannp/objects/user'
17
18
  autoload :Recipient, 'stannp/objects/recipient'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stannp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k-p-jones
@@ -63,6 +63,7 @@ files:
63
63
  - lib/stannp/objects/user.rb
64
64
  - lib/stannp/resource.rb
65
65
  - lib/stannp/resources/account.rb
66
+ - lib/stannp/resources/addresses.rb
66
67
  - lib/stannp/resources/recipients.rb
67
68
  - lib/stannp/resources/user.rb
68
69
  - lib/stannp/version.rb