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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c435c6a389b27d1644f8fa32d0df952aa9bcb83baf152973c8e2f55b0b418a1
4
- data.tar.gz: 13075eb9634a01b1597c6a8be58444b1ec89738efe8842b124e4e640237163a4
3
+ metadata.gz: 21706d887ab7c6356cf12b521724170cd196d432d73bca548d678240f593a0c7
4
+ data.tar.gz: 79702a4ff37002499687c5eb6d2bd52d5b5ca719ad7654a0d40ed4213af7e6a5
5
5
  SHA512:
6
- metadata.gz: 720aaf08ccabd9f7d1b7da3b07b4d028646c910c32605d85c4fe915050799eec9880b70f377674af848af13cab25fe18e92c3c6f460393499739188d5010ed29
7
- data.tar.gz: 8b65f36c8bef728c092210f0448769b2d581d445755ca35d23eea6d1ae9e624bc9bad1602fa5edc4f0f45ac9920cf5f6c02b5877f07444366133422f9457d4bf
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.0...HEAD
24
+ [unreleased]: https://github.com/taylorbrooks/virtuous/compare/v0.0.2...HEAD
data/README.md CHANGED
@@ -14,7 +14,7 @@ Add this line to your application's Gemfile:
14
14
 
15
15
  ```ruby
16
16
  # in your Gemfile
17
- gem 'virtuous', '~> 0.0.1'
17
+ gem 'virtuous', '~> 0.0.2'
18
18
 
19
19
  # then...
20
20
  bundle install
@@ -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
@@ -75,6 +75,7 @@ module Virtuous
75
75
  include Gift
76
76
  include RecurringGift
77
77
  include GiftDesignation
78
+ include Project
78
79
 
79
80
  ##
80
81
  # Access token used for OAuth authentication.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Virtuous
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.3'
5
5
  end