cirro-ruby-client 1.5.0 → 1.6.2

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: b40b51067875bc8f05dbf8d6d3ef70713369437b84f7f02d34ad9ebc12e6f1f5
4
- data.tar.gz: 95d7598c00eb3ad3fcd7d2c357252620792dde5653ef3ca6a002753c2a9a5c91
3
+ metadata.gz: f0d061a9b240178ba1982a8afab295b214d060ab159fbdcedca4029a1a0b702a
4
+ data.tar.gz: 8a97b77f43397c611c186394a2882592fff533579507a3a80d6c21277585b59d
5
5
  SHA512:
6
- metadata.gz: aa7585fece3356f8511010df5f8b7635946da195b66350dd10cd7d0c964b18616ad53291ee12f287d37819666f73098569b550b8c6e9a6568a9d8b37edd230fc
7
- data.tar.gz: 4c4bb7c02b948a2a8786be6e622aaf5dac1ef9cc1fe046cee66dd15cafaa3f2d27595e1749e014d186ae72987108c79a277e08eeced5bdfa5e42756053b4e012
6
+ metadata.gz: 2ff6817b1b04bcd964c1b442d883d0f7d6d602f811c949303b7c9dd5a01ca894ea754daf6fbc4d2a2942255f1b9ef7879eebf10261221dbde4e59087f235b2eb
7
+ data.tar.gz: c568caf210771fb06aca9ae1e67c883dfb9cfb35549104a3bb942c15e9105b5435e74a2976578a19cdbb3f587fd32aea5569ef6840127b181754573de1941a6c
data/.circleci/config.yml CHANGED
@@ -1,9 +1,18 @@
1
1
  version: 2.1
2
+ infra_container: &infra_container
3
+ eu.gcr.io/cirro-io/swissknife@sha256:1dceb221bfc058c4ba22fe4dcbf4f30dfdc10951bc2293d5c53aebc4f87037f3
4
+
5
+ # Configure authentication in private registry
6
+ infra_container_registry_auth:
7
+ &infra_container_registry_auth
8
+ auth:
9
+ username: _json_key # default username when using a JSON key file to authenticate
10
+ password: $GOOGLE_JSON_KEY
2
11
 
3
12
  jobs:
4
- build:
13
+ test:
5
14
  docker:
6
- - image: circleci/ruby:2.7.1-node
15
+ - image: cimg/ruby:2.7.1-node
7
16
  environment:
8
17
  - RAILS_ENV=test
9
18
  - RACK_ENV=test
@@ -25,9 +34,10 @@ jobs:
25
34
  - run:
26
35
  name: Check code style
27
36
  command: bundle exec rubocop
37
+
28
38
  deploy:
29
39
  docker:
30
- - image: circleci/ruby:2.7.1-node
40
+ - image: cimg/ruby:2.7.1-node
31
41
  steps:
32
42
  - checkout
33
43
  - run:
@@ -56,14 +66,76 @@ jobs:
56
66
  gem push cirro-ruby-client-$version.gem
57
67
  shred -u ~/.gem/credentials
58
68
 
