Class: FaithTeams::API::V2::Entity::Batch
- Inherits:
-
Base
- Object
- Base
- FaithTeams::API::V2::Entity::Batch
show all
- Defined in:
- lib/faithteams/api/v2/entity/batch.rb
Overview
Wraps an faithteams batch object
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #saved?, #to_h
Instance Method Details
#batch_id ⇒ Integer?
Also known as:
id
10
11
12
|
# File 'lib/faithteams/api/v2/entity/batch.rb', line 10
def batch_id
read_attribute(:batchId)
end
|
#contributions ⇒ Array<FaithTeams::API::V2::Entity::Contributions>
16
17
18
19
20
21
22
23
|
# File 'lib/faithteams/api/v2/entity/batch.rb', line 16
def contributions
records = read_attribute(:contributions)
return [] unless records.present?
records.group_by { |r| r["parentId"] }
.values
.map { FaithTeams::API::V2::Entity::Contribution.new(attributes: _1) }
end
|
#created_datetime ⇒ String?
26
27
28
|
# File 'lib/faithteams/api/v2/entity/batch.rb', line 26
def created_datetime
read_attribute(:dtm).presence
end
|
#deleted? ⇒ Boolean
46
47
48
|
# File 'lib/faithteams/api/v2/entity/batch.rb', line 46
def deleted?
status == "D"
end
|
#open? ⇒ Boolean
41
42
43
|
# File 'lib/faithteams/api/v2/entity/batch.rb', line 41
def open?
status == "O"
end
|
#org_id ⇒ Integer?
31
32
33
|
# File 'lib/faithteams/api/v2/entity/batch.rb', line 31
def org_id
read_attribute(:orgId)
end
|
#status ⇒ String?
Returns "O" for open, "C" for closed, "D" for deleted.
36
37
38
|
# File 'lib/faithteams/api/v2/entity/batch.rb', line 36
def status
read_attribute(:status).presence
end
|
#title ⇒ String?
51
52
53
|
# File 'lib/faithteams/api/v2/entity/batch.rb', line 51
def title
read_attribute(:title).presence
end
|
#updated_datetime ⇒ String?
56
57
58
|
# File 'lib/faithteams/api/v2/entity/batch.rb', line 56
def updated_datetime
read_attribute(:updatedDtm).presence
end
|
#updated_user_id ⇒ Integer?
61
62
63
|
# File 'lib/faithteams/api/v2/entity/batch.rb', line 61
def updated_user_id
read_attribute(:updatedUser)
end
|