virtuous 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/publish.yml +23 -0
- data/CHANGELOG.md +7 -1
- data/README.md +1 -1
- data/lib/virtuous/client/project.rb +58 -0
- data/lib/virtuous/client.rb +1 -0
- data/lib/virtuous/version.rb +1 -1
- data/spec/support/fixtures/project_query_options.json +2701 -0
- data/spec/support/fixtures/projects.json +93 -0
- data/spec/support/virtuous_mock.rb +3 -1
- data/spec/virtuous/resources/project_spec.rb +70 -0
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21706d887ab7c6356cf12b521724170cd196d432d73bca548d678240f593a0c7
|
4
|
+
data.tar.gz: 79702a4ff37002499687c5eb6d2bd52d5b5ca719ad7654a0d40ed4213af7e6a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd02d1df0306c1d7c575e8dc4c782f9047599b3eb0c3820b09fc240ccaa49a708c9310115b993e8f00041069442565770beb57b744ef8c2be8f11c7bae36523d
|
7
|
+
data.tar.gz: 25c7401a3029d7d5796a416b07081a921b33d34cadb31c9a091e6f4276d6939f49a90b61f0743d8fd76795960e777c55ae019cc1adc218a3462db0853b65838a
|
@@ -0,0 +1,23 @@
|
|
1
|
+
name: Publish
|
2
|
+
|
3
|
+
on:
|
4
|
+
release:
|
5
|
+
types: [published]
|
6
|
+
|
7
|
+
permissions:
|
8
|
+
contents: read # to checkout the code (actions/checkout)
|
9
|
+
jobs:
|
10
|
+
build:
|
11
|
+
name: Publish to Rubygems
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v3
|
16
|
+
- name: Set up Ruby
|
17
|
+
uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
bundler-cache: true
|
20
|
+
- name: Publish to RubyGems
|
21
|
+
uses: dawidd6/action-publish-gem@v1
|
22
|
+
with:
|
23
|
+
api_key: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
|
data/CHANGELOG.md
CHANGED
@@ -9,10 +9,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
9
9
|
|
10
10
|
### Added
|
11
11
|
|
12
|
+
- Method to query projects
|
13
|
+
|
14
|
+
## [0.0.2] - 2024-01-04
|
15
|
+
|
16
|
+
### Added
|
17
|
+
|
12
18
|
- A Client class with support for api key and OAuth authentication
|
13
19
|
- Methods to find, create and update contacts
|
14
20
|
- Methods to find, create, update and delete individuals
|
15
21
|
- Methods to find, create, update and delete gifts
|
16
22
|
- Method query gift designations
|
17
23
|
|
18
|
-
[unreleased]: https://github.com/taylorbrooks/virtuous/compare/v0.0.
|
24
|
+
[unreleased]: https://github.com/taylorbrooks/virtuous/compare/v0.0.2...HEAD
|
data/README.md
CHANGED
@@ -0,0 +1,58 @@
|
|
1
|
+
module Virtuous
|
2
|
+
class Client
|
3
|
+
module Project
|
4
|
+
##
|
5
|
+
# Queries a list of available project query options.
|
6
|
+
# @return [Hash] A list of available project query options.
|
7
|
+
def project_query_options
|
8
|
+
parse(get('api/Project/QueryOptions'))
|
9
|
+
end
|
10
|
+
|
11
|
+
##
|
12
|
+
# Queries projects.
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
# client.query_projects(
|
16
|
+
# take: 5, skip: 0, sort_by: 'Id',
|
17
|
+
# conditions: [{ parameter: 'Project Code', operator: 'Is', value: 102 }]
|
18
|
+
# )
|
19
|
+
#
|
20
|
+
# @option options [Integer] :take The maximum amount of projects to query. Default: 10.
|
21
|
+
# Max is 1000.
|
22
|
+
# @option options [Integer] :skip The number of projects to skip. Default: 0.
|
23
|
+
# @option options [String] :sort_by The value to sort records by.
|
24
|
+
# @option options [Boolean] :descending If true the records will be sorted in descending
|
25
|
+
# order.
|
26
|
+
# @option options [Array] :conditions An array of conditions to filter the project.
|
27
|
+
# Use {project_query_options} to see
|
28
|
+
# a full list of available conditions.
|
29
|
+
#
|
30
|
+
# @return [Hash] A hash with a list and the total amount of projects that satisfy
|
31
|
+
# the conditions.
|
32
|
+
# @example Output
|
33
|
+
# { list: [...], total: n }
|
34
|
+
#
|
35
|
+
def query_projects(**options)
|
36
|
+
uri = URI('api/Project/Query')
|
37
|
+
query_params = options.slice(:take, :skip)
|
38
|
+
uri.query = URI.encode_www_form(query_params) unless query_params.empty?
|
39
|
+
|
40
|
+
parse(post(uri, format(query_projects_body(options))))
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def query_projects_body(options)
|
46
|
+
conditions = options[:conditions]
|
47
|
+
body = options.slice(:sort_by, :descending)
|
48
|
+
return body if conditions.nil?
|
49
|
+
|
50
|
+
body.merge({
|
51
|
+
groups: [{
|
52
|
+
conditions: conditions
|
53
|
+
}]
|
54
|
+
})
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/lib/virtuous/client.rb
CHANGED
data/lib/virtuous/version.rb
CHANGED