69
+ defectdojo:
70
+ docker:
71
+ - image: *infra_container
72
+ <<: *infra_container_registry_auth
73
+ environment:
74
+ - DEFECTDOJO_URL: defectdojo.testcloud.io
75
+ - DEFECTDOJO_PRODUCT: Cirro Ruby Client
76
+ - DEFECTDOJO_ENG_NAME: CircleCI Scan
77
+ steps:
78
+ - checkout
79
+ - run:
80
+ name: Setup access to GCP
81
+ command: |
82
+ echo $GOOGLE_JSON_KEY > ${HOME}/gcloud-service-key.json && \
83
+ gcloud auth activate-service-account --key-file=${HOME}/gcloud-service-key.json
84
+ gcloud auth configure-docker
85
+ - run:
86
+ name: Scans
87
+ command: |
88
+ unset GITHUB_TOKEN && trivy fs --exit-code 0 --no-progress --ignorefile .trivyignore-fake --format json --output filesystem-scan.json .
89
+ gitleaks detect --no-git --exit-code 0 --report-format json --report-path gitleaks.json
90
+ - run:
91
+ name: Send data to DefectDojo
92
+ command: |
93
+ export DEFECTDOJO_TOKEN=$(gcloud secrets versions access latest \
94
+ --secret="defectdojo_token" \
95
+ --project=cirro-io \
96
+ --quiet)
97
+
98
+ # Send Trivy filesystem scan
99
+ curl --fail --request POST https://$DEFECTDOJO_URL/api/v2/reimport-scan/ \
100
+ --header "Authorization: Token $DEFECTDOJO_TOKEN" \
101
+ --form "active=true" \
102
+ --form "auto_create_context=true" \
103
+ --form "branch_tag=${CIRCLE_BRANCH}" \
104
+ --form "commit_hash=${CIRCLE_SHA1}" \
105
+ --form "close_old_findings=true" \
106
+ --form "scan_type=Trivy Scan" \
107
+ --form "test_title=Trivy application scan" \
108
+ --form "engagement_name=${DEFECTDOJO_ENG_NAME}" \
109
+ --form "product_name=${DEFECTDOJO_PRODUCT}" \
110
+ --form "file=@filesystem-scan.json"
111
+
112
+ # Send Gitleaks scan
113
+ curl --fail --request POST https://$DEFECTDOJO_URL/api/v2/reimport-scan/ \
114
+ --header "Authorization: Token $DEFECTDOJO_TOKEN" \
115
+ --form "active=true" \
116
+ --form "auto_create_context=true" \
117
+ --form "branch_tag=${CIRCLE_BRANCH}" \
118
+ --form "commit_hash=${CIRCLE_SHA1}" \
119
+ --form "close_old_findings=true" \
120
+ --form "scan_type=Gitleaks Scan" \
121
+ --form "test_title=Gitleaks Scan" \
122
+ --form "engagement_name=${DEFECTDOJO_ENG_NAME}" \
123
+ --form "product_name=${DEFECTDOJO_PRODUCT}" \
124
+ --form "file=@gitleaks.json"
125
+
59
126
  workflows:
60
127
  version: 2
61
128
  deploy_the_gem:
62
129
  jobs:
63
- - build
130
+ - test
64
131
  - deploy:
65
132
  requires:
66
- - build
133
+ - test
134
+ filters:
135
+ branches:
136
+ only:
137
+ - master
138
+ - defectdojo:
67
139
  filters:
68
140
  branches:
69
141
  only:
data/CODE_OF_CONDUCT.md CHANGED
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
55
55
  ## Enforcement
56
56
 
57
57
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at singhinther@gmail.com. All
58
+ reported by contacting the project team at devs@test.io. All
59
59
  complaints will be reviewed and investigated and will result in a response that
60
60
  is deemed necessary and appropriate to the circumstances. The project team is
61
61
  obligated to maintain confidentiality with regard to the reporter of an incident.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cirro-ruby-client (1.5.0)
4
+ cirro-ruby-client (1.6.2)
5
5
  faraday (< 1.2.0)
6
6
  faraday_middleware
7
7
  json_api_client (>= 1.10.0)
@@ -10,19 +10,18 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activemodel (6.1.3.2)
14
- activesupport (= 6.1.3.2)
15
- activesupport (6.1.3.2)
13
+ activemodel (7.0.2.3)
14
+ activesupport (= 7.0.2.3)
15
+ activesupport (7.0.2.3)
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
17
  i18n (>= 1.6, < 2)
18
18
  minitest (>= 5.1)
19
19
  tzinfo (~> 2.0)
20
- zeitwerk (~> 2.3)
21
- addressable (2.7.0)
20
+ addressable (2.8.0)
22
21
  public_suffix (>= 2.0.2, < 5.0)
