banana_peels 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/lib/banana_peels/campaign.rb +13 -2
- data/lib/banana_peels/version.rb +1 -1
- 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: 0b18d21c1895b884cac8e6c5d5496138bb16728b
|
4
|
+
data.tar.gz: d2716ccbaf4deb4ab23724c8618b6872546900d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f7dd092dfd1363fcf8b2c61600c742e094e9b835b3b09f9ac0d0a23e934278e4f72c93fc0363a7e0476651c7ca9c22ee4be7556a2c485ba83ea24b2a8c28679
|
7
|
+
data.tar.gz: 5ff0c40326c0cdf334cea7a024c2c9d4b317a56b520560857618e0d0b315ebfdd435be63bc5cbf624e00ac49c18107b24b28524f71b2edf24376a86e2388dc29
|
data/README.md
CHANGED
@@ -99,6 +99,18 @@ end
|
|
99
99
|
And then use the merge tags `*|FIRST_NAME|*`, `*|LAST_NAME|*`, `*|RESET_PASSWORD_URL|*` in your MailChimp Campaign.
|
100
100
|
|
101
101
|
|
102
|
+
### Caching
|
103
|
+
|
104
|
+
To enable a rudimentary cache, set:
|
105
|
+
```ruby
|
106
|
+
ENV['BANANA_PEELS_CACHE'] = 'ON'
|
107
|
+
```
|
108
|
+
|
109
|
+
This caches the responses for identical API & argument combinations,
|
110
|
+
and modifies individual campaign metadata calls to retrieve the metadata
|
111
|
+
for all campaigns.
|
112
|
+
|
113
|
+
|
102
114
|
## Contributing
|
103
115
|
|
104
116
|
1. Fork it
|
@@ -17,6 +17,7 @@ class BananaPeels::Campaign
|
|
17
17
|
def initialize(campaign_id, merge_tags, api_key)
|
18
18
|
@campaign_id = campaign_id
|
19
19
|
@raw_merge_tags = merge_tags
|
20
|
+
@api_key = api_key
|
20
21
|
@api = BananaPeels.api(api_key)
|
21
22
|
end
|
22
23
|
|
@@ -25,8 +26,18 @@ class BananaPeels::Campaign
|
|
25
26
|
end
|
26
27
|
|
27
28
|
def mailchimp_meta
|
28
|
-
|
29
|
-
|
29
|
+
@mailchimp_meta ||=
|
30
|
+
begin
|
31
|
+
meta = nil
|
32
|
+
if BananaPeels::API.cache?
|
33
|
+
campaigns_list_data = BananaPeels.campaigns_list(@api_key)
|
34
|
+
meta = campaigns_list_data.find{|camp| camp['id'] == @campaign_id }
|
35
|
+
end
|
36
|
+
unless meta
|
37
|
+
meta = @api.campaigns.list({ campaign_id: @campaign_id })['data'].first
|
38
|
+
end
|
39
|
+
meta
|
40
|
+
end
|
30
41
|
end
|
31
42
|
def mailchimp_meta=(mailchimp_meta)
|
32
43
|
@mailchimp_meta = mailchimp_meta
|
data/lib/banana_peels/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: banana_peels
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Bull
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|