stannp 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/stannp/client.rb +4 -0
- data/lib/stannp/objects/batch.rb +5 -0
- data/lib/stannp/objects/letter.rb +5 -0
- data/lib/stannp/resources/letters.rb +30 -0
- data/lib/stannp/version.rb +1 -1
- data/lib/stannp.rb +3 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bff3ab1efdd21197064698fddde52daa93d9c4231d9d07ecc1d77be3e654c3d9
|
4
|
+
data.tar.gz: '059d4ec23e07c853a2c0134f2c0ecbecd05dc0ee174c2db538614f7954db24a1'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c280a7cfb8cc8199ead8628cf599556e19ffd06298507630211e2a0e4c062a2f389bb54ecc010635e2fec148ebcdfcbecb09da9f5c3285097e2f6bd9bd609a08
|
7
|
+
data.tar.gz: 33ea9120a90755f163ad2b4597679da35c28b99d9a73550498259a558fb3b46d1efd582e434e586c7bf34afb4dcf9976bf7552ed2711bce7d9159277142a63c7
|
data/CHANGELOG.md
CHANGED
data/lib/stannp/client.rb
CHANGED
@@ -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
|
data/lib/stannp/version.rb
CHANGED
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
|
+
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
|