fellowshipone-api 0.6.4 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5cda3fc15b3195e601e573ea95f73b41b3ccbe32
4
- data.tar.gz: 3ac5a3852bd70c7b66a5c32f776ce36961485d23
3
+ metadata.gz: db8330628a969a27438a6433a93ae82834d4a8dd
4
+ data.tar.gz: 616b98b6ab7d29f06154e6b89462b2e67ff0753b
5
5
  SHA512:
6
- metadata.gz: 74a92ac8b66f82592a5e588537f9a589cd25d87cf4be6d92a9b16f323a668644817bfdddc4d829181115e4b5170bae64de4046ce68a646a7ca7f6418fa7a9cb5
7
- data.tar.gz: 1a53af1bfde5e9faba21f50ec31131b60e349432d3e333831265392b7f4da88995735b615b26d6c77b282bc833c1d161c40222081cb62b7c422683adb1cd0ded
6
+ metadata.gz: 1a7af482228b5dfe4eb0e705b726d123a5d576c2ecfb888d86de3840b781a26fcf7d54161f93ef94665d22991844506fc2b992a5d0890754b87be3cd3c2eac80
7
+ data.tar.gz: be8ee2e2416ccbc9bb12a330d6ec34ec6c1a38aebc87c44300036c910ec52c839eb46773d3c85a3b9b3072cc9c5595fea596c2d2d2af91a741776a997c944af7
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  PROJECT_GEM = 'fellowshipone-api'
3
- PROJECT_GEM_VERSION = '0.6.4'
3
+ PROJECT_GEM_VERSION = '0.7.0'
4
4
 
5
5
  s.name = PROJECT_GEM
6
6
  s.version = PROJECT_GEM_VERSION
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
 
9
9
  s.homepage = 'https://github.com/weshays/fellowshipone-api-ruby'
10
10
  s.rubyforge_project = 'Project on www.github.com'
11
- s.authors = ['Wes Hays', 'Chad Feller']
11
+ s.authors = ['Wes Hays', 'Chad Feller', 'Taylor Brooks']
12
12
  s.email = ['weshays@gbdev.com','feller@cs.unr.edu']
13
13
 
14
14
  s.summary = 'Ruby gem/plugin to interact with the FellowshipOne API (https://developer.fellowshipone.com/).'
@@ -153,6 +153,24 @@ module FellowshipOne
153
153
  end
154
154
 
155
155
 
156
+ def status_name
157
+ self.status['name']
158
+ end
159
+
160
+ def status_date
161
+ self.status['date']
162
+ end
163
+
164
+ def status_comment
165
+ self.status['comment']
166
+ end
167
+
168
+ def substatus_name
169
+ self.status['subStatus']['name']
170
+ end
171
+
172
+
173
+
156
174
  def _field_map
157
175
  {:id => '@id',
158
176
  :uri => '@uri',
@@ -0,0 +1,31 @@
1
+ module FellowshipOne
2
+
3
+ class Status < ApiObject
4
+
5
+ f1_attr_accessor :id,
6
+ :name
7
+
8
+ # Load the status by the specified ID.
9
+ #
10
+ # @param status_id The ID of the status to load.
11
+ #
12
+ # Returns a new Status object.
13
+ def self.load_by_id(status_id)
14
+ reader = StatusReader.new(status_id)
15
+ self.new(reader)
16
+ end
17
+
18
+ # Constructor.
19
+ #
20
+ # @param reader (optional) The object that has the data. This can be a StatusReader or Hash object.
21
+ def initialize(reader = nil)
22
+ if reader.is_a?(StatusReader)
23
+ initialize_from_json_object(reader.load_feed['fund'])
24
+ elsif reader.is_a?(Hash)
25
+ initialize_from_json_object(reader)
26
+ end
27
+ end
28
+
29
+ end
30
+
31
+ end
@@ -0,0 +1,53 @@
1
+ module FellowshipOne
2
+
3
+ class StatusList
4
+
5
+ include Enumerable
6
+
7
+ attr_reader :count, :page_number, :total_records, :additional_pages
8
+
9
+
10
+ # Constructor.
11
+ #
12
+ # @param options A hash of options for loading the list.
13
+ #
14
+ # Options:
15
+ # :reader - (optional) The Reader to use to load the data.
16
+ def initialize(options = {})
17
+ reader = options[:reader] || FellowshipOne::StatusListReader.new(options)
18
+ @json_data = reader.load_feed
19
+ @count = @json_data['statuses']['status'].size.to_i
20
+ @page_number = 1
21
+ @total_records = @count
22
+ @additional_pages = 0
23
+ end
24
+
25
+ # Get the specified status.
26
+ #
27
+ # @param index The index of the status to get.
28
+ #
29
+ # @return Status
30
+ def [](index)
31
+ Status.new( @json_data['statuses']['status'][index] ) if @json_data['statuses']['status'][index]
32
+ end
33
+
34
+
35
+ # This method is needed for Enumerable.
36
+ def each &block
37
+ @json_data['statuses']['status'].each{ |status| yield( Status.new(status) )}
38
+ end
39
+
40
+ # Alias the count method
41
+ alias :size :count
42
+
43
+
44
+ # Checks if the list is empty.
45
+ #
46
+ # @return True on empty, false otherwise.
47
+ def empty?
48
+ self.count == 0 ? true : false
49
+ end
50
+
51
+ end
52
+
53
+ end
@@ -0,0 +1,13 @@
1
+ module FellowshipOne
2
+
3
+ class StatusListReader < ApiReader
4
+
5
+ # Constructor.
6
+ def initialize(options = {})
7
+ @url_data_params = options[:url_data_params]
8
+ @url_data_path = options[:url_data_path] || "/v1/People/Statuses"
9
+ end
10
+
11
+ end
12
+
13
+ end
@@ -0,0 +1,14 @@
1
+ module FellowshipOne
2
+
3
+ class StatusReader < ApiReader
4
+
5
+ # Constructor.
6
+ #
7
+ # @param status_id The ID of the fund to load.
8
+ def initialize(status_id)
9
+ @url_data_path = "/v1/People/Statuses/#{status_id}"
10
+ end
11
+
12
+ end
13
+
14
+ end
@@ -20,7 +20,8 @@ module FellowshipOne
20
20
  @updatable_fields = [:amount,
21
21
  :fund, #required
22
22
  :received_date, #required
23
- :contribution_type] #required
23
+ :contribution_type, #required
24
+ :memo]
24
25
  end
25
26
 
26
27
  end
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fellowshipone-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wes Hays
8
8
  - Chad Feller
9
+ - Taylor Brooks
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2014-05-23 00:00:00.000000000 Z
13
+ date: 2014-05-27 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: typhoeus
@@ -70,6 +71,8 @@ files:
70
71
  - lib/api/person.rb
71
72
  - lib/api/person_list.rb
72
73
  - lib/api/search.rb
74
+ - lib/api/status.rb
75
+ - lib/api/status_list.rb
73
76
  - lib/api/sub_fund_list.rb
74
77
  - lib/auto_load.rb
75
78
  - lib/common.rb
@@ -87,6 +90,8 @@ files:
87
90
  - lib/readers/member_household_list_reader.rb
88
91
  - lib/readers/person_list_reader.rb
89
92
  - lib/readers/person_reader.rb
93
+ - lib/readers/status_list_reader.rb
94
+ - lib/readers/status_reader.rb
90
95
  - lib/readers/sub_fund_list_reader.rb
91
96
  - lib/writers/api_writer.rb
92
97
  - lib/writers/communication_writer.rb