church-community-builder 0.1.6 → 0.2.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.
@@ -0,0 +1 @@
1
+ church-community-builder-api
@@ -0,0 +1 @@
1
+ ruby-1.9.3-p448
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  PROJECT_GEM = 'church-community-builder'
3
- PROJECT_GEM_VERSION = '0.1.6'
3
+ PROJECT_GEM_VERSION = '0.2.0'
4
4
 
5
5
  s.name = PROJECT_GEM
6
6
  s.version = PROJECT_GEM_VERSION
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.dirname(__FILE__) + '/../lib/ccb_api.rb'
4
+ require File.dirname(__FILE__) + '/api_connect.rb'
5
+
6
+ require 'debugger'
7
+
8
+ fund_list = ChurchCommunityBuilder::Search.search_for_all_funds
9
+
10
+ debugger
11
+ asdf=234
@@ -0,0 +1,27 @@
1
+ module ChurchCommunityBuilder
2
+
3
+ include Enumerable
4
+
5
+ class Fund < ApiObject
6
+
7
+ ccb_attr_accessor :id,
8
+ :name,
9
+ :cash_bank_account,
10
+ :account_number,
11
+ :tax_deductible,
12
+ :online_giving_enabled,
13
+ :pledge_goal,
14
+ :parent,
15
+ :campuses
16
+
17
+ def initialize(json_data = nil, options = {})
18
+ initialize_from_json_object(json_data) unless json_data.nil?
19
+ end
20
+
21
+
22
+ def parent_id
23
+ self.parent['id']
24
+ end
25
+ end
26
+
27
+ end
@@ -0,0 +1,53 @@
1
+ module ChurchCommunityBuilder
2
+
3
+ class FundList < ApiObject
4
+
5
+ include Enumerable
6
+
7
+ attr_reader :count,
8
+ :funds_array,
9
+ :json_data #for debugging
10
+
11
+ def initialize(json)
12
+ #funds_json = json_data['ccb_api']['response']['transaction_detail_types']['transaction_detail_type']
13
+ @json_data = json['ccb_api']
14
+ funds = @json_data['response']['transaction_detail_types']
15
+ @count = funds['count'].to_i #number of records
16
+
17
+ # if funds['transaction_detail_type'] is a single item, it will be returned
18
+ # as a Hash, rather than a single element Array, containing the Hash.
19
+ if funds['transaction_detail_type'].is_a?(Array)
20
+ @funds_array = funds['transaction_detail_type']
21
+ elsif funds['transaction_detail_type'].is_a?(Hash)
22
+ @funds_array = []
23
+ @funds_array << funds['transaction_detail_type'] #array of each funds
24
+ end
25
+ end
26
+
27
+ def all_names
28
+ return [] unless @funds_array
29
+ @funds_array.collect { |fund| fund['name'] }
30
+ end
31
+
32
+ def ids
33
+ (@funds_array.collect { |fund| fund['id'].to_i }).uniq
34
+ end
35
+
36
+ def [](index)
37
+ Fund.new( @funds_array[index] ) if @funds_array and @funds_array[index]
38
+ end
39
+
40
+
41
+ # This method is needed for Enumerable.
42
+ def each &block
43
+ @funds_array.each{ |fund| yield( Fund.new(fund) )}
44
+ end
45
+
46
+
47
+ def empty?
48
+ @funds_array.size == 0 ? true : false
49
+ end
50
+
51
+ end
52
+
53
+ end
@@ -68,6 +68,13 @@ module ChurchCommunityBuilder
68
68
  CampusList.new(reader.load_feed)
69
69
  end
70
70
 
71
+ # This is currently undocumented, but found via spelunking
72
+ #
73
+ def self.search_for_all_funds
74
+ reader = FundListReader.new
75
+ FundList.new(reader.load_feed)
76
+ end
77
+
71
78
  end
72
79
 
73
80
  end
@@ -11,14 +11,12 @@ module ChurchCommunityBuilder
11
11
  # Loads the list
12
12
  #
13
13
  # @return the data loaded in a JSON object.
14
- def load_feed
15
-
16
- @url_data_params ||= {}
17
- response = ChurchCommunityBuilder::admin_request(:get, @url_data_params)
18
- data = _xml2json(response.body)
19
- @headers = response.headers
20
-
21
- return data
14
+ def load_feed
15
+ @url_data_params ||= {}
16
+ response = ChurchCommunityBuilder::admin_request(:get, @url_data_params)
17
+ data = _xml2json(response.body)
18
+ @headers = response.headers
19
+ return data
22
20
  end
23
21
 
24
22
  private
@@ -0,0 +1,13 @@
1
+ module ChurchCommunityBuilder
2
+
3
+ class FundListReader < ApiReader
4
+
5
+ # Constructor.
6
+ #
7
+ def initialize(options = {})
8
+ @url_data_params = {srv: 'transaction_detail_type_list'}
9
+ end
10
+
11
+ end
12
+
13
+ end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: church-community-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Wes Hays
@@ -9,11 +10,12 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2014-02-11 00:00:00.000000000 Z
13
+ date: 2015-01-21 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: typhoeus
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
20
  - - '='
