stannp 0.4.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5cf8e8da25fd4bf0f3130533712a0d1a71e6d7cc9187b47fd9fc4643e5856cc
4
- data.tar.gz: 8cbc6fd50818dbf95b2ffc7f34ec2e71d81b90b70cd81873a5c23a8d9f2d0f1e
3
+ metadata.gz: bff3ab1efdd21197064698fddde52daa93d9c4231d9d07ecc1d77be3e654c3d9
4
+ data.tar.gz: '059d4ec23e07c853a2c0134f2c0ecbecd05dc0ee174c2db538614f7954db24a1'
5
5
  SHA512:
6
- metadata.gz: ceb18058cc55aa19e3a69ef61ddc50dbc40186fe511b0ece19194cc3f3e13ccb21c02f85bd48b6ceb1224659ef23df0ca2fc97491a0bd7124239333d4c870db7
7
- data.tar.gz: 65ebaea8d56f197e89a8e4bdb4d29c46444dcb6c03541da765e8b7932514771b800ea4bd6895e77ac18ad5dcad9184fa683a8a298804d314658d2a5d47182cf0
6
+ metadata.gz: c280a7cfb8cc8199ead8628cf599556e19ffd06298507630211e2a0e4c062a2f389bb54ecc010635e2fec148ebcdfcbecb09da9f5c3285097e2f6bd9bd609a08
7
+ data.tar.gz: 33ea9120a90755f163ad2b4597679da35c28b99d9a73550498259a558fb3b46d1efd582e434e586c7bf34afb4dcf9976bf7552ed2711bce7d9159277142a63c7
data/CHANGELOG.md CHANGED
@@ -11,3 +11,6 @@
11
11
 
12
12
  ## [0.4.0] - 2022-04-16
13
13
  - Add support for the Postcards API
14
+
15
+ ## [0.5.0] - 2022-04-16
16
+ - Add support for the Letters API
data/lib/stannp/client.rb CHANGED
@@ -34,6 +34,10 @@ module Stannp
34
34
  PostcardsResource.new(client: self)
35
35
  end
36
36
 
37
+ def letters
38
+ LettersResource.new(client: self)
39
+ end
40
+
37
41
  def connection
38
42
  @connection ||= Faraday.new do |conn|
39
43
  conn.url_prefix = BASE_URL
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stannp
4
+ class Batch < Object; end
5
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stannp
4
+ class Letter < Object; end
5
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stannp
4
+ class LettersResource < Resource
5
+ def create(attributes:)
6
+ url = url_for(path: 'letters/create')
7
+ Letter.new(post_request(url, body: attributes).body['data'])
8
+ end
9
+
10
+ def post(attributes:)
11
+ url = url_for(path: 'letters/post')
12
+ Letter.new(post_request(url, body: attributes).body['data'])
13
+ end
14
+
15
+ def get(id:)
16
+ url = url_for(path: "letters/get/#{id}")
17
+ Letter.new(get_request(url).body['data'])
18
+ end
19
+
20
+ def cancel(id:)
21
+ url = url_for(path: 'letters/cancel')
22
+ post_request(url, body: { id: id }).body['success']
23
+ end
24
+
25
+ def batch(attributes:)
26
+ url = url_for(path: 'letters/batch')
27
+ Batch.new(post_request(url, body: attributes).body['data'])
28
+ end
29
+ end
30
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stannp
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.0'
5
5
  end
data/lib/stannp.rb CHANGED
@@ -14,9 +14,12 @@ module Stannp
14
14
  autoload :RecipientsResource, 'stannp/resources/recipients'
15
15
  autoload :AddressesResource, 'stannp/resources/addresses'
16
16
  autoload :PostcardsResource, 'stannp/resources/postcards'
17
+ autoload :LettersResource, 'stannp/resources/letters'
17
18
  # objects
18
19
  autoload :User, 'stannp/objects/user'
19
20
  autoload :Recipient, 'stannp/objects/recipient'
20
21
  autoload :Receipt, 'stannp/objects/receipt'
21
22
  autoload :Postcard, 'stannp/objects/postcard'
23
+ autoload :Letter, 'stannp/objects/letter'
24
+ autoload :Batch, 'stannp/objects/batch'
22
25
  end
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.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k-p-jones
@@ -58,6 +58,8 @@ files:
58
58
  - lib/stannp/error.rb
59
59
  - lib/stannp/list.rb
60
60
  - lib/stannp/object.rb
61
+ - lib/stannp/objects/batch.rb
62
+ - lib/stannp/objects/letter.rb
61
63
  - lib/stannp/objects/postcard.rb
62
64
  - lib/stannp/objects/receipt.rb
63
65
  - lib/stannp/objects/recipient.rb
@@ -65,6 +67,7 @@ files:
65
67
  - lib/stannp/resource.rb
66
68
  - lib/stannp/resources/account.rb
67
69
  - lib/stannp/resources/addresses.rb
70
+ - lib/stannp/resources/letters.rb
68
71
  - lib/stannp/resources/postcards.rb
69
72
  - lib/stannp/resources/recipients.rb
70
73
  - lib/stannp/resources/user.rb