bolseragency-ecircle 0.1.0 → 0.2.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/VERSION +1 -1
  2. data/ecircle.gemspec +4 -4
  3. data/lib/ecircle.rb +11 -4
  4. metadata +4 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
data/ecircle.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ecircle}
5
- s.version = "0.1.0"
5
+ s.version = "0.2.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["mattfawcett"]
9
- s.date = %q{2009-06-15}
9
+ s.date = %q{2009-06-23}
10
10
  s.email = %q{matt@bolseragency.com}
11
11
  s.extra_rdoc_files = [
12
12
  "LICENSE",
@@ -30,11 +30,11 @@ Gem::Specification.new do |s|
30
30
  "synchronous/synchronousMappingRegistry.rb"
31
31
  ]
32
32
  s.has_rdoc = true
33
- s.homepage = %q{http://github.com/bolseragency/ecircle}
33
+ s.homepage = %q{http://github.com/mattfawcett/ecircle}
34
34
  s.rdoc_options = ["--charset=UTF-8"]
35
35
  s.require_paths = ["lib"]
36
36
  s.rubygems_version = %q{1.3.1}
37
- s.summary = %q{Ruby library to interface with Ecircle API}
37
+ s.summary = %q{Ruby library to interfac with Ecircle API}
38
38
  s.test_files = [
39
39
  "spec/ecircle_spec.rb",
40
40
  "spec/spec_helper.rb"
data/lib/ecircle.rb CHANGED
@@ -41,7 +41,9 @@ module Ecircle
41
41
 
42
42
  def method_missing(method_name, *args)
43
43
  if method_name.to_s =~ /^.*=$/
44
- return instance_variable_set("@#{method_name.to_s.gsub('=','')}", args[0])
44
+ @changed_attributes = [] if @changed_attributes.nil?
45
+ @changed_attributes << method_name.to_s.gsub('=','').to_sym
46
+ return instance_variable_set("@#{method_name.to_s.gsub('=','')}", args[0])
45
47
  else
46
48
  unless instance_variable_get("@#{method_name}").nil?
47
49
  return instance_variable_get("@#{method_name}")
@@ -96,19 +98,24 @@ module Ecircle
96
98
  return member
97
99
  end
98
100
 
99
- def to_xml
101
+ def to_xml
100
102
  x = Builder::XmlMarkup.new
101
103
  x.member do |member|
102
104
  standard_attributes.each do |attribute|
103
105
  val = self.send(attribute)
104
- eval("member.#{attribute}('#{self.send(attribute)}')") unless self.id.nil? && self.send(attribute) == '' #if value is blank, only set if updating
106
+ eval("member.#{attribute}('#{self.send(attribute)}')") if should_include_field_in_xml?(attribute) #if value is blank, only set if updating
105
107
  end
106
108
  custom_atributes.each do |attribute|
107
- member.namedattr({:name => attribute}, self.send(attribute)) unless self.id.nil? && self.send(attribute) == '' #if value is blank, only set if updating
109
+ member.namedattr({:name => attribute}, self.send(attribute)) if should_include_field_in_xml?(attribute) #if value is blank, only set if updating
108
110
  end
109
111
  end
110
112
  end
111
113
 
114
+ def should_include_field_in_xml?(attribute)
115
+ @changed_attributes = [] if @changed_attributes.nil?
116
+ @changed_attributes.include?(attribute) || attribute == :email
117
+ end
118
+
112
119
  def custom_atributes
113
120
  @custom_atributes ||= (@doc/"namedattr").collect { |field| field.attributes['name'].to_sym }
114
121
  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.1.0
4
+ version: 0.2.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-06-15 00:00:00 -07:00
12
+ date: 2009-06-23 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -39,7 +39,7 @@ files:
39
39
  - synchronous/synchronousDriver.rb
40
40
  - synchronous/synchronousMappingRegistry.rb
41
41
  has_rdoc: true
42
- homepage: http://github.com/bolseragency/ecircle
42
+ homepage: http://github.com/mattfawcett/ecircle
43
43
  post_install_message:
44
44
  rdoc_options:
45
45
  - --charset=UTF-8
@@ -63,7 +63,7 @@ rubyforge_project:
63
63
  rubygems_version: 1.2.0
64
64
  signing_key:
65
65
  specification_version: 2
66
- summary: Ruby library to interface with Ecircle API
66
+ summary: Ruby library to interfac with Ecircle API
67
67
  test_files:
68
68
  - spec/ecircle_spec.rb
69
69
  - spec/spec_helper.rb