pigeon-ruby 0.6.4 → 0.6.5
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 +4 -4
- data/README.md +12 -0
- data/lib/pigeon-ruby/client.rb +12 -4
- data/lib/pigeon-ruby/config.rb +1 -0
- data/lib/pigeon-ruby/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d58454e15366079bbe09c2621460b1e43da1d80ef1ab1ab207fadea6e9ce5ed8
|
4
|
+
data.tar.gz: dc2b64e8c7ce1e1d485148c24e91ad457ad3126572144ac0c47c7a48a932bfb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c469d5b8857e58f23998bfe430edd146c8e5a41a33c67bcd92f0747b76d2573c649bd29efd6c65ebe3e3695d4d1d32366c799b4a24f3ab86509332a14fcb20b
|
7
|
+
data.tar.gz: ec802b1f7bd635936331d1920bac70f8f467567de14561a7d190f451bec44233be9d169837abb5d23c6bb0412231c6323f5863a574a40a6c9c4d0a948a78a591
|
data/README.md
CHANGED
@@ -80,6 +80,18 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
80
80
|
|
81
81
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
82
82
|
|
83
|
+
### Testing
|
84
|
+
|
85
|
+
You can use the stub option to cause all requests to be stubbed, making it easier to test with this library.
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
Pigeon.configure do |config|
|
89
|
+
.
|
90
|
+
.
|
91
|
+
config.stub = Rails.env.test? # defaults to false
|
92
|
+
end
|
93
|
+
```
|
94
|
+
|
83
95
|
## Contributing
|
84
96
|
|
85
97
|
Bug reports and pull requests are welcome on GitHub at https://github.com/pigeonapp/pigeon-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
data/lib/pigeon-ruby/client.rb
CHANGED
@@ -18,7 +18,7 @@ module Pigeon
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def deliver(message_identifier, attrs)
|
21
|
-
|
21
|
+
send_request(:post, '/deliveries', {
|
22
22
|
body: process_delivery_attributes(attrs).merge({
|
23
23
|
message_identifier: message_identifier
|
24
24
|
})
|
@@ -26,19 +26,19 @@ module Pigeon
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def track(attrs = {})
|
29
|
-
|
29
|
+
send_request(:post, '/event_logs', {
|
30
30
|
body: process_track_attributes(attrs)
|
31
31
|
})
|
32
32
|
end
|
33
33
|
|
34
34
|
def identify(attrs = {})
|
35
|
-
|
35
|
+
send_request(:post, '/customers', {
|
36
36
|
body: process_identify_attributes(attrs)
|
37
37
|
})
|
38
38
|
end
|
39
39
|
|
40
40
|
def add_contact(customer_id, attrs = {})
|
41
|
-
|
41
|
+
send_request(:post, '/contacts', {
|
42
42
|
body: process_contact_attributes(customer_id, attrs)
|
43
43
|
})
|
44
44
|
end
|
@@ -128,5 +128,13 @@ module Pigeon
|
|
128
128
|
def check_presence!(obj, name = obj)
|
129
129
|
raise ArgumentError, "#{name} cannot be blank." if obj.nil? || (obj.is_a?(String) && obj.empty?)
|
130
130
|
end
|
131
|
+
|
132
|
+
def send_request(method, path, options)
|
133
|
+
if !!@config.stub
|
134
|
+
Net::HTTPResponse.new(method, 200, {})
|
135
|
+
else
|
136
|
+
self.class.send(method, path, options)
|
137
|
+
end
|
138
|
+
end
|
131
139
|
end
|
132
140
|
end
|
data/lib/pigeon-ruby/config.rb
CHANGED
data/lib/pigeon-ruby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pigeon-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pradeep Kumar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|