23
22
  ast (2.4.1)
24
23
  coderay (1.1.3)
25
- concurrent-ruby (1.1.7)
24
+ concurrent-ruby (1.1.10)
26
25
  crack (0.4.4)
27
26
  diff-lcs (1.4.4)
28
27
  faker (2.14.0)
@@ -30,21 +29,21 @@ GEM
30
29
  faraday (1.1.0)
31
30
  multipart-post (>= 1.2, < 3)
32
31
  ruby2_keywords
33
- faraday_middleware (1.0.0)
32
+ faraday_middleware (1.2.0)
34
33
  faraday (~> 1.0)
35
34
  hashdiff (1.0.1)
36
- i18n (1.8.5)
35
+ i18n (1.10.0)
37
36
  concurrent-ruby (~> 1.0)
38
- json_api_client (1.18.0)
37
+ json_api_client (1.21.0)
39
38
  activemodel (>= 3.2.0)
40
39
  activesupport (>= 3.2.0)
41
40
  addressable (~> 2.2)
42
- faraday (>= 0.15.2, < 1.2.0)
43
- faraday_middleware (>= 0.9.0, < 1.2.0)
41
+ faraday (>= 0.15.2, < 2.0)
42
+ faraday_middleware (>= 0.9.0, < 2.0)
44
43
  rack (>= 0.2)
45
- jwt (2.2.3)
44
+ jwt (2.3.0)
46
45
  method_source (1.0.0)
47
- minitest (5.14.4)
46
+ minitest (5.15.0)
48
47
  multipart-post (2.1.1)
49
48
  parallel (1.19.2)
50
49
  parser (2.7.2.0)
@@ -85,7 +84,7 @@ GEM
85
84
  rubocop-rspec (1.43.2)
86
85
  rubocop (~> 0.87)
87
86
  ruby-progressbar (1.10.1)
88
- ruby2_keywords (0.0.4)
87
+ ruby2_keywords (0.0.5)
89
88
  tzinfo (2.0.4)
90
89
  concurrent-ruby (~> 1.0)
91
90
  unicode-display_width (1.7.0)
@@ -93,7 +92,6 @@ GEM
93
92
  addressable (>= 2.3.6)
94
93
  crack (>= 0.3.2)
95
94
  hashdiff (>= 0.4.0, < 2.0.0)
96
- zeitwerk (2.4.2)
97
95
 
98
96
  PLATFORMS
99
97
  ruby
data/README.md CHANGED
@@ -55,3 +55,18 @@ invitation = CirroIO::Client::GigInvitation.new(gig: gig)
55
55
 
56
56
  invitation.bulk_create_with(filter, auto_accept: true) # by default auto_accept is false
