simple_spark 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +52 -8
- data/lib/simple_spark/client.rb +7 -7
- data/lib/simple_spark/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48f67a4d104d2173d2e603bf2408f0e487c5a7fa
|
4
|
+
data.tar.gz: 558790542ce8eaa9de855a100551687cc6cd5d69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9cdf1aeddc939693f6cd34be0712a890ef0810301cdb69b7ed910d9ce2d5c8c1f5e8e4461620e057ec0dd1c805ad8426491cb787d6c7a3e4ebc99aaabd4524c
|
7
|
+
data.tar.gz: 9dc6f8b0cb0e29cf1a1b7fbf1aede1cbb30d9a7f812e454cced9eef79ecb63255649e981af413a65da5e96e303164eaba9c3ac1632005b0de737c348189aa879
|
data/README.md
CHANGED
@@ -102,7 +102,13 @@ simple_spark.metrics.discoverability_links
|
|
102
102
|
Summary of metrics
|
103
103
|
|
104
104
|
```ruby
|
105
|
-
|
105
|
+
properties = {
|
106
|
+
from: '2013-04-20T07:12',
|
107
|
+
to: '2018-04-20T07:12',
|
108
|
+
metrics: 'count_accepted',
|
109
|
+
timezone: 'America/New_York'
|
110
|
+
}
|
111
|
+
simple_spark.metrics.deliverability_metrics_summary(properties)
|
106
112
|
```
|
107
113
|
|
108
114
|
<a href="https://developers.sparkpost.com/api/#/reference/metrics/discoverability-links/deliverability-metrics-summary" target="_blank">see SparkPost API Documentation</a>
|
@@ -112,7 +118,13 @@ simple_spark.metrics.deliverability_metrics_summary(from: '2013-04-20T07:12', to
|
|
112
118
|
Metrics grouped by Domain
|
113
119
|
|
114
120
|
```ruby
|
115
|
-
|
121
|
+
properties = {
|
122
|
+
from: '2013-04-20T07:12',
|
123
|
+
to: '2018-04-20T07:12',
|
124
|
+
metrics: 'count_accepted',
|
125
|
+
timezone: 'America/New_York'
|
126
|
+
}
|
127
|
+
simple_spark.metrics.deliverability_metrics_by_domain(properties)
|
116
128
|
```
|
117
129
|
|
118
130
|
<a href="https://developers.sparkpost.com/api/#/reference/metrics/deliverability-metrics/deliverability-metrics-by-domain" target="_blank">see SparkPost API Documentation</a>
|
@@ -122,7 +134,13 @@ simple_spark.metrics.deliverability_metrics_by_domain(from: '2013-04-20T07:12',
|
|
122
134
|
Metrics grouped by Sending Domain
|
123
135
|
|
124
136
|
```ruby
|
125
|
-
|
137
|
+
properties = {
|
138
|
+
from: '2013-04-20T07:12',
|
139
|
+
to: '2018-04-20T07:12',
|
140
|
+
metrics: 'count_accepted',
|
141
|
+
timezone: 'America/New_York'
|
142
|
+
}
|
143
|
+
simple_spark.metrics.deliverability_metrics_by_sending_domain(properties)
|
126
144
|
```
|
127
145
|
|
128
146
|
<a href="https://developers.sparkpost.com/api/#/reference/metrics/deliverability-metrics/deliverability-metrics-by-sending-domain" target="_blank">see SparkPost API Documentation</a>
|
@@ -132,7 +150,13 @@ simple_spark.metrics.deliverability_metrics_by_sending_domain(from: '2013-04-20T
|
|
132
150
|
Metrics grouped by Subaccount
|
133
151
|
|
134
152
|
```ruby
|
135
|
-
|
153
|
+
properties = {
|
154
|
+
from: '2013-04-20T07:12',
|
155
|
+
to: '2018-04-20T07:12',
|
156
|
+
metrics: 'count_accepted',
|
157
|
+
timezone: 'America/New_York'
|
158
|
+
}
|
159
|
+
simple_spark.metrics.deliverability_metrics_by_subaccount(properties)
|
136
160
|
```
|
137
161
|
|
138
162
|
<a href="https://developers.sparkpost.com/api/#/reference/metrics/deliverability-metrics/deliverability-metrics-by-subaccount" target="_blank">see SparkPost API Documentation</a>
|
@@ -142,7 +166,13 @@ simple_spark.metrics.deliverability_metrics_by_subaccount(from: '2013-04-20T07:1
|
|
142
166
|
Metrics grouped by Campaign
|
143
167
|
|
144
168
|
```ruby
|
145
|
-
|
169
|
+
properties = {
|
170
|
+
from: '2013-04-20T07:12',
|
171
|
+
to: '2018-04-20T07:12',
|
172
|
+
metrics: 'count_accepted',
|
173
|
+
timezone: 'America/New_York'
|
174
|
+
}
|
175
|
+
simple_spark.metrics.deliverability_metrics_by_campaign(properties)
|
146
176
|
```
|
147
177
|
|
148
178
|
<a href="https://developers.sparkpost.com/api/#/reference/metrics/deliverability-metrics/deliverability-metrics-by-campaign" target="_blank">see SparkPost API Documentation</a>
|
@@ -152,7 +182,13 @@ simple_spark.metrics.deliverability_metrics_by_campaign(from: '2013-04-20T07:12'
|
|
152
182
|
Metrics grouped by Template
|
153
183
|
|
154
184
|
```ruby
|
155
|
-
|
185
|
+
properties = {
|
186
|
+
from: '2013-04-20T07:12',
|
187
|
+
to: '2018-04-20T07:12',
|
188
|
+
metrics: 'count_accepted',
|
189
|
+
timezone: 'America/New_York'
|
190
|
+
}
|
191
|
+
simple_spark.metrics.deliverability_metrics_by_template(properties)
|
156
192
|
```
|
157
193
|
|
158
194
|
<a href="https://developers.sparkpost.com/api/#/reference/metrics/deliverability-metrics/deliverability-metrics-by-template" target="_blank">see SparkPost API Documentation</a>
|
@@ -243,10 +279,14 @@ simple_spark.subaccounts.list
|
|
243
279
|
Create a new Subaccount
|
244
280
|
|
245
281
|
```ruby
|
246
|
-
|
282
|
+
properties = {
|
283
|
+
name: 'Sparkle Ponies', key_label: 'API Key for Sparkle Ponies Subaccount',
|
284
|
+
key_grants: ['smtp/inject', 'sending_domains/manage', 'message_events/view', 'suppression_lists/manage']
|
285
|
+
}
|
286
|
+
simple_spark.subaccounts.create(properties)
|
247
287
|
```
|
248
288
|
|
249
|
-
<a href="
|
289
|
+
<a href="https://developers.sparkpost.com/api/#/reference/subaccounts/subaccounts-collection/create-new-subaccount" target="_blank">see SparkPost API Documentation</a>
|
250
290
|
|
251
291
|
#### Retrieve
|
252
292
|
|
@@ -626,6 +666,10 @@ simple_spark.templates.delete(yourtemplateid)
|
|
626
666
|
|
627
667
|
## Changelog
|
628
668
|
|
669
|
+
### 0.0.6
|
670
|
+
|
671
|
+
Fixed accidental bug
|
672
|
+
|
629
673
|
### 0.0.5
|
630
674
|
|
631
675
|
- Subaccounts endpoint added
|
data/lib/simple_spark/client.rb
CHANGED
@@ -4,12 +4,12 @@ require 'json'
|
|
4
4
|
|
5
5
|
module SimpleSpark
|
6
6
|
class Client
|
7
|
-
def initialize(
|
8
|
-
@api_key =
|
9
|
-
@api_host =
|
10
|
-
@base_path =
|
11
|
-
@subaccount_id =
|
12
|
-
@headers =
|
7
|
+
def initialize(opts = {})
|
8
|
+
@api_key = opts[:api_key] || ENV['SPARKPOST_API_KEY']
|
9
|
+
@api_host = opts[:api_host] || 'https://api.sparkpost.com'
|
10
|
+
@base_path = opts[:base_path] || '/api/v1/'
|
11
|
+
@subaccount_id = opts[:subaccount_id]
|
12
|
+
@headers = opts[:headers]
|
13
13
|
|
14
14
|
fail Exceptions::InvalidConfiguration.new, 'You must provide a SparkPost API key' unless @api_key
|
15
15
|
fail Exceptions::InvalidConfiguration.new, 'You must provide a SparkPost API host' unless @api_host # this should never occur unless the default above is changed
|
@@ -18,7 +18,7 @@ module SimpleSpark
|
|
18
18
|
|
19
19
|
rails_development = true & defined?(Rails) && Rails.env.development?
|
20
20
|
|
21
|
-
@debug =
|
21
|
+
@debug = opts[:debug].nil? ? rails_development : opts[:debug]
|
22
22
|
|
23
23
|
@session = Excon.new(@api_host, debug: @debug)
|
24
24
|
end
|
data/lib/simple_spark/version.rb
CHANGED