19
21
  - !ruby/object:Gem::Version
@@ -21,6 +23,7 @@ dependencies:
21
23
  type: :runtime
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
28
  - - '='
26
29
  - !ruby/object:Gem::Version
@@ -28,6 +31,7 @@ dependencies:
28
31
  - !ruby/object:Gem::Dependency
29
32
  name: xml-simple
30
33
  requirement: !ruby/object:Gem::Requirement
34
+ none: false
31
35
  requirements:
32
36
  - - ! '>='
33
37
  - !ruby/object:Gem::Version
@@ -35,6 +39,7 @@ dependencies:
35
39
  type: :runtime
36
40
  prerelease: false
37
41
  version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
38
43
  requirements:
39
44
  - - ! '>='
40
45
  - !ruby/object:Gem::Version
@@ -49,7 +54,8 @@ extensions: []
49
54
  extra_rdoc_files: []
50
55
  files:
51
56
  - .gitignore
52
- - .rvmrc
57
+ - .ruby-gemset
58
+ - .ruby-version
53
59
  - Gemfile
54
60
  - Gemfile.lock
55
61
  - README.rdoc
@@ -65,6 +71,7 @@ files:
65
71
  - examples/batch.rb
66
72
  - examples/calendar.rb
67
73
  - examples/campus.rb
74
+ - examples/funds.rb
68
75
  - examples/individual.rb
69
76
  - examples/individual_profiles.rb
70
77
  - examples/sync_data.rb
@@ -74,6 +81,8 @@ files:
74
81
  - lib/api/batch_list.rb
75
82
  - lib/api/campus.rb
76
83
  - lib/api/campus_list.rb
84
+ - lib/api/fund.rb
85
+ - lib/api/fund_list.rb
77
86
  - lib/api/individual.rb
78
87
  - lib/api/individual_list.rb
79
88
  - lib/api/mergeable_individual_list.rb
@@ -91,6 +100,7 @@ files:
91
100
  - lib/readers/batch_list_reader.rb
92
101
  - lib/readers/batch_reader.rb
93
102
  - lib/readers/campus_list_reader.rb
103
+ - lib/readers/fund_list_reader.rb
94
104
  - lib/readers/individual_list_reader.rb
95
105
  - lib/readers/individual_reader.rb
96
106
  - lib/writers/api_writer.rb
@@ -103,26 +113,27 @@ files:
103
113
  - spec/writers/user_writer_spec.rb
104
114
  homepage: https://github.com/weshays/church-community-builder-api-ruby
105
115
  licenses: []
106
- metadata: {}
107
116
  post_install_message:
108
117
  rdoc_options: []
109
118
  require_paths:
110
119
  - lib
111
120
  required_ruby_version: !ruby/object:Gem::Requirement
121
+ none: false
112
122
  requirements:
113
123
  - - ! '>='
114
124
  - !ruby/object:Gem::Version
115
125
  version: '0'
116
126
  required_rubygems_version: !ruby/object:Gem::Requirement
127
+ none: false
117
128
  requirements:
118
129
  - - ! '>='
119
130
  - !ruby/object:Gem::Version
120
131
  version: '0'
121
132
  requirements: []
122
133
  rubyforge_project: Project on www.github.com
123
- rubygems_version: 2.1.10
134
+ rubygems_version: 1.8.25
124
135
  signing_key:
125
- specification_version: 4
136
+ specification_version: 3
126
137
  summary: Ruby gem/plugin to interact with the Church Community Builder API.
127
138
  test_files:
128
139
  - spec/api/user_spec.rb
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MzZmY2JmYjEzYWYxOTg4OGJiYzMxNzc0YjA1ZjNmOGQ2MThhN2FhYw==
5
- data.tar.gz: !binary |-
6
- ZTgzZTgzMDgwMzc4NjEzMjc0YzVjMjRmYjc5MTExYzVhMWFiN2EzZg==
7
- SHA512:
8
- metadata.gz: !binary |-
9
- YWZmZGVkZjhiZmUxZTZmOThmZTY5MGViNzA0ODA1NTFjMTc4ZThhNjUwZmFl
10
- ZjMyZGVjZjNhNmI2NTdlOWIyYzFjMGU2NGZjYjA3YTcwZmI3OWU5NGYwZDE1
11
- MmFlZmQ5YjViZjcwM2RiNmY2NmEzNzkwNTJmNWE4OTVhY2IxNmI=
12
- data.tar.gz: !binary |-
13
- MzYzMjk4ZWE2MTZhOWEyZGNiNjk2ZjBlYjNhNjZlYWMxODIwMGM2YjI5OTMz
14
- MTNjM2FjMzE3Mzc2MWFhZWVmOTRlZWFkY2FlOTk2NjE5ZTRiOGViNmNlYWY4
15
- ODQwOGQ3ZWIzZWY5OWVlOTA0NGY3ODQ3NzhlNzhjZDkyYzliNGE=
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm ruby-1.9.3-p448@church-community-builder-api --create