promoter 0.1.0 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +93 -7
- data/lib/promoter/errors.rb +2 -0
- data/lib/promoter/feedback.rb +0 -4
- data/lib/promoter/metric.rb +2 -2
- data/lib/promoter/version.rb +1 -1
- data/promoter.gemspec +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82b302c42afebc4958d965828131b4bd1ae7e226
|
4
|
+
data.tar.gz: 390dcdb37ac48a67c7c350ba766522333fc83900
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cb56545fbffca1530de00a8d1bde82d8ffce90093a4a8dcd9ff0b7b4f2c5077c7046ece2a78fa55ddf1a501ac21ebba1b80fe6e4627da37c8ce8e62bceb28c4
|
7
|
+
data.tar.gz: 7eb2ef3606aac16577343b596886a4fc4a264bdac31f68e66dc94b60bd459e2c82c6c73a4b1fdc562c19fccb6f754e8c9749ce30b5095a727421b1c379c15022
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
# Promoter
|
2
2
|
|
3
|
-
|
3
|
+
promoter is a wrapper for the promoter.io REST API.
|
4
4
|
|
5
|
-
|
5
|
+
You can find the promoter.io api docs here: https://promoterio.github.io/api/
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
|
+
First off you need to grab your [promoter.io](http://www.promoter.io) api key.
|
10
|
+
|
9
11
|
Add this line to your application's Gemfile:
|
10
12
|
|
11
13
|
```ruby
|
@@ -20,15 +22,99 @@ Or install it yourself as:
|
|
20
22
|
|
21
23
|
$ gem install promoter
|
22
24
|
|
23
|
-
|
25
|
+
Set your api key with:
|
26
|
+
```ruby
|
27
|
+
Promoter.api_key = 'YOUR API KEY'
|
28
|
+
```
|
29
|
+
(Put this into an initializer i.e. ```app/initializers/promoter.rb``` if using Rails.)
|
30
|
+
|
31
|
+
## Feedback
|
32
|
+
### Get all feedback
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
Promoter::Feedback.all(score: 8) # => returns all feedback with a score of 8
|
36
|
+
```
|
37
|
+
|
38
|
+
Possible filters:
|
39
|
+
```score``` Filter by the score
|
40
|
+
```score_type``` Filters by the score type: ```promoter```, ```detractor```, ```passive```
|
41
|
+
```survey_campaign``` Filter by the campaign id
|
42
|
+
```survey_campaign_status``` Filter by the campaign status: ```ACTIVE```, ```COMPLETE```
|
43
|
+
|
44
|
+
### Get a specific feedback
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
Promoter::Feedback.find(79) #=> id of the feedback to return
|
48
|
+
```
|
49
|
+
|
50
|
+
## Contacts
|
51
|
+
|
52
|
+
### Get all contacts
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
Promoter::Contact.all(2) # => this is paginated - returns page 2 of results
|
56
|
+
```
|
57
|
+
|
58
|
+
### Get a specific contact
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
Promoter::Contact.find(897)
|
62
|
+
```
|
63
|
+
|
64
|
+
### Create a contact
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
Promoter::Contact.create(email: "chris@lexoo.co.uk", # required
|
68
|
+
first_name: "Chris", # optional
|
69
|
+
last_name: "O'Sullivan", # optional
|
70
|
+
contact_list: [599], # array of contact list ids to add to
|
71
|
+
campaign: 78, # campaign which this belongs to
|
72
|
+
attributes: { plan: 'silver' } # any extra data you want to add to the contact
|
73
|
+
send: false ) # set this to true to send the NPS immediately
|
74
|
+
```
|
75
|
+
|
76
|
+
## Campaigns
|
77
|
+
### Get all campaigns
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
Promoter::Campaign.all(2) # => this is paginated - returns page 2 of results
|
81
|
+
```
|
24
82
|
|
25
|
-
|
83
|
+
### Send surveys for a campaign
|
26
84
|
|
27
|
-
|
85
|
+
```ruby
|
86
|
+
Promoter::Campaign.send_surveys(33, false)
|
87
|
+
```
|
88
|
+
|
89
|
+
This takes two parameters, the campaign id, and a boolean as to send out surveys to ALL of the customers for the campaign. (This is defaulted to false!)
|
28
90
|
|
29
|
-
|
91
|
+
## Contact lists
|
92
|
+
### Get all contact lists
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
Promoter::ContactList.all(2) # => this is paginated - returns page 2 of results
|
96
|
+
```
|
30
97
|
|
31
|
-
|
98
|
+
### Get All Contacts for a Contact List
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
Promoter::ContactList.contact_ids_for(2)
|
102
|
+
# => returns an array of contact ids for a contact list id
|
103
|
+
```
|
104
|
+
|
105
|
+
### Remove a contact from a contact list
|
106
|
+
|
107
|
+
```ruby
|
108
|
+
Promoter::ContactList.remove_contact(contact_list_id: 7899,
|
109
|
+
contact_id: 15777)
|
110
|
+
```
|
111
|
+
|
112
|
+
## Metrics
|
113
|
+
|
114
|
+
```ruby
|
115
|
+
Promoter::Metric.all
|
116
|
+
# => returns a list of interesting metrics that promoter has for your account
|
117
|
+
```
|
32
118
|
|
33
119
|
## Contributing
|
34
120
|
|
data/lib/promoter/errors.rb
CHANGED
data/lib/promoter/feedback.rb
CHANGED
@@ -43,10 +43,6 @@ module Promoter
|
|
43
43
|
private
|
44
44
|
|
45
45
|
def self.query_string(attrs)
|
46
|
-
# campaign_id is preferable to survey_campaign (which is what promoter expects)
|
47
|
-
if attrs.has_key?(:campaign_id)
|
48
|
-
attrs[:survey_campaign] = attrs.delete(:campaign_id)
|
49
|
-
end
|
50
46
|
URI.encode_www_form(attrs)
|
51
47
|
end
|
52
48
|
|
data/lib/promoter/metric.rb
CHANGED
@@ -12,8 +12,8 @@ module Promoter
|
|
12
12
|
@organization_nps = attrs["organization_nps"].to_f
|
13
13
|
end
|
14
14
|
|
15
|
-
def self.all
|
16
|
-
response = Request.get("#{API_URL}
|
15
|
+
def self.all
|
16
|
+
response = Request.get("#{API_URL}/")
|
17
17
|
response['results'].map {|attrs| new(attrs)}
|
18
18
|
end
|
19
19
|
|
data/lib/promoter/version.rb
CHANGED
data/promoter.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: promoter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris O'Sullivan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: byebug
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: httparty
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|