57
57
  ```
58
+
59
+ #### Creating Payouts for workers
60
+
61
+ ```ruby
62
+ app_worker = CirroIO::Client::AppWorker.load(id: 1234)
63
+
64
+ CirroIO::Client::Payout.create(
65
+ app_worker: app_worker,
66
+ amount: 100, # € 1.00
67
+ title: "Bonus for something",
68
+ description: "Description of the bonus.",
69
+ cost_center_key: "PROJECT-CODE",
70
+ billing_date: DateTime.now
71
+ )
72
+ ```
@@ -28,6 +28,26 @@ module CirroIO
28
28
  conn.use JsonApiClient::Middleware::Status, {}
29
29
  end
30
30
  end
31
+
32
+ # HACK: https://github.com/JsonApiClient/json_api_client/issues/390
33
+ # waiting for json_api_client to release a new version with the fix
34
+ # https://github.com/JsonApiClient/json_api_client/pull/398
35
+ # rubocop:disable all
36
+ def initialize(params = {})
37
+ params = params.with_indifferent_access
38
+ @persisted = nil
39
+ @destroyed = nil
40
+ self.links = self.class.linker.new(params.delete(:links) || {})
41
+ self.relationships = self.class.relationship_linker.new(self.class, params.delete(:relationships) || {})
42
+ self.attributes = self.class.default_attributes.merge params.except(*self.class.prefix_params)
43
+ self.forget_change!(:type)
44
+ self.__belongs_to_params = params.slice(*self.class.prefix_params)
45
+
46
+ setup_default_properties
47
+
48
+ self.request_params = self.class.request_params_class.new(self.class)
49
+ end
50
+ # rubocop:enable all
31
51
  end
32
52
  end
33
53
  end
@@ -4,6 +4,7 @@ module CirroIO
4
4
  include CirroIO::Client::BulkActionHelper
5
5
 
6
6
  has_one :gig
7
+ has_one :app_worker
7
8
 
8
9
  def bulk_create_with(worker_filter, auto_accept: false)
9
10
  payload = { data: { attributes: attributes.merge(worker_filter: worker_filter.attributes, auto_accept: auto_accept) } }
@@ -1,6 +1,7 @@
1
1
  module CirroIO
2
2
  module Client
3
3
  class GigTask < Base
4
+ has_one :gig
4
5
  end
5
6
  end
6
7
  end
@@ -1,6 +1,7 @@
1
1
  module CirroIO
2
2
  module Client
3
3
  class GigTimeActivity < Base
4
+ has_one :gig
4
5
  has_one :app_worker
5
6
  end
6
7
  end
@@ -0,0 +1,8 @@
1
+ module CirroIO
2
+ module Client
3
+ class NotificationsBroadcast < Base
4
+ has_one :channel, class_name: 'NotificationsChannel'
5
+ has_one :worker_filter
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,6 @@
1
+ module CirroIO
2
+ module Client
3
+ class NotificationsChannel < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ module CirroIO
2
+ module Client
3
+ class NotificationsTemplate < Base
4
+ has_one :channel, class_name: 'NotificationsChannel'
5
+ end
6
+ end
7
+ end
@@ -1,7 +1,7 @@
1
1
  # rubocop:disable Style/MutableConstant
2
2
  module CirroIO
3
3
  module Client
4
- VERSION = '1.5.0'
4
+ VERSION = '1.6.2'
5
5
  end
6
6
  end
7
7
  # rubocop:enable Style/MutableConstant
@@ -15,6 +15,9 @@ require 'cirro_io/client/gig_result'
15
15
  require 'cirro_io/client/gig_time_activity'
16
16
  require 'cirro_io/client/gig'
17
17
  require 'cirro_io/client/payout'
18
+ require 'cirro_io/client/notifications_broadcast'
19
+ require 'cirro_io/client/notifications_channel'
20
+ require 'cirro_io/client/notifications_template'
18
21
 
19
22
  module CirroIO
20
23
  module Client
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cirro-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cirro Dev Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-09 00:00:00.000000000 Z
11
+ date: 2022-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -100,6 +100,9 @@ files:
100
100
  - lib/cirro_io/client/gig_task.rb
101
101
  - lib/cirro_io/client/gig_time_activity.rb
102
102
  - lib/cirro_io/client/jwt_authentication.rb
103
+ - lib/cirro_io/client/notifications_broadcast.rb
104
+ - lib/cirro_io/client/notifications_channel.rb
105
+ - lib/cirro_io/client/notifications_template.rb
103
106
  - lib/cirro_io/client/payout.rb
104
107
  - lib/cirro_io/client/response_debugging_middleware.rb
105
108
  - lib/cirro_io/client/version.rb
@@ -126,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
129
  - !ruby/object:Gem::Version
127
130
  version: '0'
128
131
  requirements: []
129
- rubygems_version: 3.1.2
132
+ rubygems_version: 3.1.3
130
133
  signing_key:
131
134
  specification_version: 4
132
135
  summary: Ruby client library for Cirro API