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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95792b0b464ff9072200693024cf2cf5d115ef39
4
- data.tar.gz: a5d4acfaaa3381413c4fe093167f35453c4df479
3
+ metadata.gz: 82b302c42afebc4958d965828131b4bd1ae7e226
4
+ data.tar.gz: 390dcdb37ac48a67c7c350ba766522333fc83900
5
5
  SHA512:
6
- metadata.gz: 38f0998be10fee79e559bfa8303a52a155034e1e7a60eadfa8aaa20a08c544f3fd91cb1f972f475b0ac6b3f1bb18e2d9172e2309c60857515f0acc86f0141ed0
7
- data.tar.gz: 8cde91e251abc021b76eb4c4e8d387cce2c16fa9bb42198db60e83db2d8a5766ba2c0f3a1fb0a1ddc672ebce7e09df01c4d4356bf87840bb4adc8a0255b2c2b1
6
+ metadata.gz: 4cb56545fbffca1530de00a8d1bde82d8ffce90093a4a8dcd9ff0b7b4f2c5077c7046ece2a78fa55ddf1a501ac21ebba1b80fe6e4627da37c8ce8e62bceb28c4
7
+ data.tar.gz: 7eb2ef3606aac16577343b596886a4fc4a264bdac31f68e66dc94b60bd459e2c82c6c73a4b1fdc562c19fccb6f754e8c9749ce30b5095a727421b1c379c15022
data/.gitignore CHANGED
@@ -8,3 +8,4 @@
8
8
  /pkg/
9
9
  /spec/reports/
10
10
  /tmp/
11
+ *.gem
data/README.md CHANGED
@@ -1,11 +1,13 @@
1
1
  # Promoter
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/promoter`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ promoter is a wrapper for the promoter.io REST API.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
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
- ## Usage
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
- TODO: Write usage instructions here
83
+ ### Send surveys for a campaign
26
84
 
27
- ## Development
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
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
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
- 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` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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
 
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  module Promoter
2
4
  module Errors
3
5
  class BadRequest < StandardError; end
@@ -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
 
@@ -12,8 +12,8 @@ module Promoter
12
12
  @organization_nps = attrs["organization_nps"].to_f
13
13
  end
14
14
 
15
- def self.all(page=1)
16
- response = Request.get("#{API_URL}/?page=#{page}")
15
+ def self.all
16
+ response = Request.get("#{API_URL}/")
17
17
  response['results'].map {|attrs| new(attrs)}
18
18
  end
19
19
 
@@ -1,3 +1,3 @@
1
1
  module Promoter
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.4"
3
3
  end
data/promoter.gemspec CHANGED
@@ -22,7 +22,6 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_development_dependency "rspec"
24
24
  spec.add_development_dependency "webmock"
25
- spec.add_development_dependency "byebug"
26
25
 
27
26
  spec.add_dependency "httparty"
28
27
  spec.add_dependency "json"
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.0
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-06-30 00:00:00.000000000 Z
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