church-community-builder 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/.rvmrc +1 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +52 -0
- data/README.rdoc +54 -0
- data/Rakefile +32 -0
- data/ccb_api.gemspec +26 -0
- data/docs/batch_implement.pdf +0 -0
- data/docs/event_implement.pdf +0 -0
- data/docs/group_implement.pdf +0 -0
- data/docs/individual_profile_implement.pdf +0 -0
- data/docs/pwt_implement.pdf +0 -0
- data/docs/pwt_overview.pdf +0 -0
- data/examples/batch.rb +50 -0
- data/examples/calendar.rb +18 -0
- data/examples/campus.rb +13 -0
- data/examples/individual.rb +38 -0
- data/examples/sync_data.rb +48 -0
- data/lib/api/address.rb +28 -0
- data/lib/api/api_object.rb +116 -0
- data/lib/api/batch.rb +48 -0
- data/lib/api/batch_list.rb +50 -0
- data/lib/api/campus.rb +29 -0
- data/lib/api/campus_list.rb +65 -0
- data/lib/api/individual.rb +138 -0
- data/lib/api/individual_list.rb +65 -0
- data/lib/api/mergeable_individual_list.rb +92 -0
- data/lib/api/mergeable_transaction_list.rb +74 -0
- data/lib/api/search.rb +81 -0
- data/lib/api/transaction.rb +114 -0
- data/lib/api/transaction_list.rb +52 -0
- data/lib/api/valid_individual.rb +43 -0
- data/lib/api/valid_individual_list.rb +49 -0
- data/lib/auto_load.rb +17 -0
- data/lib/ccb_api.rb +33 -0
- data/lib/common.rb +41 -0
- data/lib/exceptions.rb +5 -0
- data/lib/readers/api_reader.rb +35 -0
- data/lib/readers/batch_list_reader.rb +17 -0
- data/lib/readers/batch_reader.rb +14 -0
- data/lib/readers/campus_list_reader.rb +17 -0
- data/lib/readers/individual_list_reader.rb +18 -0
- data/lib/readers/individual_reader.rb +14 -0
- data/lib/writers/api_writer.rb +64 -0
- data/lib/writers/user_writer.rb +46 -0
- data/spec/api/user_spec.rb +37 -0
- data/spec/factories/user.rb +51 -0
- data/spec/functional/ccb_spec.rb +20 -0
- data/spec/readers/user_reader_spec.rb +7 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/writers/user_writer_spec.rb +80 -0
- metadata +137 -0
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm ruby-1.9.3-p392@church-community-builder-api --create
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
ZenTest (4.9.1)
|
5
|
+
activesupport (3.2.13)
|
6
|
+
i18n (= 0.6.1)
|
7
|
+
multi_json (~> 1.0)
|
8
|
+
autotest (4.4.6)
|
9
|
+
ZenTest (>= 4.4.1)
|
10
|
+
colored (1.2)
|
11
|
+
columnize (0.3.6)
|
12
|
+
debugger (1.5.0)
|
13
|
+
columnize (>= 0.3.1)
|
14
|
+
debugger-linecache (~> 1.2.0)
|
15
|
+
debugger-ruby_core_source (~> 1.2.0)
|
16
|
+
debugger-linecache (1.2.0)
|
17
|
+
debugger-ruby_core_source (1.2.0)
|
18
|
+
diff-lcs (1.2.4)
|
19
|
+
ethon (0.5.3)
|
20
|
+
ffi (~> 1.0.11)
|
21
|
+
mime-types (~> 1.18)
|
22
|
+
factory_girl (4.2.0)
|
23
|
+
activesupport (>= 3.0.0)
|
24
|
+
ffi (1.0.11)
|
25
|
+
i18n (0.6.1)
|
26
|
+
json (1.8.0)
|
27
|
+
mime-types (1.23)
|
28
|
+
multi_json (1.7.3)
|
29
|
+
rspec (2.13.0)
|
30
|
+
rspec-core (~> 2.13.0)
|
31
|
+
rspec-expectations (~> 2.13.0)
|
32
|
+
rspec-mocks (~> 2.13.0)
|
33
|
+
rspec-core (2.13.1)
|
34
|
+
rspec-expectations (2.13.0)
|
35
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
36
|
+
rspec-mocks (2.13.1)
|
37
|
+
typhoeus (0.5.1)
|
38
|
+
ethon (= 0.5.3)
|
39
|
+
xml-simple (1.1.2)
|
40
|
+
|
41
|
+
PLATFORMS
|
42
|
+
ruby
|
43
|
+
|
44
|
+
DEPENDENCIES
|
45
|
+
autotest
|
46
|
+
colored
|
47
|
+
debugger
|
48
|
+
factory_girl
|
49
|
+
json
|
50
|
+
rspec
|
51
|
+
typhoeus (= 0.5.1)
|
52
|
+
xml-simple
|
data/README.rdoc
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
= The Church Community Builder API
|
2
|
+
|
3
|
+
This Ruby project is an API wrapper for Church Community Builder API.
|
4
|
+
|
5
|
+
|
6
|
+
== Install / Setup
|
7
|
+
|
8
|
+
Installing the gem
|
9
|
+
|
10
|
+
gem install church-community-builder
|
11
|
+
|
12
|
+
|
13
|
+
To add it to your Gemfile
|
14
|
+
|
15
|
+
gem 'church-community-builder', :require => 'ccb_api'
|
16
|
+
|
17
|
+
|
18
|
+
Add your church's API Token and API Key to [RAILS_ROOT]/config/initializers/ccb_config.rb
|
19
|
+
|
20
|
+
CCB_USERNAME = '**** YOUR CCB API USERNAME ****'
|
21
|
+
CCB_PASSWORD = '**** YOUR CCB API PASSWORD ****'
|
22
|
+
CCB_SUBDOMAIN = '**** YOUR CCB API SUBDOMAIN ****'
|
23
|
+
|
24
|
+
|
25
|
+
Next you will need to initialize a connection
|
26
|
+
|
27
|
+
ChurchCommunityBuilder::Api.connect(CCB_USERNAME, CCB_PASSWORD, CCB_SUBDOMAIN)
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
== Example usage
|
32
|
+
|
33
|
+
Checkout the examples folder.
|
34
|
+
|
35
|
+
|
36
|
+
== Additional resources
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
== License
|
41
|
+
|
42
|
+
This project is released under the MIT license (see LICENSE).
|
43
|
+
|
44
|
+
This project is maintained by Wes Hays (https://github.com/weshays).
|
45
|
+
|
46
|
+
|
47
|
+
== Contributors
|
48
|
+
|
49
|
+
Chad Feller: https://github.com/cfeller
|
50
|
+
|
51
|
+
|
52
|
+
== Want to Contribute?
|
53
|
+
|
54
|
+
If you would like to get involved in this project, then please fork the project. Make changes, add features, write some tests, and then send us a pull request.
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rspec/core/rake_task'
|
2
|
+
|
3
|
+
|
4
|
+
desc 'Default: run specs.'
|
5
|
+
task :default => :spec
|
6
|
+
task :test => :spec
|
7
|
+
|
8
|
+
desc "Run specs"
|
9
|
+
RSpec::Core::RakeTask.new do |t|
|
10
|
+
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
|
11
|
+
# Put spec opts in a file named .rspec in root
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
desc "Generate code coverage"
|
16
|
+
RSpec::Core::RakeTask.new(:coverage) do |t|
|
17
|
+
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
|
18
|
+
t.rcov = true
|
19
|
+
t.rcov_opts = ['--exclude', 'spec']
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
namespace :docs do
|
25
|
+
|
26
|
+
desc 'Build the docs for The City Admin API.'
|
27
|
+
task :build do
|
28
|
+
system('rm -rf doc')
|
29
|
+
system('yardoc --no-private --protected lib/**/*.rb')
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
data/ccb_api.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
PROJECT_GEM = 'church-community-builder'
|
3
|
+
PROJECT_GEM_VERSION = '0.1.0'
|
4
|
+
|
5
|
+
s.name = PROJECT_GEM
|
6
|
+
s.version = PROJECT_GEM_VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
#s.date = '2009-01-05'
|
9
|
+
|
10
|
+
s.homepage = 'https://github.com/weshays/church-community-builder-api-ruby'
|
11
|
+
s.rubyforge_project = 'Project on www.github.com'
|
12
|
+
s.authors = ['Wes Hays', 'Chad Feller']
|
13
|
+
s.email = ['weshays@gbdev.com','feller@cs.unr.edu']
|
14
|
+
|
15
|
+
s.summary = 'Ruby gem/plugin to interact with the Church Community Builder API.'
|
16
|
+
s.description = 'Ruby gem/plugin to interact with the Church Community Builder API. Checkout the project on github for more detail.'
|
17
|
+
|
18
|
+
s.add_dependency('typhoeus', '0.5.1')
|
19
|
+
s.add_dependency('xml-simple')
|
20
|
+
|
21
|
+
|
22
|
+
s.files = `git ls-files`.split("\n")
|
23
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
24
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
25
|
+
s.require_paths = ["lib"]
|
26
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/examples/batch.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/../lib/ccb_api.rb'
|
4
|
+
|
5
|
+
# Load batch by id
|
6
|
+
batch_1 = ChurchCommunityBuilder::Search.search_for_batch_by_id(469)
|
7
|
+
|
8
|
+
# Pull TransactionList from given Batch
|
9
|
+
trans_list_1 = ChurchCommunityBuilder::TransactionList.new(batch_1.transactions)
|
10
|
+
|
11
|
+
# Search for transactions by date
|
12
|
+
start_date = "2013-05-03"
|
13
|
+
end_date = nil #optional
|
14
|
+
batch_2 = ChurchCommunityBuilder::Search.search_for_batch_by_date_range(start_date,end_date)
|
15
|
+
|
16
|
+
# Create MergeableTransactionList, and load all transactions from batch_2 into it
|
17
|
+
mtl = ChurchCommunityBuilder::MergeableTransactionList.new
|
18
|
+
|
19
|
+
batch_2.each do |batch|
|
20
|
+
trans_list = ChurchCommunityBuilder::TransactionList.new(batch.transactions)
|
21
|
+
mtl.add(trans_list)
|
22
|
+
end
|
23
|
+
|
24
|
+
puts mtl.all_names
|
25
|
+
|
26
|
+
# Create MergeableIndividualList, and lookup all Individuals from mtl.
|
27
|
+
individual_list = ChurchCommunityBuilder::MergeableIndividualList.new
|
28
|
+
|
29
|
+
mtl.each do |transaction|
|
30
|
+
individual = ChurchCommunityBuilder::Individual.load_by_id(transaction.individual_id)
|
31
|
+
individual_list.add(individual)
|
32
|
+
end
|
33
|
+
|
34
|
+
puts "********************************************************************"
|
35
|
+
# Batch reporting
|
36
|
+
individual_list = ChurchCommunityBuilder::MergeableIndividualList.new
|
37
|
+
|
38
|
+
mtl.each do |transaction|
|
39
|
+
individual = ChurchCommunityBuilder::Individual.load_by_id(transaction.individual_id)
|
40
|
+
|
41
|
+
puts transaction.date + "\t" +
|
42
|
+
individual.family_name + "\t" +
|
43
|
+
individual.full_name + "\t" +
|
44
|
+
"$" + transaction.amount.to_s #unless transaction.multiple_transactions?
|
45
|
+
puts transaction.fund_id.to_s + "\t" +
|
46
|
+
transaction.fund_name.to_s + "\t" +
|
47
|
+
transaction.payment_type + "\t" +
|
48
|
+
transaction.check_number.to_s #check_number will be nil if not paid by check
|
49
|
+
puts "********************************************************************"
|
50
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# #!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# require 'json'
|
4
|
+
# require 'yaml'
|
5
|
+
# require 'typhoeus'
|
6
|
+
# require 'active_support/core_ext'
|
7
|
+
|
8
|
+
# y = YAML.load(File.read("config/ccb.yml"))
|
9
|
+
# resp1 = Typhoeus::Request.get(y[:url],
|
10
|
+
# params: {srv: "public_calendar_listing",
|
11
|
+
# date_start: "2008-11-25",
|
12
|
+
# #date_end: "2008-12-31"
|
13
|
+
# },
|
14
|
+
# username: y[:username],
|
15
|
+
# password: y[:password]
|
16
|
+
# )
|
17
|
+
# jresp1 = JSON.parse(Hash.from_xml(resp1.body).to_json)
|
18
|
+
# puts jresp1.inspect
|
data/examples/campus.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/../lib/ccb_api'
|
4
|
+
require 'pp'
|
5
|
+
|
6
|
+
campus_list = ChurchCommunityBuilder::Search.search_for_all_campuses
|
7
|
+
|
8
|
+
puts campus_list.all_names
|
9
|
+
puts campus_list.ids
|
10
|
+
|
11
|
+
campus_0 = campus_list[0]
|
12
|
+
|
13
|
+
pp campus_0
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/../lib/ccb_api'
|
4
|
+
|
5
|
+
# IndividualList is returned from Search
|
6
|
+
x_names = ChurchCommunityBuilder::Search.search_for_person_by_name("x")
|
7
|
+
puts x_names.all_names
|
8
|
+
|
9
|
+
# Individual is created here
|
10
|
+
individual = ChurchCommunityBuilder::Individual.load_by_id(2)
|
11
|
+
puts "Name ==> " + individual.full_name
|
12
|
+
puts "Address: "
|
13
|
+
puts individual.mailing_address.street_address + "\n" +
|
14
|
+
individual.mailing_address.city + ", " +
|
15
|
+
individual.mailing_address.state + " " +
|
16
|
+
individual.mailing_address.zip
|
17
|
+
|
18
|
+
puts "Phone ==>" + individual.contact_phone
|
19
|
+
puts "Email ==> " + individual.email
|
20
|
+
|
21
|
+
puts "Gender ==> " + individual.gender
|
22
|
+
puts "Birthday ==> " + individual.birthday
|
23
|
+
puts "Marital Status ==> " + individual.marital_status
|
24
|
+
|
25
|
+
puts "Family Name ==> " + individual.family_name
|
26
|
+
puts "Campus Name ==> " + individual.campus_name
|
27
|
+
|
28
|
+
# Grab all individuals
|
29
|
+
all_valid_individuals = ChurchCommunityBuilder::Search.search_for_all_valid_individuals
|
30
|
+
|
31
|
+
# all individuals is a ValidIndividualList.
|
32
|
+
# we can use this to build an IndividualList
|
33
|
+
mil = ChurchCommunityBuilder::MergeableIndividualList.new
|
34
|
+
|
35
|
+
all_valid_individuals.each do |vi|
|
36
|
+
individual = ChurchCommunityBuilder::Individual.load_by_id(vi.id)
|
37
|
+
mil.add(individual)
|
38
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'debugger'
|
4
|
+
require File.dirname(__FILE__) + '/../lib/ccb_api'
|
5
|
+
|
6
|
+
|
7
|
+
start_date = "2013-04-01"
|
8
|
+
end_date = "2013-04-21"
|
9
|
+
batch_list = ChurchCommunityBuilder::Search.search_for_batch_by_date_range(start_date, end_date)
|
10
|
+
|
11
|
+
batch_list.each do |batch|
|
12
|
+
if batch.has_transactions?
|
13
|
+
transaction_list = ChurchCommunityBuilder::TransactionList.new(batch.transactions)
|
14
|
+
|
15
|
+
puts "-----------------------------"
|
16
|
+
transaction_list.each do |transaction|
|
17
|
+
# Info to use
|
18
|
+
puts "Campus: #{transaction.campus_name}"
|
19
|
+
puts "Amount: #{transaction.amount}"
|
20
|
+
puts "Donor: #{transaction.individual_id}"
|
21
|
+
puts "Entered On: #{transaction.date}"
|
22
|
+
puts "Fund: #{transaction.fund_name}"
|
23
|
+
puts "Instrument Type: #{transaction.payment_type}"
|
24
|
+
puts "-----------------------------"
|
25
|
+
|
26
|
+
individual = ChurchCommunityBuilder::Individual.load_by_id(transaction.individual_id)
|
27
|
+
|
28
|
+
puts '#########################'
|
29
|
+
puts "First name: #{individual.first_name}"
|
30
|
+
puts "Last name: #{individual.last_name}"
|
31
|
+
puts "Full name: #{individual.full_name}"
|
32
|
+
puts "Campus name: #{individual.campus_name}"
|
33
|
+
puts "Donor ID: #{individual.giving_number}"
|
34
|
+
puts "Family ID: #{individual.family_id}"
|
35
|
+
puts "Address: #{individual.home_address}"
|
36
|
+
puts "Phone number 1: #{individual.home_phone}"
|
37
|
+
puts "Phone number 2: #{individual.mobile_phone}"
|
38
|
+
puts "Date of Birth: #{individual.birthday}"
|
39
|
+
puts "Gender: #{individual.gender}"
|
40
|
+
puts "Email: #{individual.email}"
|
41
|
+
puts "Marital status: #{individual.marital_status}"
|
42
|
+
puts '#########################'
|
43
|
+
end
|
44
|
+
|
45
|
+
else
|
46
|
+
puts "Batch #{batch.id} has no transactions"
|
47
|
+
end
|
48
|
+
end
|
data/lib/api/address.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
module ChurchCommunityBuilder
|
2
|
+
|
3
|
+
include Enumerable
|
4
|
+
|
5
|
+
class Address < ApiObject
|
6
|
+
|
7
|
+
# Type = {mailing: 'mailing', home: 'home', work: 'work', other: 'other'}
|
8
|
+
|
9
|
+
ccb_attr_accessor :type,
|
10
|
+
:street_address,
|
11
|
+
:city,
|
12
|
+
:state,
|
13
|
+
:zip,
|
14
|
+
:country,
|
15
|
+
:line_1,
|
16
|
+
:line_2,
|
17
|
+
:latitude,
|
18
|
+
:longitude
|
19
|
+
|
20
|
+
|
21
|
+
def initialize(json)
|
22
|
+
initialize_from_json_object(json) unless json.nil?
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
module ChurchCommunityBuilder
|
2
|
+
|
3
|
+
# This class is the base class for all ChurchCommunityBuilder objects and is meant to be inherited.
|
4
|
+
#
|
5
|
+
class ApiObject
|
6
|
+
attr_reader :error_messages, :marked_for_destruction
|
7
|
+
|
8
|
+
|
9
|
+
# Used to specify a list of getters and setters.
|
10
|
+
def self.ccb_attr_accessor(*vars)
|
11
|
+
@__ccb_attributes ||= []
|
12
|
+
@__ccb_attributes.concat(vars)
|
13
|
+
attr_accessor(*vars)
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
# A list of ccb_attr_accessors that have been specified.
|
18
|
+
def self.__ccb_attributes
|
19
|
+
@__ccb_attributes
|
20
|
+
end
|
21
|
+
|
22
|
+
# Initializes the current object from the JSON data that was loaded into the Hash
|
23
|
+
#
|
24
|
+
# @param object_attributes A Hash of values to load into the current object.
|
25
|
+
def initialize_from_json_object(object_attributes)
|
26
|
+
# puts "CALLER"
|
27
|
+
# puts caller[0]
|
28
|
+
# puts "DONE PUTTING CALLER"
|
29
|
+
if object_attributes.is_a?( Hash )
|
30
|
+
object_attributes.each do |key, value|
|
31
|
+
|
32
|
+
method_to_call = "#{key.to_s.downcase.gsub(' ', '_')}="
|
33
|
+
|
34
|
+
if respond_to?(method_to_call)
|
35
|
+
# puts "Sending :=> ".green + method_to_call.to_s + value.to_s
|
36
|
+
self.send(method_to_call, value)
|
37
|
+
else
|
38
|
+
# puts "Missing :=> ".red + method_to_call.to_s # Show the missing methods
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
# Returns the status of the current object.
|
46
|
+
def is_deleted?
|
47
|
+
@_deleted ||= false
|
48
|
+
end
|
49
|
+
|
50
|
+
# Gets the current object's attributes in a Hash.
|
51
|
+
#
|
52
|
+
# @return A hash of all the attributes.
|
53
|
+
def to_attributes
|
54
|
+
vals = {}
|
55
|
+
vals = {:marked_for_destruction => self.is_deleted?} if self.is_deleted?
|
56
|
+
self.class.__ccb_attributes.each do |tca|
|
57
|
+
rep = self.send(tca)
|
58
|
+
if rep.class == Array
|
59
|
+
rep.collect! { |r| r.respond_to?(:to_attributes) ? r.to_attributes : r }
|
60
|
+
end
|
61
|
+
vals[tca] = rep
|
62
|
+
end
|
63
|
+
vals
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
# Sets the current object's attributes from a hash
|
68
|
+
def set_attributes(attribute_data)
|
69
|
+
attribute_data.each { |key, value| self.send("#{key}=", value) if self.respond_to?("#{key}=") }
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
# # Save this object.
|
74
|
+
# #
|
75
|
+
# # @return True on success, otherwise false.
|
76
|
+
# def save
|
77
|
+
# writer = @writer_object.new(self.to_attributes)
|
78
|
+
# result = writer.save_object
|
79
|
+
# if result === false
|
80
|
+
# @error_messages = writer.error_messages
|
81
|
+
# else
|
82
|
+
# self.set_attributes(result)
|
83
|
+
# end
|
84
|
+
# result === false ? false : true
|
85
|
+
# end
|
86
|
+
|
87
|
+
|
88
|
+
# # Delete this object.
|
89
|
+
# #
|
90
|
+
# # @return True on success, otherwise false.
|
91
|
+
# def delete
|
92
|
+
# writer = @writer_object.new(self.to_attributes)
|
93
|
+
# result = writer.delete_object
|
94
|
+
# if result === false
|
95
|
+
# @error_messages = writer.error_messages
|
96
|
+
# else
|
97
|
+
# @_deleted = true
|
98
|
+
# end
|
99
|
+
# result === false ? false : true
|
100
|
+
# end
|
101
|
+
|
102
|
+
private
|
103
|
+
|
104
|
+
def _attr_underscore(str)
|
105
|
+
str.gsub(/::/, '/')
|
106
|
+
.gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
|
107
|
+
.gsub(/([a-z\d])([A-Z])/,'\1_\2')
|
108
|
+
.tr("-", "_")
|
109
|
+
.downcase
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
|
116
|
+
|