fellowshipone-api 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +3 -0
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/Gemfile +14 -0
  6. data/Gemfile.lock +64 -0
  7. data/README.rdoc +44 -0
  8. data/Rakefile +32 -0
  9. data/fellowshipone_api.gemspec +25 -0
  10. data/lib/api/api_object.rb +141 -0
  11. data/lib/api/communication.rb +59 -0
  12. data/lib/api/contribution.rb +97 -0
  13. data/lib/api/contribution_list.rb +57 -0
  14. data/lib/api/fund.rb +40 -0
  15. data/lib/api/fund_list.rb +53 -0
  16. data/lib/api/household.rb +50 -0
  17. data/lib/api/household_list.rb +78 -0
  18. data/lib/api/member_household_list.rb +73 -0
  19. data/lib/api/mergeable_household_list.rb +79 -0
  20. data/lib/api/mergeable_person_list.rb +110 -0
  21. data/lib/api/person.rb +169 -0
  22. data/lib/api/person_list.rb +85 -0
  23. data/lib/api/search.rb +55 -0
  24. data/lib/auto_load.rb +17 -0
  25. data/lib/common.rb +76 -0
  26. data/lib/exceptions.rb +5 -0
  27. data/lib/fellowship_one.rb +54 -0
  28. data/lib/oauth_monkey_patch.rb +13 -0
  29. data/lib/readers/api_reader.rb +34 -0
  30. data/lib/readers/communication_reader.rb +19 -0
  31. data/lib/readers/contribution_list_reader.rb +37 -0
  32. data/lib/readers/contribution_reader.rb +18 -0
  33. data/lib/readers/fund_list_reader.rb +13 -0
  34. data/lib/readers/fund_reader.rb +14 -0
  35. data/lib/readers/household_list_reader.rb +62 -0
  36. data/lib/readers/household_reader.rb +18 -0
  37. data/lib/readers/member_household_list_reader.rb +27 -0
  38. data/lib/readers/person_list_reader.rb +37 -0
  39. data/lib/readers/person_reader.rb +20 -0
  40. data/lib/writers/api_writer.rb +64 -0
  41. data/lib/writers/communication_writer.rb +27 -0
  42. data/lib/writers/contribution_writer.rb +28 -0
  43. data/lib/writers/household_writer.rb +30 -0
  44. data/lib/writers/person_writer.rb +64 -0
  45. data/spec/api/person_spec.rb +21 -0
  46. data/spec/functional/fellowship_one_spec.rb +17 -0
  47. data/spec/readers/api_reader_spec.rb +7 -0
  48. data/spec/spec_helper.rb +47 -0
  49. data/spec/vcr_setup.rb +5 -0
  50. data/spec/writers/api_writer_spec.rb +7 -0
  51. metadata +129 -0
