interspire 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +21 -12
  2. data/lib/interspire.rb +1 -1
  3. data/lib/interspire/api.rb +10 -2
  4. metadata +2 -8
data/README.md CHANGED
@@ -1,22 +1,28 @@
1
1
  # Interspire [![Build Status](https://travis-ci.org/Oshuma/interspire.png?branch=master)](https://travis-ci.org/Oshuma/interspire)
2
2
 
3
- Ruby library for the {http://www.interspire.com/ Interspire} API ({https://www.interspire.com/support/kb/questions/1224/Email+Marketer+XML+API+Documentation pdf}).
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 {Interspire::API} class for detailed documentation.
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
- gem 'interspire'
11
+ ```ruby
12
+ gem 'interspire'
13
+ ```
12
14
 
13
15
  And then execute:
14
16
 
15
- $ bundle
17
+ ```shell
18
+ $ bundle
19
+ ```
16
20
 
17
21
  Or install it yourself as:
18
22
 
19
- $ gem install interspire
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
- api_url = 'http://example.com/xml.php'
28
- user = 'luser'
29
- token = 'some_valid_api_token'
33
+ ```ruby
34
+ api_url = 'http://example.com/xml.php'
35
+ user = 'luser'
36
+ token = 'some_valid_api_token'
30
37
 
31
- api = Interspire::API.new(api_url, user, token)
38
+ api = Interspire::API.new(api_url, user, token)
32
39
 
33
- # Get an array of Interspire::ContactList objects:
34
- api.get_lists # => [#<Interspire::ContactList:0x8bc6cb0 @id="7", @name="List Foo", ...
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 {Interspire::API} class for documentation on the available methods.
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
+
@@ -4,5 +4,5 @@ require "interspire/interspire_exception"
4
4
  require "interspire/subscriber"
5
5
 
6
6
  module Interspire
7
- VERSION = "0.2.0"
7
+ VERSION = "0.3.0"
8
8
  end
@@ -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 { |key, value| "<item><fieldid>#{key}</fieldid><value>#{value}</value></item>" }.join
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.2.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-09-06 00:00:00.000000000 Z
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