interspire 0.2.0 → 0.3.0
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.
- data/README.md +21 -12
- data/lib/interspire.rb +1 -1
- data/lib/interspire/api.rb +10 -2
- metadata +2 -8
data/README.md
CHANGED
@@ -1,22 +1,28 @@
|
|
1
1
|
# Interspire [](https://travis-ci.org/Oshuma/interspire)
|
2
2
|
|
3
|
-
Ruby library for the
|
3
|
+
Ruby library for the [Interspire API](https://www.interspire.com/support/kb/questions/1224/Email+Marketer+XML+API+Documentation).
|
4
4
|
|
5
|
-
See the
|
5
|
+
See the `Interspire::API` class for detailed documentation.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
9
|
Add this line to your application's Gemfile:
|
10
10
|
|
11
|
-
|
11
|
+
```ruby
|
12
|
+
gem 'interspire'
|
13
|
+
```
|
12
14
|
|
13
15
|
And then execute:
|
14
16
|
|
15
|
-
|
17
|
+
```shell
|
18
|
+
$ bundle
|
19
|
+
```
|
16
20
|
|
17
21
|
Or install it yourself as:
|
18
22
|
|
19
|
-
|
23
|
+
```shell
|
24
|
+
$ gem install interspire
|
25
|
+
```
|
20
26
|
|
21
27
|
## Usage
|
22
28
|
|
@@ -24,16 +30,18 @@ The API class requires 3 parameters; the API URL of your Interspire installation
|
|
24
30
|
This information can be found under the 'Users & Groups' menu on your Interspire installation.
|
25
31
|
You might have to enable API access for the user.
|
26
32
|
|
27
|
-
|
28
|
-
|
29
|
-
|
33
|
+
```ruby
|
34
|
+
api_url = 'http://example.com/xml.php'
|
35
|
+
user = 'luser'
|
36
|
+
token = 'some_valid_api_token'
|
30
37
|
|
31
|
-
|
38
|
+
api = Interspire::API.new(api_url, user, token)
|
32
39
|
|
33
|
-
|
34
|
-
|
40
|
+
# Get an array of Interspire::ContactList objects:
|
41
|
+
api.get_lists # => [#<Interspire::ContactList:0x8bc6cb0 @id="7", @name="List Foo", ...
|
42
|
+
```
|
35
43
|
|
36
|
-
See the
|
44
|
+
See the `Interspire::API` class for documentation on the available methods.
|
37
45
|
|
38
46
|
## Contributing
|
39
47
|
|
@@ -42,3 +50,4 @@ See the {Interspire::API} class for documentation on the available methods.
|
|
42
50
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
43
51
|
4. Push to the branch (`git push origin my-new-feature`)
|
44
52
|
5. Create new Pull Request
|
53
|
+
|
data/lib/interspire.rb
CHANGED
data/lib/interspire/api.rb
CHANGED
@@ -27,8 +27,16 @@ module Interspire
|
|
27
27
|
#
|
28
28
|
# @return [Integer] Returns the subscriber's ID upon success.
|
29
29
|
def add_subscriber(list_id, email, confirmed = false, format = 'html', custom_fields = {})
|
30
|
-
custom_fields_xml = custom_fields.map
|
31
|
-
|
30
|
+
custom_fields_xml = custom_fields.map do |key, value|
|
31
|
+
output = "<item><fieldid>#{key}</fieldid>"
|
32
|
+
if value.is_a? Array
|
33
|
+
value.each{|v| output << "<value>#{v}</value>"}
|
34
|
+
else
|
35
|
+
output << "<value>#{value}</value>"
|
36
|
+
end
|
37
|
+
output << "</item>"
|
38
|
+
end.join
|
39
|
+
|
32
40
|
xml = %Q[
|
33
41
|
<xmlrequest>
|
34
42
|
<username>#{@user}</username>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: interspire
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
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-
|
12
|
+
date: 2013-11-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -136,18 +136,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
136
|
- - ! '>='
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
-
segments:
|
140
|
-
- 0
|
141
|
-
hash: -3473573730335399156
|
142
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
140
|
none: false
|
144
141
|
requirements:
|
145
142
|
- - ! '>='
|
146
143
|
- !ruby/object:Gem::Version
|
147
144
|
version: '0'
|
148
|
-
segments:
|
149
|
-
- 0
|
150
|
-
hash: -3473573730335399156
|
151
145
|
requirements: []
|
152
146
|
rubyforge_project:
|
153
147
|
rubygems_version: 1.8.23
|