cindy 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Cindy
2
2
 
3
- TODO: Write a gem description
3
+ A lightweight and flexible Ruby SDK for Sendy, a self-hosted email newsletter app.
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,59 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ The API of Cindy was basically implemented after Sendy's API doc.
22
+
23
+ ### Client
24
+
25
+ To use Cindy, first create a client instance:
26
+
27
+ ```ruby
28
+ c = Cindy.new "http://sendy.co/demo/", "QywLZqDddP2P//d6ntekf+GY82nLrHke"
29
+ ```
30
+
31
+ There're two parameters for initialize method:
32
+
33
+ 1. API Endpoint - The URL for Sendy installation.
34
+ 2. API Key - Optional, only for subscription status methods.
35
+
36
+ ### Subscribe / Unsubscribe
37
+
38
+ Then you can subscribe or unsubscribe from a list:
39
+
40
+ ```ruby
41
+ > c.subscribe 1, "foo@bar.com", "Foo Bar"
42
+ => true
43
+ > c.unsubscribe 1, "foo@bar.com"
44
+ => false
45
+ ```
46
+
47
+ The parameters are:
48
+
49
+ 1. List ID - You can find them under list management page.
50
+ 2. Email - Email to subscribe or unsubscribe from the list
51
+ 3. Name - Optional, used only for subscribe
52
+
53
+ ### Subscription Status
54
+
55
+ To check subscription status for Email address:
56
+
57
+ ```ruby
58
+ > c.subscription_status 3, "foo@bar.com"
59
+ => "Unsubscribed"
60
+ ```
61
+
62
+ The parameters are list ID and Email.
63
+
64
+ ### Active Subscriber Count
65
+
66
+ To get active subscriber count of a list:
67
+
68
+ ```ruby
69
+ > c.active_subscriber_count 5
70
+ => 1660
71
+ ```
72
+
73
+ The only required parameter here is list ID.
22
74
 
23
75
  ## Contributing
24
76
 
data/cindy.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
8
8
  gem.version = Cindy::VERSION
9
9
  gem.authors = ["Richard Lee"]
10
10
  gem.email = ["rl@polydice.com"]
11
- gem.description = %q{A lightweight, flexible Ruby SDK for Sendy, a self-hosted email newsletter app.}
11
+ gem.description = %q{A lightweight and flexible Ruby SDK for Sendy, a self-hosted email newsletter app.}
12
12
  gem.summary = %q{Simple Ruby wrapper for Sendy API.}
13
13
  gem.homepage = "https://github.com/polydice/cindy"
14
14
 
data/lib/cindy/client.rb CHANGED
@@ -11,7 +11,7 @@ module Cindy
11
11
  end
12
12
 
13
13
  def subscribe(list_id, email, name = nil)
14
- response = connection.post "/subscribe" do |req|
14
+ response = connection.post "subscribe" do |req|
15
15
  params = {list: list_id, email: email, boolean: true}
16
16
  params[:name] = name if name
17
17
  req.body = params
@@ -21,13 +21,13 @@ module Cindy
21
21
  end
22
22
 
23
23
  def unsubscribe(list_id, email)
24
- response = connection.post "/unsubscribe", {list: list_id, email: email, boolean: true}
24
+ response = connection.post "unsubscribe", {list: list_id, email: email, boolean: true}
25
25
 
26
26
  !!(response.body =~ /^1$/)
27
27
  end
28
28
 
29
29
  def subscription_status(list_id, email)
30
- response = connection.post "/api/subscribers/subscription-status.php" do |req|
30
+ response = connection.post "api/subscribers/subscription-status.php" do |req|
31
31
  req.body = {list_id: list_id, email: email, api_key: @key}
32
32
  end
33
33
 
@@ -35,7 +35,7 @@ module Cindy
35
35
  end
36
36
 
37
37
  def active_subscriber_count(list_id)
38
- response = connection.post "/api/subscribers/active-subscriber-count.php" do |req|
38
+ response = connection.post "api/subscribers/active-subscriber-count.php" do |req|
39
39
  req.body = {list_id: list_id, api_key: @key}
40
40
  end
41
41
 
data/lib/cindy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cindy
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cindy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-08 00:00:00.000000000 Z
12
+ date: 2013-02-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -91,7 +91,7 @@ dependencies:
91
91
  - - ~>
92
92
  - !ruby/object:Gem::Version
93
93
  version: 2.12.0
94
- description: A lightweight, flexible Ruby SDK for Sendy, a self-hosted email newsletter
94
+ description: A lightweight and flexible Ruby SDK for Sendy, a self-hosted email newsletter
95
95
  app.
96
96
  email:
97
97
  - rl@polydice.com
@@ -126,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
126
  version: '0'
127
127
  segments:
128
128
  - 0
129
- hash: -3277110265652980216
129
+ hash: 458817470036857709
130
130
  required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  none: false
132
132
  requirements:
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  version: '0'
136
136
  segments:
137
137
  - 0
138
- hash: -3277110265652980216
138
+ hash: 458817470036857709
139
139
  requirements: []
140
140
  rubyforge_project:
141
141
  rubygems_version: 1.8.23