cirro-ruby-client 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33ba087b63705ed300fa9958de71d00e2dca208356662f8a82c4e6a66b81d141
4
- data.tar.gz: 6e7a7a20f585108f3e7b8954a1413621ca57ee1b5ff60a969deacabb2e224b52
3
+ metadata.gz: f6a519fabbdd1bfa16f4f088ec3d7dc648c6aceb74931e420ed1488619735cac
4
+ data.tar.gz: c08439cdaddb6444a2aba457dc93d68a997647a1472c6b39493461eddceb0402
5
5
  SHA512:
6
- metadata.gz: 495c530ff6247607095004c4c744b71f7e2db27dddaeaf5d494d87b7119ef0c24d550cf12ebcea3944610b0a631e92fcc04d10ccfefba21b738f2a720faf4e60
7
- data.tar.gz: b921117207120ee50213c281bcdda1d9bebae3ca57ec4e506d8999611a7d1a539e57f373b95f1555697ee485fcc8bc944413a5f3f375697850f10a22167fe628
6
+ metadata.gz: e82c0ff26229b5178e05e471a2fb746ac1de0cf5e531b1dcb0e77dfed39ba5b9205f1bdeaa91d221fe64617c578f473745896ee005f062ff7b947e83352b27af
7
+ data.tar.gz: 131bf1dc4a613de2c26ffaf3328ca1631e4a5b9f672274975ef69e1c767a035a9e33130cb2ccd834de4154c68762c25d3c763d53a655e6a866f6c395b33e8628
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cirro-ruby-client (1.0.1)
4
+ cirro-ruby-client (1.1.0)
5
+ faraday_middleware
5
6
  json_api_client
6
7
  jwt
7
8
 
@@ -27,4 +27,5 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  spec.add_runtime_dependency 'jwt'
29
29
  spec.add_runtime_dependency 'json_api_client'
30
+ spec.add_runtime_dependency 'faraday_middleware'
30
31
  end
@@ -7,6 +7,9 @@ require 'cirro_io/client/base'
7
7
  require 'cirro_io/client/gig_invitation'
8
8
  require 'cirro_io/client/app_user'
9
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'
10
13
 
11
14
  module CirroIO
12
15
  module Client
@@ -1,9 +1,6 @@
1
1
  module CirroIO
2
2
  module Client
3
3
  class AppUser < Base
4
- def self.resource_name
5
- 'app-users'
6
- end
7
4
  end
8
5
  end
9
6
  end
@@ -3,10 +3,6 @@ module CirroIO
3
3
  class AppWorker < Base
4
4
  has_one :app_user
5
5
  has_many :gig_invitations
6
-
7
- def self.resource_name
8
- 'app-workers'
9
- end
10
6
  end
11
7
  end
12
8
  end
@@ -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,28 @@
1
+ module CirroIO
2
+ module Client
3
+ class Gig < Base
4
+ has_one :worker_invitation_filter
5
+ has_many :gig_tasks
6
+
7
+ # rubocop:disable Metrics/AbcSize
8
+ def bulk_create_with(attrs)
9
+ payload = { data: { attributes: attributes } }
10
+
11
+ if attrs[:gig_tasks]
12
+ payload[:data][:relationships] ||= {}
13
+ payload[:data][:relationships][:gig_tasks] = attrs[:gig_tasks].map(&:attributes)
14
+ end
15
+
16
+ if attrs[:worker_invitation_filter]
17
+ payload[:data][:relationships] ||= {}
18
+ payload[:data][:relationships][:worker_invitation_filter] = attrs[:worker_invitation_filter].attributes
19
+ end
20
+
21
+ response = self.class.custom_post('bulk/gigs', payload)
22
+
23
+ self.class.parser.parse(self.class, response).first
24
+ end
25
+ # rubocop:enable Metrics/AbcSize
26
+ end
27
+ end
28
+ end
@@ -1,9 +1,6 @@
1
1
  module CirroIO
2
2
  module Client
3
3
  class GigInvitation < Base
4
- def self.resource_name
5
- 'gig-invitations'
6
- end
7
4
  end
8
5
  end
9
6
  end
@@ -0,0 +1,6 @@
1
+ module CirroIO
2
+ module Client
3
+ class GigTask < Base
4
+ end
5
+ end
6
+ end
@@ -3,7 +3,7 @@ module CirroIO
3
3
  module Client
4
4
  class ResponseDebuggingMiddleware < Faraday::Response::Middleware
5
5
  def on_complete(env)
6
- # binding.pry
6
+ binding.pry # rubocop:disable Lint/Debugger
7
7
  end
8
8
  end
9
9
  end
@@ -1,7 +1,7 @@
1
1
  # rubocop:disable Style/MutableConstant
2
2
  module CirroIO
3
3
  module Client
4
- VERSION = '1.0.1'
4
+ VERSION = '1.1.0'
5
5
  end
6
6
  end
7
7
  # rubocop:enable Style/MutableConstant
@@ -0,0 +1,6 @@
1
+ module CirroIO
2
+ module Client
3
+ class WorkerInvitationFilter < Base
4
+ end
5
+ end
6
+ 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: 1.0.1
4
+ version: 1.1.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-24 00:00:00.000000000 Z
11
+ date: 2020-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: faraday_middleware
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: Simple wrapper for Cirro API
42
56
  email:
43
57
  - OrgtestIODevelopers@epam.com
@@ -65,10 +79,13 @@ files:
65
79
  - lib/cirro_io/client/app_worker.rb
66
80
  - lib/cirro_io/client/base.rb
67
81
  - lib/cirro_io/client/configuration.rb
82
+ - lib/cirro_io/client/gig.rb
68
83
  - lib/cirro_io/client/gig_invitation.rb
84
+ - lib/cirro_io/client/gig_task.rb
69
85
  - lib/cirro_io/client/jwt_authentication.rb
70
86
  - lib/cirro_io/client/response_debugging_middleware.rb
71
87
  - lib/cirro_io/client/version.rb
88
+ - lib/cirro_io/client/worker_invitation_filter.rb
72
89
  homepage: https://cirro.io/api-docs/v1#cirro-api-documentation
73
90
  licenses:
74
91
  - MIT