bolseragency-ecircle 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +44 -2
- data/VERSION +1 -1
- data/ecircle.gemspec +7 -5
- data/lib/ecircle.rb +9 -1
- data/spec/ecircle_spec.rb +1 -0
- metadata +6 -5
data/README
CHANGED
@@ -1,7 +1,49 @@
|
|
1
1
|
= ecircle
|
2
|
-
An experimental library to access some elements of Ecircle's API
|
2
|
+
An experimental library to access some elements of Ecircle's API, in an ActiveRecord style syntax
|
3
|
+
|
4
|
+
This library is in development and not yet used in production, it covers some of the basic features offered by their synchronous API
|
5
|
+
|
6
|
+
== Install
|
7
|
+
sudo gem install bolseragency-ecircle
|
8
|
+
|
9
|
+
== How to use
|
10
|
+
require 'rubygems'
|
11
|
+
require 'ecircle'
|
12
|
+
|
13
|
+
@configuration = {'ecmessenger_url' => 'http://marketing.mydomain.com',
|
14
|
+
'ecmessenger_username' => 'myemail@mydomain.com',
|
15
|
+
'ecmessenger_password' => 'mypassword'}
|
16
|
+
|
17
|
+
##############################
|
18
|
+
## Find and update a member
|
19
|
+
##############################
|
20
|
+
|
21
|
+
#Find the person by their email and get a lookup a standard and custom attribute
|
22
|
+
person = Ecircle::Member.find_by_email("mail@matthewfawcett.co.uk", groupId = 351026868, @configuration)
|
23
|
+
person.firstname #=> Matt
|
24
|
+
person.SomeCustomAttribute #=> Blah
|
25
|
+
|
26
|
+
#Update some attributes and save
|
27
|
+
person.firstname = "New Matt"
|
28
|
+
person.SomeCustomAttribute = "New Blah"
|
29
|
+
person.save
|
30
|
+
|
31
|
+
|
32
|
+
##############################
|
33
|
+
## Create a new member
|
34
|
+
##############################
|
35
|
+
person = Ecircle::Member.create({:email => "newuser@matthewfawcett.co.uk",
|
36
|
+
:firstname => "New",
|
37
|
+
:FullName => "User",
|
38
|
+
:groupId => 351026868},
|
39
|
+
@configuration)
|
40
|
+
|
41
|
+
|
42
|
+
##############################
|
43
|
+
## Send somebody a one off customised email
|
44
|
+
##############################
|
45
|
+
person.send_message(message_id = 351197566)
|
3
46
|
|
4
|
-
Under development and not production ready
|
5
47
|
|
6
48
|
== Copyright
|
7
49
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/ecircle.gemspec
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
1
4
|
# -*- encoding: utf-8 -*-
|
2
5
|
|
3
6
|
Gem::Specification.new do |s|
|
4
7
|
s.name = %q{ecircle}
|
5
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
6
9
|
|
7
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
11
|
s.authors = ["mattfawcett"]
|
9
|
-
s.date = %q{2009-
|
12
|
+
s.date = %q{2009-08-19}
|
10
13
|
s.email = %q{matt@bolseragency.com}
|
11
14
|
s.extra_rdoc_files = [
|
12
15
|
"LICENSE",
|
@@ -29,11 +32,10 @@ Gem::Specification.new do |s|
|
|
29
32
|
"synchronous/synchronousDriver.rb",
|
30
33
|
"synchronous/synchronousMappingRegistry.rb"
|
31
34
|
]
|
32
|
-
s.has_rdoc = true
|
33
35
|
s.homepage = %q{http://github.com/mattfawcett/ecircle}
|
34
36
|
s.rdoc_options = ["--charset=UTF-8"]
|
35
37
|
s.require_paths = ["lib"]
|
36
|
-
s.rubygems_version = %q{1.3.
|
38
|
+
s.rubygems_version = %q{1.3.5}
|
37
39
|
s.summary = %q{Ruby library to interfac with Ecircle API}
|
38
40
|
s.test_files = [
|
39
41
|
"spec/ecircle_spec.rb",
|
@@ -42,7 +44,7 @@ Gem::Specification.new do |s|
|
|
42
44
|
|
43
45
|
if s.respond_to? :specification_version then
|
44
46
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
45
|
-
s.specification_version =
|
47
|
+
s.specification_version = 3
|
46
48
|
|
47
49
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
48
50
|
else
|
data/lib/ecircle.rb
CHANGED
@@ -85,15 +85,19 @@ module Ecircle
|
|
85
85
|
|
86
86
|
attributes.each do |field, value|
|
87
87
|
member.instance_variable_set("@#{field}", value)
|
88
|
+
#add to the changed attributes array
|
89
|
+
@changed_attributes = [] if @changed_attributes.nil?
|
90
|
+
@changed_attributes << field.to_sym
|
88
91
|
unless member.standard_attributes.include?(field)
|
89
92
|
#must be a custom attribute. Add it to the custom_atributes array
|
90
93
|
@custom_attributes = Array.new if @custom_attributes.nil?
|
91
|
-
@custom_attributes << field
|
94
|
+
@custom_attributes << field
|
92
95
|
end
|
93
96
|
end
|
94
97
|
|
95
98
|
|
96
99
|
member.set_custom_attributes @custom_attributes
|
100
|
+
member.set_changed_attributes @changed_attributes
|
97
101
|
member.save
|
98
102
|
return member
|
99
103
|
end
|
@@ -124,6 +128,10 @@ module Ecircle
|
|
124
128
|
@custom_atributes = attributes
|
125
129
|
end
|
126
130
|
|
131
|
+
def set_changed_attributes(attributes)
|
132
|
+
@changed_attributes = attributes
|
133
|
+
end
|
134
|
+
|
127
135
|
def standard_attributes
|
128
136
|
[:email, :title, :firstname, :lastname, :dob_dd, :dob_mm, :dob_yyyy, :countrycode, :languagecode, :nickname,
|
129
137
|
:cust_attr_0, :cust_attr_1, :cust_attr_2, :cust_attr_3, :cust_attr_4, :cust_attr_5, :cust_attr_6, :cust_attr_7,
|
data/spec/ecircle_spec.rb
CHANGED
@@ -97,6 +97,7 @@ describe "Ecircle" do
|
|
97
97
|
:FullName => "Full Name #{@unique}",
|
98
98
|
:groupId => 351026868},
|
99
99
|
@configuration)
|
100
|
+
@user = Ecircle::Member.find_by_email(email = "user_#{@unique}@matthewfawcett.co.uk", groupId = 351026868, @configuration)
|
100
101
|
@user.firstname.should eql("FN#{@unique}")
|
101
102
|
@user.FullName.should eql("Full Name #{@unique}")
|
102
103
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bolseragency-ecircle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mattfawcett
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-19 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -38,8 +38,9 @@ files:
|
|
38
38
|
- synchronous/synchronous.rb
|
39
39
|
- synchronous/synchronousDriver.rb
|
40
40
|
- synchronous/synchronousMappingRegistry.rb
|
41
|
-
has_rdoc:
|
41
|
+
has_rdoc: false
|
42
42
|
homepage: http://github.com/mattfawcett/ecircle
|
43
|
+
licenses:
|
43
44
|
post_install_message:
|
44
45
|
rdoc_options:
|
45
46
|
- --charset=UTF-8
|
@@ -60,9 +61,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
61
|
requirements: []
|
61
62
|
|
62
63
|
rubyforge_project:
|
63
|
-
rubygems_version: 1.
|
64
|
+
rubygems_version: 1.3.5
|
64
65
|
signing_key:
|
65
|
-
specification_version:
|
66
|
+
specification_version: 3
|
66
67
|
summary: Ruby library to interfac with Ecircle API
|
67
68
|
test_files:
|
68
69
|
- spec/ecircle_spec.rb
|