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 +4 -4
- data/fellowshipone_api.gemspec +2 -2
- data/lib/api/person.rb +18 -0
- data/lib/api/status.rb +31 -0
- data/lib/api/status_list.rb +53 -0
- data/lib/readers/status_list_reader.rb +13 -0
- data/lib/readers/status_reader.rb +14 -0
- data/lib/writers/contribution_writer.rb +2 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db8330628a969a27438a6433a93ae82834d4a8dd
|
4
|
+
data.tar.gz: 616b98b6ab7d29f06154e6b89462b2e67ff0753b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a7af482228b5dfe4eb0e705b726d123a5d576c2ecfb888d86de3840b781a26fcf7d54161f93ef94665d22991844506fc2b992a5d0890754b87be3cd3c2eac80
|
7
|
+
data.tar.gz: be8ee2e2416ccbc9bb12a330d6ec34ec6c1a38aebc87c44300036c910ec52c839eb46773d3c85a3b9b3072cc9c5595fea596c2d2d2af91a741776a997c944af7
|
data/fellowshipone_api.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
PROJECT_GEM = 'fellowshipone-api'
|
3
|
-
PROJECT_GEM_VERSION = '0.
|
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/).'
|
data/lib/api/person.rb
CHANGED
@@ -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',
|
data/lib/api/status.rb
ADDED
@@ -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
|
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.
|
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-
|
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
|