@@ -0,0 +1,30 @@
1
+ module FellowshipOne
2
+
3
+ class HouseholdWriter < ApiWriter
4
+
5
+ # Constructor.
6
+ #
7
+ # @param data The json object data to save.
8
+ def initialize(data)
9
+ if data[:id]
10
+ @url_action = :put
11
+ @url_data_path = "/v1/Households/#{data[:id]}"
12
+ else
13
+ @url_action = :post
14
+ @url_data_path = "/v1/Households"
15
+ end
16
+ @url_data_delete_path = "/v1/Households/#{data[:id]}"
17
+
18
+ @url_data_params = {:household => data}
19
+
20
+ @updatable_fields = [:oldID,
21
+ :hCode,
22
+ :householdName,
23
+ :householdSortName,
24
+ :householdFirstName,
25
+ :lastSecurityAuthorization]
26
+ end
27
+
28
+ end
29
+
30
+ end
@@ -0,0 +1,64 @@
1
+ module FellowshipOne
2
+
3
+ class PersonWriter < ApiWriter
4
+
5
+ # Constructor.
6
+ #
7
+ # @param data The json object data to save.
8
+ def initialize(data)
9
+ if data[:id]
10
+ @url_action = :put
11
+ @url_data_path = "/v1/People/#{data[:id]}"
12
+ else
13
+ @url_action = :post
14
+ @url_data_path = "/v1/People"
15
+ end
16
+ @url_data_delete_path = "/v1/People/#{data[:id]}"
17
+
18
+ @url_data_params = {'person' => data}
19
+
20
+ @updatable_fields = [:title,
21
+ :salutation,
22
+ :prefix,
23
+ :first_name,
24
+ :last_name, #required
25
+ :suffix,
26
+ :middle_name,
27
+ :goes_by_name,
28
+ :former_name,
29
+ :gender,
30
+ :date_of_birth,
31
+ :marital_status,
32
+ :household_member_type, #required
33
+ :is_authorized,
34
+ :status, #required
35
+ :occupation,
36
+ :employer,
37
+ :school,
38
+ :denomination,
39
+ :former_church,
40
+ :bar_code,
41
+ :member_envelope_code,
42
+ :default_tag_comment,
43
+ :weblink,
44
+ :solicit,
45
+ :thank,
46
+ :first_record,
47
+ :last_match_date,
48
+ :created_date,
49
+ :last_updated_date,
50
+ :id,
51
+ :uri,
52
+ :image_uri,
53
+ :old_id,
54
+ :i_code,
55
+ :household_id, #required
56
+ :old_household_id,
57
+ :attributes,
58
+ :addresses,
59
+ :communications]
60
+ end
61
+
62
+ end
63
+
64
+ end
@@ -0,0 +1,21 @@
1
+ require File.join(Dir.pwd, 'spec', 'spec_helper')
2
+
3
+ describe 'Person' do
4
+
5
+ before do
6
+ simulate_connection_to_server
7
+ end
8
+
9
+ it 'should load a person by ID' do
10
+ VCR.use_cassette('person', :record => :new_episodes) do
11
+ person = FellowshipOne::Person.load_by_id(44639467)
12
+ #person.first_name.should == 'Wes'
13
+ puts person.inspect
14
+ end
15
+ end
16
+
17
+ it 'should load a person by a JSON string'
18
+
19
+ end
20
+
21
+
@@ -0,0 +1,17 @@
1
+ require File.join(Dir.pwd, 'spec', 'spec_helper')
2
+
3
+ describe 'FellowshipOneApi' do
4
+
5
+ before do
6
+ #simulate_connection_to_server
7
+ end
8
+
9
+ after do
10
+
11
+ end
12
+
13
+ it 'should connect successfully'
14
+
15
+ end
16
+
17
+
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe FellowshipOne::ApiReader do
4
+
5
+ it 'should pass'
6
+
7
+ end
@@ -0,0 +1,47 @@
1
+ require File.expand_path( File.dirname(__FILE__) + '/../lib/fellowship_one.rb')
2
+
3
+ require 'debugger'
4
+
5
+ require 'vcr'
6
+ require 'vcr_setup'
7
+ require 'webmock/rspec'
8
+
9
+ Dir.glob(File.dirname(__FILE__) + "/factories/*").each { |f| require f }
10
+
11
+ RSpec.configure do |config|
12
+ config.treat_symbols_as_metadata_keys_with_true_values = true
13
+ config.run_all_when_everything_filtered = true
14
+ config.filter_run :focus
15
+
16
+ # Run specs in random order to surface order dependencies. If you find an
17
+ # order dependency and want to debug it, you can fix the order by providing
18
+ # the seed, which is printed after each run.
19
+ # --seed 1234
20
+ config.order = 'random'
21
+ end
22
+
23
+
24
+
25
+ module F1Keys
26
+
27
+ CONSUMER_KEY = '492'
28
+ CONSUMER_SECRET = '9956f9bf-297d-4940-9b17-a0fe50035071'
29
+ ENVIRONMENT = 'staging'
30
+ CHURCH_CODE = 'mortarstone'
31
+
32
+ CALLBACK_URL = 'http://www.example.com/fellowship_one_connect'
33
+
34
+ OAUTH_TOKEN = '2f843117-a090-41f5-b848-4487d3391e9b'
35
+ OAUTH_SECRET = 'cc780143-7e27-4cf4-bd1b-c4b1385a5e8c'
36
+
37
+ end
38
+
39
+
40
+ def simulate_connection_to_server
41
+ FellowshipOne::Api.connect(F1Keys::CHURCH_CODE,
42
+ F1Keys::CONSUMER_KEY,
43
+ F1Keys::CONSUMER_SECRET,
44
+ F1Keys::OAUTH_TOKEN,
45
+ F1Keys::OAUTH_SECRET,
46
+ false)
47
+ end
data/spec/vcr_setup.rb ADDED
@@ -0,0 +1,5 @@
1
+ VCR.configure do |config|
2
+ config.cassette_library_dir = 'spec/cassettes'
3
+ config.hook_into :webmock
4
+ config.default_cassette_options = { :record => :once, :erb => true }
5
+ end
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe FellowshipOne::ApiWriter do
4
+
5
+ it 'should pass'
6
+
7
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fellowshipone-api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.0
5
+ platform: ruby
6
+ authors:
7
+ - Wes Hays
8
+ - Chad Feller
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-12-25 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: typhoeus
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '='
19
+ - !ruby/object:Gem::Version
20
+ version: 0.6.6
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '='
26
+ - !ruby/object:Gem::Version
27
+ version: 0.6.6
28
+ - !ruby/object:Gem::Dependency
29
+ name: oauth_weshays
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '='
33
+ - !ruby/object:Gem::Version
34
+ version: 0.4.8.pre2
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '='
40
+ - !ruby/object:Gem::Version
41
+ version: 0.4.8.pre2
42
+ description: Ruby gem/plugin to interact with the FellowshipOne API (https://developer.fellowshipone.com/).
43
+ Checkout the project on github for more detail.
44
+ email:
45
+ - weshays@gbdev.com
46
+ - feller@cs.unr.edu
47
+ executables: []
48
+ extensions: []
49
+ extra_rdoc_files: []
50
+ files:
51
+ - .gitignore
52
+ - .ruby-gemset
53
+ - .ruby-version
54
+ - Gemfile
55
+ - Gemfile.lock
56
+ - README.rdoc
57
+ - Rakefile
58
+ - fellowshipone_api.gemspec
59
+ - lib/api/api_object.rb
60
+ - lib/api/communication.rb
61
+ - lib/api/contribution.rb
62
+ - lib/api/contribution_list.rb
63
+ - lib/api/fund.rb
64
+ - lib/api/fund_list.rb
65
+ - lib/api/household.rb
66
+ - lib/api/household_list.rb
67
+ - lib/api/member_household_list.rb
68
+ - lib/api/mergeable_household_list.rb
69
+ - lib/api/mergeable_person_list.rb
70
+ - lib/api/person.rb
71
+ - lib/api/person_list.rb
72
+ - lib/api/search.rb
73
+ - lib/auto_load.rb
74
+ - lib/common.rb
75
+ - lib/exceptions.rb
76
+ - lib/fellowship_one.rb
77
+ - lib/oauth_monkey_patch.rb
78
+ - lib/readers/api_reader.rb
79
+ - lib/readers/communication_reader.rb
80
+ - lib/readers/contribution_list_reader.rb
81
+ - lib/readers/contribution_reader.rb
82
+ - lib/readers/fund_list_reader.rb
83
+ - lib/readers/fund_reader.rb
84
+ - lib/readers/household_list_reader.rb
85
+ - lib/readers/household_reader.rb
86
+ - lib/readers/member_household_list_reader.rb
87
+ - lib/readers/person_list_reader.rb
88
+ - lib/readers/person_reader.rb
89
+ - lib/writers/api_writer.rb
90
+ - lib/writers/communication_writer.rb
91
+ - lib/writers/contribution_writer.rb
92
+ - lib/writers/household_writer.rb
93
+ - lib/writers/person_writer.rb
94
+ - spec/api/person_spec.rb
95
+ - spec/functional/fellowship_one_spec.rb
96
+ - spec/readers/api_reader_spec.rb
97
+ - spec/spec_helper.rb
98
+ - spec/vcr_setup.rb
99
+ - spec/writers/api_writer_spec.rb
100
+ homepage: https://github.com/weshays/fellowshipone-api-ruby
101
+ licenses: []
102
+ metadata: {}
103
+ post_install_message:
104
+ rdoc_options: []
105
+ require_paths:
106
+ - lib
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - '>='
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ requirements: []
118
+ rubyforge_project: Project on www.github.com
119
+ rubygems_version: 2.1.11
120
+ signing_key:
121
+ specification_version: 4
122
+ summary: Ruby gem/plugin to interact with the FellowshipOne API (https://developer.fellowshipone.com/).
123
+ test_files:
124
+ - spec/api/person_spec.rb
125
+ - spec/functional/fellowship_one_spec.rb
126
+ - spec/readers/api_reader_spec.rb
127
+ - spec/spec_helper.rb
128
+ - spec/vcr_setup.rb
129
+ - spec/writers/api_writer_spec.rb