stannp 0.6.0 → 0.7.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/campaign.rb +5 -0
- data/lib/stannp/objects/campaign_cost.rb +5 -0
- data/lib/stannp/resources/campaigns.rb +50 -0
- data/lib/stannp/version.rb +1 -1
- data/lib/stannp.rb +3 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e29851d6d5a2f08247c7840729b21d9da1db101165deae90e43560fabd6db13
|
4
|
+
data.tar.gz: 258c841164c6abd4312f156252b9087e6fdc75f55708d874dd99e82d7cf223f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0800d2c215fb73f6f5d559a5e1bd1ff4cc8025cdedd61d452088adc4efa5288c7221a7a35733d5a1a046e9fd96f1cf4f8527d793676560bbca6bedd1602f386b'
|
7
|
+
data.tar.gz: 0b92c7ad6ae8f5d6dba704d85c6827e4f9aadd6e10ca9d5a4f5426e963465becc637f411bb2567b790e304d9b7d86f5a3180371c40c17c7b4c2e36f1c8e85618
|
data/CHANGELOG.md
CHANGED
data/lib/stannp/client.rb
CHANGED
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Stannp
|
4
|
+
class CampaignsResource < Resource
|
5
|
+
def list
|
6
|
+
url = url_for(path: 'campaigns/list')
|
7
|
+
List.from_request(data: get_request(url).body['data'], type: Campaign)
|
8
|
+
end
|
9
|
+
|
10
|
+
def get(id:)
|
11
|
+
url = url_for(path: "campaigns/get/#{id}")
|
12
|
+
Campaign.new(get_request(url).body['data'])
|
13
|
+
end
|
14
|
+
|
15
|
+
def cost(id:)
|
16
|
+
url = url_for(path: 'campaigns/cost')
|
17
|
+
CampaignCost.new(post_request(url, body: { id: id }).body['data'])
|
18
|
+
end
|
19
|
+
|
20
|
+
def available_booking_dates(start_date: nil, end_date: nil)
|
21
|
+
url = url_for(path: 'campaigns/availableDates')
|
22
|
+
post_request(url, body: { start: start_date, end: end_date }).body['data']
|
23
|
+
end
|
24
|
+
|
25
|
+
def create(attributes:)
|
26
|
+
url = url_for(path: 'campaigns/create')
|
27
|
+
Campaign.new(id: post_request(url, body: attributes).body['data'])
|
28
|
+
end
|
29
|
+
|
30
|
+
def sample_url(id:)
|
31
|
+
url = url_for(path: 'campaigns/sample')
|
32
|
+
post_request(url, body: { id: id }).body['data']
|
33
|
+
end
|
34
|
+
|
35
|
+
def approve(id:)
|
36
|
+
url = url_for(path: 'campaigns/approve')
|
37
|
+
post_request(url, body: { id: id }).body['success']
|
38
|
+
end
|
39
|
+
|
40
|
+
def delete(id:)
|
41
|
+
url = url_for(path: 'campaigns/delete')
|
42
|
+
post_request(url, body: { id: id }).body['success']
|
43
|
+
end
|
44
|
+
|
45
|
+
def book(id:, **options)
|
46
|
+
url = url_for(path: 'campaigns/book')
|
47
|
+
post_request(url, body: { id: id }.merge(options)).body['success']
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/stannp/version.rb
CHANGED
data/lib/stannp.rb
CHANGED
@@ -16,6 +16,7 @@ module Stannp
|
|
16
16
|
autoload :PostcardsResource, 'stannp/resources/postcards'
|
17
17
|
autoload :LettersResource, 'stannp/resources/letters'
|
18
18
|
autoload :GroupsResource, 'stannp/resources/groups'
|
19
|
+
autoload :CampaignsResource, 'stannp/resources/campaigns'
|
19
20
|
# objects
|
20
21
|
autoload :User, 'stannp/objects/user'
|
21
22
|
autoload :Recipient, 'stannp/objects/recipient'
|
@@ -24,4 +25,6 @@ module Stannp
|
|
24
25
|
autoload :Letter, 'stannp/objects/letter'
|
25
26
|
autoload :Batch, 'stannp/objects/batch'
|
26
27
|
autoload :Group, 'stannp/objects/group'
|
28
|
+
autoload :Campaign, 'stannp/objects/campaign'
|
29
|
+
autoload :CampaignCost, 'stannp/objects/campaign_cost'
|
27
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stannp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- k-p-jones
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -59,6 +59,8 @@ files:
|
|
59
59
|
- lib/stannp/list.rb
|
60
60
|
- lib/stannp/object.rb
|
61
61
|
- lib/stannp/objects/batch.rb
|
62
|
+
- lib/stannp/objects/campaign.rb
|
63
|
+
- lib/stannp/objects/campaign_cost.rb
|
62
64
|
- lib/stannp/objects/group.rb
|
63
65
|
- lib/stannp/objects/letter.rb
|
64
66
|
- lib/stannp/objects/postcard.rb
|
@@ -68,6 +70,7 @@ files:
|
|
68
70
|
- lib/stannp/resource.rb
|
69
71
|
- lib/stannp/resources/account.rb
|
70
72
|
- lib/stannp/resources/addresses.rb
|
73
|
+
- lib/stannp/resources/campaigns.rb
|
71
74
|
- lib/stannp/resources/groups.rb
|
72
75
|
- lib/stannp/resources/letters.rb
|
73
76
|
- lib/stannp/resources/postcards.rb
|