trycourier 1.0.0 → 1.0.1

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: c5fd74b5fd13d1df8a4a0eb4dbdf51d81fa18296a511e40c7cff04cd6b071e73
4
- data.tar.gz: '096936274e4e4136493b0647683ad82b07b05848dc5e43e26b66b685713355a8'
3
+ metadata.gz: 5b256b56c28effeb0a31e46d1d4d38626527e9bd2e740f4395137624fd46a9b0
4
+ data.tar.gz: 1933d201eef9368b794166b48cf5723b5f3f442ef6e6ca0b61c5a2efd0a979ff
5
5
  SHA512:
6
- metadata.gz: d87355c131b45bc5a7a5d14f1669c0013448d01e7c24ce69874917d96324d0682e21072f4f36bb82bd0a004300767f3c5d3d3c1eba13e6bd161ea2c4f5bb1411
7
- data.tar.gz: ecc59711579d942524e99d478755206940a1cc372ef4b2affdc7bd7eb31b5cbcbd2021fc61e3f5ac443e2e2524751c34d57b58a5b72c46723363ad7e453d48bf
6
+ metadata.gz: f78837d22fe0c63fad281ed61c676aa1d8af8a8685a3a3af35ac2b587ee3e772d0f9e16eae763be6e030aee1caa39f7065dddcbb74123c7b32a56fbd1038327a
7
+ data.tar.gz: e0499506e39f2a6e33178f7de0dc43b184dc7b05ced7d88a04d4f0af7f4d67dba5a8844a9f971293c92e661f80ded499bb20e3c4172ddda8b93fff625ba4ea46
data/README.md CHANGED
@@ -24,10 +24,16 @@ Or install it yourself as:
24
24
  require "trycourier"
25
25
 
26
26
  begin
27
- client = Courier::Client.new ApiKey
27
+ client = Courier::Client.new "your-auth-token" # or set via COURIER_AUTH_TOKEN env var
28
28
  res = client.send({
29
- "event" => Event,
30
- "recipient" => Recipient,
29
+ "event" => "your-event-id",
30
+ "recipient" => "your-recipient-id",
31
+
32
+ "profile" => {
33
+ "email": "example@example.com",
34
+ "phone_number": "555-867-5309"
35
+ },
36
+
31
37
  "data" => {
32
38
  "world" => "Ruby!"
33
39
  }
@@ -18,9 +18,12 @@ module Courier
18
18
  end
19
19
 
20
20
  class Client
21
- def initialize(api_key)
22
- @api_key = api_key
21
+ def initialize(auth_token = nil)
22
+ @auth_token = auth_token || ENV['COURIER_AUTH_TOKEN']
23
23
  @uri = URI.parse('https://api.trycourier.app/send')
24
+ if @auth_token == nil or @auth_token == ""
25
+ raise InputError, "Client requires an auth_token be supplied."
26
+ end
24
27
  end
25
28
 
26
29
  def send(body)
@@ -41,8 +44,9 @@ module Courier
41
44
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
42
45
 
43
46
  req = Net::HTTP::Post.new(@uri)
44
- req["authorization"] = "Bearer #{@api_key}"
47
+ req["authorization"] = "Bearer #{@auth_token}"
45
48
  req["content-type"] = "application/json"
49
+ req["User-Agent"] = "courier-ruby/#{Courier::VERSION}"
46
50
  req.body = body.to_json
47
51
 
48
52
  res = http.request(req)
@@ -1,3 +1,3 @@
1
1
  module Courier
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trycourier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Courier