cirro-ruby-client 0.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +4 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +23 -14
- data/README.md +2 -0
- data/cirro-ruby-client.gemspec +1 -1
- data/lib/cirro_io/client.rb +7 -0
- data/lib/cirro_io/client/app_user.rb +6 -0
- data/lib/cirro_io/client/app_worker.rb +2 -3
- data/lib/cirro_io/client/base.rb +13 -0
- data/lib/cirro_io/client/gig.rb +45 -0
- data/lib/cirro_io/client/gig_invitation.rb +6 -0
- data/lib/cirro_io/client/gig_result.rb +8 -0
- data/lib/cirro_io/client/gig_task.rb +6 -0
- data/lib/cirro_io/client/gig_time_activity.rb +7 -0
- data/lib/cirro_io/client/response_debugging_middleware.rb +1 -1
- data/lib/cirro_io/client/version.rb +1 -1
- data/lib/cirro_io/client/worker_invitation_filter.rb +6 -0
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4345f8d02b4f3afcc21cd23b3b0c2edcfadeeeeb887dd0e7c7f501b5bb2ced40
|
4
|
+
data.tar.gz: 00ee7217ad02c180d22cae50b5c23a915a8998c47efacf68e99c7da630e4d255
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec030038393796f3dcac6ccc457453100584e8fc2aeb4d2f9016a2b3d2cd004078e6155062bd940584909659f1e026cd325b0c2702dd7936afe80d03f7b7580e
|
7
|
+
data.tar.gz: '0853aff5207749a568f87fce5bf43d87ab47d883513c1c389f15d10398f71ce7d8f5ca4fced3e7f49aec4b042b74a34ccd2573a73d3c9fd2234c4de11fec3e0c'
|
data/.circleci/config.yml
CHANGED
data/Gemfile
CHANGED
@@ -5,8 +5,11 @@ gemspec
|
|
5
5
|
|
6
6
|
gem 'rake', '~> 12.0'
|
7
7
|
gem 'rspec', '~> 3.0'
|
8
|
+
# tempprary till my PR gets approved in original gem
|
9
|
+
gem 'json_api_client', git: 'https://github.com/inderps/json_api_client'
|
8
10
|
|
9
11
|
group :development do
|
12
|
+
gem 'faker'
|
10
13
|
gem 'pry'
|
11
14
|
gem 'rubocop', require: false
|
12
15
|
gem 'rubocop-rspec'
|
data/Gemfile.lock
CHANGED
@@ -1,16 +1,28 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/inderps/json_api_client
|
3
|
+
revision: 675e1c8b1bf9978ca4722c2aa19314fb0aa5860b
|
4
|
+
specs:
|
5
|
+
json_api_client (1.17.1)
|
6
|
+
activemodel (>= 3.2.0)
|
7
|
+
activesupport (>= 3.2.0)
|
8
|
+
addressable (~> 2.2)
|
9
|
+
faraday (>= 0.15.2, < 1.2.0)
|
10
|
+
faraday_middleware (>= 0.9.0, < 1.2.0)
|
11
|
+
rack (>= 0.2)
|
12
|
+
|
1
13
|
PATH
|
2
14
|
remote: .
|
3
15
|
specs:
|
4
|
-
cirro-ruby-client (
|
5
|
-
|
16
|
+
cirro-ruby-client (1.1.0)
|
17
|
+
faraday_middleware
|
6
18
|
jwt
|
7
19
|
|
8
20
|
GEM
|
9
21
|
remote: https://rubygems.org/
|
10
22
|
specs:
|
11
|
-
activemodel (6.0.3.
|
12
|
-
activesupport (= 6.0.3.
|
13
|
-
activesupport (6.0.3.
|
23
|
+
activemodel (6.0.3.4)
|
24
|
+
activesupport (= 6.0.3.4)
|
25
|
+
activesupport (6.0.3.4)
|
14
26
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
27
|
i18n (>= 0.7, < 2)
|
16
28
|
minitest (~> 5.1)
|
@@ -23,6 +35,8 @@ GEM
|
|
23
35
|
concurrent-ruby (1.1.7)
|
24
36
|
crack (0.4.4)
|
25
37
|
diff-lcs (1.4.4)
|
38
|
+
faker (2.14.0)
|
39
|
+
i18n (>= 1.6, < 2)
|
26
40
|
faraday (1.0.1)
|
27
41
|
multipart-post (>= 1.2, < 3)
|
28
42
|
faraday_middleware (1.0.0)
|
@@ -30,13 +44,6 @@ GEM
|
|
30
44
|
hashdiff (1.0.1)
|
31
45
|
i18n (1.8.5)
|
32
46
|
concurrent-ruby (~> 1.0)
|
33
|
-
json_api_client (1.17.1)
|
34
|
-
activemodel (>= 3.2.0)
|
35
|
-
activesupport (>= 3.2.0)
|
36
|
-
addressable (~> 2.2)
|
37
|
-
faraday (>= 0.15.2, < 1.2.0)
|
38
|
-
faraday_middleware (>= 0.9.0, < 1.2.0)
|
39
|
-
rack (>= 0.2)
|
40
47
|
jwt (2.2.2)
|
41
48
|
method_source (1.0.0)
|
42
49
|
minitest (5.14.2)
|
@@ -81,20 +88,22 @@ GEM
|
|
81
88
|
rubocop (~> 0.87)
|
82
89
|
ruby-progressbar (1.10.1)
|
83
90
|
thread_safe (0.3.6)
|
84
|
-
tzinfo (1.2.
|
91
|
+
tzinfo (1.2.8)
|
85
92
|
thread_safe (~> 0.1)
|
86
93
|
unicode-display_width (1.7.0)
|
87
94
|
webmock (3.9.1)
|
88
95
|
addressable (>= 2.3.6)
|
89
96
|
crack (>= 0.3.2)
|
90
97
|
hashdiff (>= 0.4.0, < 2.0.0)
|
91
|
-
zeitwerk (2.4.
|
98
|
+
zeitwerk (2.4.2)
|
92
99
|
|
93
100
|
PLATFORMS
|
94
101
|
ruby
|
95
102
|
|
96
103
|
DEPENDENCIES
|
97
104
|
cirro-ruby-client!
|
105
|
+
faker
|
106
|
+
json_api_client!
|
98
107
|
pry
|
99
108
|
rake (~> 12.0)
|
100
109
|
rspec (~> 3.0)
|
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
This gem provides access to the [Cirro REST API](https://staging.cirro.io/api-docs/v1#cirro-api-documentation).
|
4
4
|
|
5
|
+
[![CircleCI](https://circleci.com/gh/test-IO/cirro-ruby-client/tree/master.svg?style=svg)](https://circleci.com/gh/test-IO/cirro-ruby-client/tree/master)
|
6
|
+
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Add this line to your application's Gemfile:
|
data/cirro-ruby-client.gemspec
CHANGED
data/lib/cirro_io/client.rb
CHANGED
@@ -4,7 +4,14 @@ require 'cirro_io/client/configuration'
|
|
4
4
|
require 'cirro_io/client/response_debugging_middleware'
|
5
5
|
require 'cirro_io/client/jwt_authentication'
|
6
6
|
require 'cirro_io/client/base'
|
7
|
+
require 'cirro_io/client/gig_invitation'
|
8
|
+
require 'cirro_io/client/app_user'
|
7
9
|
require 'cirro_io/client/app_worker'
|
10
|
+
require 'cirro_io/client/worker_invitation_filter'
|
11
|
+
require 'cirro_io/client/gig_task'
|
12
|
+
require 'cirro_io/client/gig_result'
|
13
|
+
require 'cirro_io/client/gig_time_activity'
|
14
|
+
require 'cirro_io/client/gig'
|
8
15
|
|
9
16
|
module CirroIO
|
10
17
|
module Client
|
data/lib/cirro_io/client/base.rb
CHANGED
@@ -9,6 +9,19 @@ module CirroIO
|
|
9
9
|
super(url)
|
10
10
|
connection.faraday.url_prefix = url
|
11
11
|
end
|
12
|
+
|
13
|
+
def self.custom_post(endpoint, payload)
|
14
|
+
custom_connection.post(endpoint, payload.to_json)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.custom_connection
|
18
|
+
Faraday.new(url: "#{CirroIO::Client.configuration.site}/#{CirroIO::Client.configuration.api_version}") do |conn|
|
19
|
+
conn.request :json
|
20
|
+
conn.response :json
|
21
|
+
conn.use CirroIO::Client::JwtAuthentication
|
22
|
+
conn.use JsonApiClient::Middleware::Status, {}
|
23
|
+
end
|
24
|
+
end
|
12
25
|
end
|
13
26
|
end
|
14
27
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module CirroIO
|
2
|
+
module Client
|
3
|
+
class Gig < Base
|
4
|
+
has_one :worker_invitation_filter
|
5
|
+
has_many :gig_tasks
|
6
|
+
has_many :gig_results
|
7
|
+
has_many :gig_time_activities
|
8
|
+
|
9
|
+
# rubocop:disable Metrics/AbcSize
|
10
|
+
def bulk_create_with(worker_invitation_filter, gig_tasks)
|
11
|
+
payload = { data: { attributes: attributes, relationships: {} } }
|
12
|
+
payload[:data][:relationships][:gig_tasks] = gig_tasks.map(&:attributes)
|
13
|
+
payload[:data][:relationships][:worker_invitation_filter] = worker_invitation_filter.attributes
|
14
|
+
|
15
|
+
response = self.class.custom_post('bulk/gigs', format_to_dashed_keys(payload))
|
16
|
+
|
17
|
+
self.class.parser.parse(self.class, response).first
|
18
|
+
end
|
19
|
+
|
20
|
+
def bulk_archive_with(gig_results, gig_time_activities)
|
21
|
+
payload = { data: { relationships: {} } }
|
22
|
+
payload[:data][:relationships][:gig_results] = gig_results.map do |result|
|
23
|
+
result.attributes.merge({ relationships: {
|
24
|
+
'app-worker': { data: result.app_worker.attributes },
|
25
|
+
'gig-task': { data: result.gig_task.attributes },
|
26
|
+
} })
|
27
|
+
end
|
28
|
+
payload[:data][:relationships][:gig_time_activities] = gig_time_activities.map do |activity|
|
29
|
+
activity.attributes.merge({ relationships: { 'app-worker': { data: activity.app_worker.attributes } } })
|
30
|
+
end
|
31
|
+
|
32
|
+
response = self.class.custom_post("bulk/gigs/#{id}/archive", format_to_dashed_keys(payload))
|
33
|
+
|
34
|
+
self.class.parser.parse(self.class, response).first
|
35
|
+
end
|
36
|
+
# rubocop:enable Metrics/AbcSize
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def format_to_dashed_keys(params)
|
41
|
+
params.deep_transform_keys { |key| key.to_s.gsub('_', '-') }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
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:
|
4
|
+
version: 1.2.0
|
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: 2020-
|
11
|
+
date: 2020-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: faraday_middleware
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -61,12 +61,19 @@ files:
|
|
61
61
|
- bin/setup
|
62
62
|
- cirro-ruby-client.gemspec
|
63
63
|
- lib/cirro_io/client.rb
|
64
|
+
- lib/cirro_io/client/app_user.rb
|
64
65
|
- lib/cirro_io/client/app_worker.rb
|
65
66
|
- lib/cirro_io/client/base.rb
|
66
67
|
- lib/cirro_io/client/configuration.rb
|
68
|
+
- lib/cirro_io/client/gig.rb
|
69
|
+
- lib/cirro_io/client/gig_invitation.rb
|
70
|
+
- lib/cirro_io/client/gig_result.rb
|
71
|
+
- lib/cirro_io/client/gig_task.rb
|
72
|
+
- lib/cirro_io/client/gig_time_activity.rb
|
67
73
|
- lib/cirro_io/client/jwt_authentication.rb
|
68
74
|
- lib/cirro_io/client/response_debugging_middleware.rb
|
69
75
|
- lib/cirro_io/client/version.rb
|
76
|
+
- lib/cirro_io/client/worker_invitation_filter.rb
|
70
77
|
homepage: https://cirro.io/api-docs/v1#cirro-api-documentation
|
71
78
|
licenses:
|
72
79
|
- MIT
|