peat 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/peat/client.rb +13 -5
- data/lib/peat/version.rb +1 -1
- data/lib/peat.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6458716c3b767d619513a812ae31734feb46cb2
|
4
|
+
data.tar.gz: 3c44d3b47f367d2150d2764df01c2b6c5b5ec343
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e88ead8d052a1622ba6da04fb9de2360785c7bfdc84701e8c43a76a844a5f8a693ec0f3a24f21dbbaf8987d533a696a8f96f1ef7562b4eccc73f1e1d8650f1b7
|
7
|
+
data.tar.gz: 140a8380a08b6be8ee390642cba400e86d44709647e0221495733587839b71ed7fc418a45faf6bfe4f7a65e113d368457479fe527ead4fce2fd15d8c18d4e9bf
|
data/lib/peat/client.rb
CHANGED
@@ -1,18 +1,22 @@
|
|
1
1
|
module Peat
|
2
|
-
|
3
|
-
|
2
|
+
class Client
|
3
|
+
|
4
|
+
def initialize(middleware: [], adapter: Faraday.default_adapter)
|
5
|
+
@middleware = middleware
|
6
|
+
@adapter = adapter
|
7
|
+
end
|
4
8
|
|
5
9
|
def connection
|
6
10
|
@connection ||= Faraday.new(url: "https://www.exacttargetapis.com/messaging/v1/") do |conn|
|
7
11
|
conn.request :json
|
8
12
|
|
9
|
-
conn.
|
13
|
+
@middleware.each { |m| conn.use m }
|
10
14
|
|
11
|
-
conn.adapter
|
15
|
+
conn.adapter @adapter
|
12
16
|
end
|
13
17
|
end
|
14
18
|
|
15
|
-
def deliver(trigger_name, params)
|
19
|
+
def deliver(trigger_name, params)
|
16
20
|
resp = connection.post do |req|
|
17
21
|
req.url "messageDefinitionSends/key:#{trigger_name}/send"
|
18
22
|
req.headers['Content-Type'] = 'application/json'
|
@@ -22,5 +26,9 @@ module Peat
|
|
22
26
|
|
23
27
|
resp.success?
|
24
28
|
end
|
29
|
+
|
30
|
+
def deliver!(trigger_name, params)
|
31
|
+
deliver(trigger_name, params) or raise Peat::DeliveryFailed
|
32
|
+
end
|
25
33
|
end
|
26
34
|
end
|
data/lib/peat/version.rb
CHANGED
data/lib/peat.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hubert Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|