cindy 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a789e5f76abe87afdea1484025133acf9cb29c8b
4
+ data.tar.gz: 255fc1cb5d72c868518745017bfec8d15214afa3
5
+ SHA512:
6
+ metadata.gz: 0f5a27dea85815171a10bbd8b304df648a173dae7cf8bd909c664ab2ac330d4aaa4848bb10925e5140d68f3d79c7375dc93c1535f7dcead38d4c7b8a63c4217a
7
+ data.tar.gz: 08627111d620c02c3f9714afb552a11fe0907afe6c7b327ec0e4651c2ae6250e7cba0934a85f667945adb21b1799ae69c53ca11c9e88ae1fab16e276e7651e1f
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ ## 0.2.0
2
+
3
+ * Add create campaigns API
4
+
5
+ ## 0.1.1
6
+
7
+ * Fix URL path issues when Sendy installed in a folder
8
+
9
+ ## 0.1.0
10
+
11
+ * First release
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Richard Lee
1
+ Copyright (c) 2014-2015 Polydice, Inc. http://polydice.com
2
2
 
3
3
  MIT License
4
4
 
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
19
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
20
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
21
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,24 +1,10 @@
1
1
  # Cindy
2
2
 
3
- A lightweight and flexible Ruby SDK for Sendy, a self-hosted email newsletter app.
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'cindy'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
- $ gem install cindy
3
+ A lightweight and flexible Ruby SDK for [Sendy](http://sendy.co), a self-hosted email newsletter app.
18
4
 
19
5
  ## Usage
20
6
 
21
- The API of Cindy was basically implemented after Sendy's API doc.
7
+ The API of Cindy was basically implemented after [Sendy's API documentation](http://sendy.co/api).
22
8
 
23
9
  ### Client
24
10
 
@@ -38,44 +24,43 @@ There're two parameters for initialize method:
38
24
  Then you can subscribe or unsubscribe from a list:
39
25
 
40
26
  ```ruby
41
- > c.subscribe 1, "foo@bar.com", "Foo Bar"
27
+ > c.subscribe list_id, "foo@bar.com", "My Name"
42
28
  => true
43
- > c.unsubscribe 1, "foo@bar.com"
29
+ > c.unsubscribe list_id, "foo@bar.com"
44
30
  => false
45
31
  ```
46
32
 
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
33
  ### Subscription Status
54
34
 
55
35
  To check subscription status for Email address:
56
36
 
57
37
  ```ruby
58
- > c.subscription_status 3, "foo@bar.com"
38
+ > c.subscription_status list_id, "foo@bar.com"
59
39
  => "Unsubscribed"
60
40
  ```
61
41
 
62
- The parameters are list ID and Email.
63
-
64
42
  ### Active Subscriber Count
65
43
 
66
44
  To get active subscriber count of a list:
67
45
 
68
46
  ```ruby
69
- > c.active_subscriber_count 5
47
+ > c.active_subscriber_count list_id
70
48
  => 1660
71
49
  ```
72
50
 
73
- The only required parameter here is list ID.
51
+ ### Create Campaign
52
+
53
+ To create new campaign:
54
+
55
+ ```ruby
56
+ > c.create_campaign from_name: "foo", from_email: "foo@bar.com", reply_to: "foo@bar.com", subject: "Hello, world", html_text: "<h1>Hello, world</h1>"
57
+ => Campaign created
58
+ ```
59
+
60
+ ### More Reference
61
+
62
+ Check [Sendy's API documentation](http://sendy.co/api) to learn more about parameters and possible responses.
74
63
 
75
- ## Contributing
64
+ ## License
76
65
 
77
- 1. Fork it
78
- 2. Create your feature branch (`git checkout -b my-new-feature`)
79
- 3. Commit your changes (`git commit -am 'Add some feature'`)
80
- 4. Push to the branch (`git push origin my-new-feature`)
81
- 5. Create new Pull Request
66
+ MIT License. Copyright 2013-2015 Polydice, Inc. http://polydice.com/
data/cindy.gemspec CHANGED
@@ -18,8 +18,8 @@ Gem::Specification.new do |gem|
18
18
 
19
19
  gem.add_dependency("faraday", "~> 0.8.5")
20
20
  gem.add_dependency('faraday_middleware', '~> 0.9')
21
- gem.add_dependency('hashie', '~> 1.0')
21
+ gem.add_dependency('hashie', '~> 3.4')
22
22
 
23
- gem.add_development_dependency("rake", "~> 10.0.3")
23
+ gem.add_development_dependency("rake", "~> 10.4.2")
24
24
  gem.add_development_dependency("rspec", "~> 2.12.0")
25
25
  end
data/lib/cindy/client.rb CHANGED
@@ -10,6 +10,24 @@ module Cindy
10
10
  @key = api_key || ENV['SENDY_API_KEY']
11
11
  end
12
12
 
13
+ def create_campaign(opts={})
14
+ post_opts = {}
15
+ req_opts = %i(from_name from_email reply_to subject html_text)
16
+ optional_opts = %i(plain_text list_ids brand_id send_campaign)
17
+
18
+ req_opts.each do |opt|
19
+ post_opts[opt] = opts.delete(opt) || raise(ArgumentError, "opt :#{opt} required")
20
+ end
21
+ post_opts.merge!(Hash[optional_opts.zip(opts.values_at(*optional_opts))])
22
+ post_opts[:api_key] = @key
23
+
24
+ response = connection.post "api/campaigns/create.php" do |req|
25
+ req.body = post_opts
26
+ end
27
+
28
+ response.body
29
+ end
30
+
13
31
  def subscribe(list_id, email, name = nil)
14
32
  response = connection.post "subscribe" do |req|
15
33
  params = {list: list_id, email: email, boolean: true}
data/lib/cindy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cindy
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,94 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cindy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Richard Lee
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-14 00:00:00.000000000 Z
11
+ date: 2015-03-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: faraday
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.8.5
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.8.5
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: faraday_middleware
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0.9'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0.9'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: hashie
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: '1.0'
47
+ version: '3.4'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
- version: '1.0'
54
+ version: '3.4'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rake
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ~>
59
+ - - "~>"
68
60
  - !ruby/object:Gem::Version
69
- version: 10.0.3
61
+ version: 10.4.2
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ~>
66
+ - - "~>"
76
67
  - !ruby/object:Gem::Version
77
- version: 10.0.3
68
+ version: 10.4.2
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rspec
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ~>
73
+ - - "~>"
84
74
  - !ruby/object:Gem::Version
85
75
  version: 2.12.0
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ~>
80
+ - - "~>"
92
81
  - !ruby/object:Gem::Version
93
82
  version: 2.12.0
94
83
  description: A lightweight and flexible Ruby SDK for Sendy, a self-hosted email newsletter
@@ -99,7 +88,8 @@ executables: []
99
88
  extensions: []
100
89
  extra_rdoc_files: []
101
90
  files:
102
- - .gitignore
91
+ - ".gitignore"
92
+ - CHANGELOG.md
103
93
  - Gemfile
104
94
  - LICENSE.txt
105
95
  - README.md
@@ -114,33 +104,26 @@ files:
114
104
  - spec/spec_helper.rb
115
105
  homepage: https://github.com/polydice/cindy
116
106
  licenses: []
107
+ metadata: {}
117
108
  post_install_message:
118
109
  rdoc_options: []
119
110
  require_paths:
120
111
  - lib
121
112
  required_ruby_version: !ruby/object:Gem::Requirement
122
- none: false
123
113
  requirements:
124
- - - ! '>='
114
+ - - ">="
125
115
  - !ruby/object:Gem::Version
126
116
  version: '0'
127
- segments:
128
- - 0
129
- hash: 458817470036857709
130
117
  required_rubygems_version: !ruby/object:Gem::Requirement
131
- none: false
132
118
  requirements:
133
- - - ! '>='
119
+ - - ">="
134
120
  - !ruby/object:Gem::Version
135
121
  version: '0'
136
- segments:
137
- - 0
138
- hash: 458817470036857709
139
122
  requirements: []
140
123
  rubyforge_project:
141
- rubygems_version: 1.8.23
124
+ rubygems_version: 2.4.5
142
125
  signing_key:
143
- specification_version: 3
126
+ specification_version: 4
144
127
  summary: Simple Ruby wrapper for Sendy API.
145
128
  test_files:
146
129
  - spec/cindy_spec.rb