freshmail 0.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85e9e3a722e8682bc0087cea159614cb2a50cbaa
4
- data.tar.gz: ba7eba6ef456d232db316b04472fc7e6817ab5ec
3
+ metadata.gz: 39de1c2b92feb18e332d50dbbe811c6533769646
4
+ data.tar.gz: 6d6dd48464d4e3e25c8af944c51c6919e6e5c7dd
5
5
  SHA512:
6
- metadata.gz: 0f4db3bcc4196be755f84e667269b056bd6d737713c27d2603f8fde6161afe31d3f5e368ce1a78003b4ca2780d7ba7a2824e3df000f64114a82544a2561a00be
7
- data.tar.gz: bd60c515ef0e54580b8c6a12efa9259b2461607b6b635f99123e5b7aa5677b198a6a05284dd74ea88b4193fb7a7961e9e8f4cfb1a19cbeb27c0d91369e9d71ce
6
+ metadata.gz: 625745e91726ca3bba80389d4ecf486f9cc4d7b9a1bf32839cce96fbc4d872ad5d988df98f5eeea174e93424265164728e0eb586b37fc82f12055e733ead5cf2
7
+ data.tar.gz: 99379ed707ffb8f42a12d246e2959390d7cd9b70751e50a7d3c501138bc4f516bbb2d9ad6e6a380d6b00adeffe0473c8e7956d3e66a303765721844deb81c7da
data/README.rdoc CHANGED
@@ -1,3 +1,71 @@
1
1
  = Freshmail
2
+ ===================
2
3
 
3
- This project rocks and uses MIT-LICENSE.
4
+ This is a Rails Gem for Freshmail REST API.
5
+
6
+ ## Instalation
7
+
8
+ ```console
9
+ gem install freshmail
10
+ ```
11
+
12
+ or add it to your `Gemfile`:
13
+
14
+ ```ruby
15
+ gem 'freshmail'
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ Create instance of gem:
21
+
22
+ ```ruby
23
+ freshmail = Freshmail::Api.new('YOUR_API_KEY', 'YOUR_API_SECRET')
24
+ ```
25
+
26
+ After that, you can access Freshmail methods, for example:
27
+
28
+ ```ruby
29
+ my_lists = freshmail.lists
30
+ my_first_list_hash = my_lists['lists'].first['subscriberListHash']
31
+ my_last_list_hash = my_lists['lists'].last['subscriberListHash']
32
+
33
+ freshmail.add_subscriber(email: 'test@test.net', list: my_first_list_hash, state: 1)
34
+
35
+ freshmail.batch_add_subscriber(subscribers: [{email: 'test@test.net'}, {email: 'test2@test.net'}], list: my_last_list_hash, state: 1)
36
+
37
+ freshmail.subscriber(email: 'test@test.net', list: my_first_list_hash)
38
+ freshmail.subscribers(subscribers: [{email: 'test2@test.net'}], list: my_last_list_hash)
39
+
40
+ freshmail.delete_subscriber(email: 'test@test.net', list: my_first_list_hash)
41
+ freshmail.batch_delete_subscriber(subscribers: [{email: 'test@test.net'}, {email: 'test2@test.net'}], list: my_last_list_hash)
42
+ ```
43
+
44
+ Available methods:
45
+
46
+ ```ruby
47
+ freshmail.ping
48
+ freshmail.mail(...)
49
+ freshmail.subscriber(...)
50
+ freshmail.subscribers(...)
51
+ freshmail.add_subscriber(...)
52
+ freshmail.batch_add_subscriber(...)
53
+ freshmail.delete_subscriber(...)
54
+ freshmail.batch_delete_subscriber(...)
55
+ freshmail.lists
56
+ freshmail.create_list(...)
57
+ freshmail.update_list(...)
58
+ freshmail.delete_list(...)
59
+ ```
60
+
61
+ ## TODO
62
+
63
+ Add more methods.
64
+ Add tests.
65
+
66
+ ## Licence
67
+
68
+ Copyright (c) 2015 Marcin Adamczyk, released under the MIT license
69
+
70
+
71
+ *Feel free to contact me if you need help: marcin.adamczyk [--a-t--] subcom.me*
data/lib/freshmail/api.rb CHANGED
@@ -23,11 +23,14 @@ module Freshmail
23
23
  end
24
24
 
25
25
  def subscriber(sub_info = {})
26
- call_freshmail(:get, 'subscriber/get', sub_info)
26
+ list = sub_info[:list]
27
+ email = sub_info[:email]
28
+
29
+ call_freshmail(:get, "subscriber/get/#{l}/#{e}")
27
30
  end
28
31
 
29
32
  def subscribers(sub_info = {})
30
- call_freshmail(:get, 'subscriber/getMultiple', sub_info)
33
+ call_freshmail(:post, 'subscriber/getMultiple', sub_info)
31
34
  end
32
35
 
33
36
  def add_subscriber(sub_info = {})
@@ -78,11 +81,7 @@ module Freshmail
78
81
  req.headers['Content-Type'] = 'application/json'
79
82
  req.headers['X-Rest-ApiKey'] = self.api_key
80
83
  req.headers['X-Rest-ApiSign'] = api_sign(endpoint, json_data_converted)
81
- if req.method == :get
82
- req.params = json_data if json_data
83
- else
84
- req.body = json_data_converted
85
- end
84
+ req.body = json_data_converted if req.method == :post
86
85
  end
87
86
 
88
87
  JSON.parse(response.body)
@@ -1,3 +1,3 @@
1
1
  module Freshmail
2
- VERSION = "0.1"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freshmail
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Jan Adamczyk
@@ -116,7 +116,7 @@ files:
116
116
  - test/dummy/public/favicon.ico
117
117
  - test/freshmail_test.rb
118
118
  - test/test_helper.rb
119
- homepage: https://github.com/tehPlayer/freshmail_rails
119
+ homepage: https://github.com/tehPlayer/freshmail-rails
120
120
  licenses:
121
121
  - MIT
122
122
  metadata: {}