cirro-ruby-client 0.1.0 → 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: 4ea70fa9d545f31516901d80aff2be0abcda7e83742198a071284e9b6a136cdd
4
- data.tar.gz: 3fd08e55caabca812918f9cceb89b5c7964bf26d5dac6c5527f24c04c2a5ea31
3
+ metadata.gz: f6a519fabbdd1bfa16f4f088ec3d7dc648c6aceb74931e420ed1488619735cac
4
+ data.tar.gz: c08439cdaddb6444a2aba457dc93d68a997647a1472c6b39493461eddceb0402
5
5
  SHA512:
6
- metadata.gz: 657d9cfbdb497d2e7ebdc69def84f8386d3c45698eec3cee89ff3d6803b69977acdc18eb036dd5ab03ecf2adde8ee0acc90f49dc4bad6f1a81bc2c2c7f0d9d90
7
- data.tar.gz: ad81c2558830f5477384b3cefa212d73df8df7be32c5ec488b8e45fc6acf936ead7f5bd6abbb6891e77feff0712e82fc719b8cb150bc0c8831054bd661a86046
6
+ metadata.gz: e82c0ff26229b5178e05e471a2fb746ac1de0cf5e531b1dcb0e77dfed39ba5b9205f1bdeaa91d221fe64617c578f473745896ee005f062ff7b947e83352b27af
7
+ data.tar.gz: 131bf1dc4a613de2c26ffaf3328ca1631e4a5b9f672274975ef69e1c767a035a9e33130cb2ccd834de4154c68762c25d3c763d53a655e6a866f6c395b33e8628
@@ -0,0 +1,70 @@
1
+ version: 2.1
2
+
3
+ jobs:
4
+ build:
5
+ docker:
6
+ - image: circleci/ruby:2.7.1-node
7
+ environment:
8
+ - RAILS_ENV=test
9
+ - RACK_ENV=test
10
+ steps:
11
+ - checkout
12
+ - restore_cache:
13
+ keys:
14
+ - bundle-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
15
+ - run:
16
+ name: Install gems
17
+ command: bundle install --path ~/.cache/bundle
18
+ - save_cache:
19
+ key: bundle-{{.Branch}}-{{ checksum "Gemfile.lock" }}
20
+ paths:
21
+ - ~/.cache/bundle
22
+ - run:
23
+ name: Run tests
24
+ command: bundle exec rspec
25
+ - run:
26
+ name: Check code style
27
+ command: bundle exec rubocop
28
+ deploy:
29
+ docker:
30
+ - image: circleci/ruby:2.7.1-node
31
+ steps:
32
+ - checkout
33
+ - run:
34
+ name: Tag the version
35
+ command: |
36
+ git fetch --tags
37
+ version=$(cat lib/cirro_io/client/version.rb | grep VERSION | awk -F' = ' '{print $2}' | xargs)
38
+ if git rev-parse v"$version" >/dev/null 2>&1; then
39
+ echo "This version already exists. Please update the version";
40
+ exit 1
41
+ else
42
+ git tag v"$version"
43
+ git push origin v"$version"
44
+ fi
45
+ - run:
46
+ name: build gem
47
+ command: gem build cirro-ruby-client.gemspec
48
+ - run:
49
+ name: push to rubygems
50
+ command: |
51
+ version=$(cat lib/cirro_io/client/version.rb | grep VERSION | awk -F' = ' '{print $2}' | xargs)
52
+ echo "gem `gem --version`"
53
+ mkdir ~/.gem
54
+ cat .circleci/gem_credentials | sed -e "s/__RUBYGEMS_API_KEY__/${RUBYGEMS_API_KEY}/" > ~/.gem/credentials
55
+ chmod 0600 ~/.gem/credentials
56
+ gem push cirro-ruby-client-$version.gem
57
+ shred -u ~/.gem/credentials
58
+
59
+ workflows:
60
+ version: 2
61
+ deploy_the_gem:
62
+ jobs:
63
+ - build
64
+ - deploy:
65
+ requires:
66
+ - build
67
+ filters:
68
+ branches:
69
+ only:
70
+ - master
@@ -0,0 +1,2 @@
1
+ ---
2
+ :rubygems_api_key: __RUBYGEMS_API_KEY__
@@ -0,0 +1,118 @@
1
+ require:
2
+ - rubocop-rspec
3
+ # Explanations of all possible options:
4
+ # https://github.com/bbatsov/rubocop/blob/master/config/default.yml
5
+ AllCops:
6
+ DisplayCopNames: true
7
+ DisplayStyleGuide: true
8
+ Exclude:
9
+ - 'pkg/**/*'
10
+ - 'vendor/**/*'
11
+ - 'spec/fixtures/**/*'
12
+
13
+ Metrics/MethodLength:
14
+ Max: 25
15
+
16
+ Layout/LineLength:
17
+ Max: 160
18
+
19
+ # Details:
20
+ # http://c2.com/cgi/wiki?AbcMetric
21
+ Metrics/AbcSize:
22
+ # The ABC size is a calculated magnitude, so this number can be a Fixnum or
23
+ # a Float.
24
+ Max: 20
25
+
26
+ Style/StringLiterals:
27
+ EnforcedStyle: single_quotes
28
+
29
+ Style/HashSyntax:
30
+ EnforcedStyle: ruby19
31
+
32
+ Style/NumericLiterals:
33
+ Enabled: false
34
+
35
+ Style/SignalException:
36
+ EnforcedStyle: only_raise
37
+
38
+ Metrics/ClassLength:
39
+ Max: 120
40
+
41
+ # TODO: enable this when Ruby 3.0 is out.
42
+ Style/FrozenStringLiteralComment:
43
+ Enabled: false
44
+
45
+ Layout/FirstArrayElementIndentation:
46
+ EnforcedStyle: consistent
47
+
48
+ Style/NumericPredicate:
49
+ Enabled: false
50
+
51
+ Naming/VariableNumber:
52
+ Enabled: false
53
+
54
+ Style/SafeNavigation:
55
+ Enabled: false
56
+
57
+ Metrics/BlockLength:
58
+ CountComments: false
59
+ Max: 25
60
+ Exclude:
61
+ - 'Rakefile'
62
+ - '**/*.rake'
63
+ - 'spec/**/*.rb'
64
+
65
+ Layout/HeredocIndentation:
66
+ Enabled: false
67
+
68
+ Gemspec/OrderedDependencies:
69
+ Enabled: false
70
+
71
+ Style/FormatStringToken:
72
+ Enabled: false
73
+
74
+ Naming/MethodParameterName:
75
+ Enabled: false
76
+
77
+ Gemspec/RequiredRubyVersion:
78
+ Enabled: false
79
+
80
+ Style/TrailingCommaInArguments:
81
+ EnforcedStyleForMultiline: comma
82
+
83
+ Style/TrailingCommaInArrayLiteral:
84
+ EnforcedStyleForMultiline: comma
85
+
86
+ Style/TrailingCommaInHashLiteral:
87
+ EnforcedStyleForMultiline: comma
88
+
89
+ Naming/RescuedExceptionsVariableName:
90
+ Enabled: false
91
+
92
+ Lint/RaiseException:
93
+ Enabled: true
94
+
95
+ Lint/StructNewOverride:
96
+ Enabled: true
97
+
98
+ Style/HashEachMethods:
99
+ Enabled: true
100
+
101
+ Style/HashTransformKeys:
102
+ Enabled: true
103
+
104
+ Style/HashTransformValues:
105
+ Enabled: true
106
+
107
+ RSpec/FilePath:
108
+ Enabled: true
109
+ IgnoreMethods: true
110
+
111
+ Style/Documentation:
112
+ Enabled: false
113
+
114
+ RSpec/ExampleLength:
115
+ Enabled: false
116
+
117
+ RSpec/MultipleExpectations:
118
+ Enabled: false
data/Gemfile CHANGED
@@ -1,7 +1,15 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in cirro-ruby-client.gemspec
4
4
  gemspec
5
5
 
6
- gem "rake", "~> 12.0"
7
- gem "rspec", "~> 3.0"
6
+ gem 'rake', '~> 12.0'
7
+ gem 'rspec', '~> 3.0'
8
+
9
+ group :development do
10
+ gem 'faker'
11
+ gem 'pry'
12
+ gem 'rubocop', require: false
13
+ gem 'rubocop-rspec'
14
+ gem 'webmock'
15
+ end
@@ -1,13 +1,61 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cirro-ruby-client (0.1.0)
4
+ cirro-ruby-client (1.1.0)
5
+ faraday_middleware
6
+ json_api_client
7
+ jwt
5
8
 
6
9
  GEM
7
10
  remote: https://rubygems.org/
8
11
  specs:
12
+ activemodel (6.0.3.3)
13
+ activesupport (= 6.0.3.3)
14
+ activesupport (6.0.3.3)
15
+ concurrent-ruby (~> 1.0, >= 1.0.2)
16
+ i18n (>= 0.7, < 2)
17
+ minitest (~> 5.1)
18
+ tzinfo (~> 1.1)
19
+ zeitwerk (~> 2.2, >= 2.2.2)
20
+ addressable (2.7.0)
21
+ public_suffix (>= 2.0.2, < 5.0)
22
+ ast (2.4.1)
23
+ coderay (1.1.3)
24
+ concurrent-ruby (1.1.7)
25
+ crack (0.4.4)
9
26
  diff-lcs (1.4.4)
27
+ faker (2.14.0)
28
+ i18n (>= 1.6, < 2)
29
+ faraday (1.0.1)
30
+ multipart-post (>= 1.2, < 3)
31
+ faraday_middleware (1.0.0)
32
+ faraday (~> 1.0)
33
+ hashdiff (1.0.1)
34
+ i18n (1.8.5)
35
+ concurrent-ruby (~> 1.0)
36
+ json_api_client (1.17.1)
37
+ activemodel (>= 3.2.0)
38
+ activesupport (>= 3.2.0)
39
+ addressable (~> 2.2)
40
+ faraday (>= 0.15.2, < 1.2.0)
41
+ faraday_middleware (>= 0.9.0, < 1.2.0)
42
+ rack (>= 0.2)
43
+ jwt (2.2.2)
44
+ method_source (1.0.0)
45
+ minitest (5.14.2)
46
+ multipart-post (2.1.1)
47
+ parallel (1.19.2)
48
+ parser (2.7.2.0)
49
+ ast (~> 2.4.1)
50
+ pry (0.13.1)
51
+ coderay (~> 1.1)
52
+ method_source (~> 1.0)
53
+ public_suffix (4.0.6)
54
+ rack (2.2.3)
55
+ rainbow (3.0.0)
10
56
  rake (12.3.3)
57
+ regexp_parser (1.8.1)
58
+ rexml (3.2.4)
11
59
  rspec (3.9.0)
12
60
  rspec-core (~> 3.9.0)
13
61
  rspec-expectations (~> 3.9.0)
@@ -21,14 +69,42 @@ GEM
21
69
  diff-lcs (>= 1.2.0, < 2.0)
22
70
  rspec-support (~> 3.9.0)
23
71
  rspec-support (3.9.3)
72
+ rubocop (0.92.0)
73
+ parallel (~> 1.10)
74
+ parser (>= 2.7.1.5)
75
+ rainbow (>= 2.2.2, < 4.0)
76
+ regexp_parser (>= 1.7)
77
+ rexml
78
+ rubocop-ast (>= 0.5.0)
79
+ ruby-progressbar (~> 1.7)
80
+ unicode-display_width (>= 1.4.0, < 2.0)
81
+ rubocop-ast (0.7.1)
82
+ parser (>= 2.7.1.5)
83
+ rubocop-rspec (1.43.2)
84
+ rubocop (~> 0.87)
85
+ ruby-progressbar (1.10.1)
86
+ thread_safe (0.3.6)
87
+ tzinfo (1.2.7)
88
+ thread_safe (~> 0.1)
89
+ unicode-display_width (1.7.0)
90
+ webmock (3.9.1)
91
+ addressable (>= 2.3.6)
92
+ crack (>= 0.3.2)
93
+ hashdiff (>= 0.4.0, < 2.0.0)
94
+ zeitwerk (2.4.0)
24
95
 
25
96
  PLATFORMS
26
97
  ruby
27
98
 
28
99
  DEPENDENCIES
29
100
  cirro-ruby-client!
101
+ faker
102
+ pry
30
103
  rake (~> 12.0)
31
104
  rspec (~> 3.0)
105
+ rubocop
106
+ rubocop-rspec
107
+ webmock
32
108
 
33
109
  BUNDLED WITH
34
110
  2.1.4
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Cirro::Ruby::Client
1
+ # CirroIO::Client
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/cirro/ruby/client`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ This gem provides access to the [Cirro REST API](https://staging.cirro.io/api-docs/v1#cirro-api-documentation).
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
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
6
 
7
7
  ## Installation
8
8
 
@@ -20,25 +20,26 @@ Or install it yourself as:
20
20
 
21
21
  $ gem install cirro-ruby-client
22
22
 
23
- ## Usage
24
23
 
25
- TODO: Write usage instructions here
24
+ ## Configuration
26
25
 
27
- ## Development
26
+ You need to create an initializer file in config/initializers.
28
27
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
28
+ ```ruby
29
+ CirroIO::Client.configure do |c|
30
+ c.app_id 'WULnc6Y0rlaTBCSiHAb0kGWKFuIxPWBXJysyZeG3Rtw'
31
+ c.private_key_path './storage/cirro.pem'
32
+ c.site 'https://api.staging.cirro.io'
33
+ end
34
+ ```
30
35
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
36
 
33
- ## Contributing
37
+ ## Development
34
38
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/cirro-ruby-client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/cirro-ruby-client/blob/master/CODE_OF_CONDUCT.md).
39
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
36
40
 
41
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
37
42
 
38
43
  ## License
39
44
 
40
45
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
41
-
42
- ## Code of Conduct
43
-
44
- Everyone interacting in the Cirro::Ruby::Client project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/cirro-ruby-client/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "cirro_i_o/client"
3
+ require 'bundler/setup'
4
+ require 'cirro_io/client'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "cirro_i_o/client"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start(__FILE__)
@@ -1,27 +1,31 @@
1
- require_relative 'lib/cirro_i_o/client/version'
1
+ require_relative 'lib/cirro_io/client/version'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
- spec.name = "cirro-ruby-client"
4
+ spec.name = 'cirro-ruby-client'
5
5
  spec.version = CirroIO::Client::VERSION
6
- spec.authors = ["Cirro Dev Team"]
7
- spec.email = ["OrgtestIODevelopers@epam.com"]
6
+ spec.authors = ['Cirro Dev Team']
7
+ spec.email = ['OrgtestIODevelopers@epam.com']
8
8
 
9
- spec.summary = "Ruby client library for Cirro API"
10
- spec.description = "Simple wrapper for Cirro API"
11
- spec.homepage = "https://cirro.io/api-docs/v1#cirro-api-documentation"
12
- spec.license = "MIT"
13
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
9
+ spec.summary = 'Ruby client library for Cirro API'
10
+ spec.description = 'Simple wrapper for Cirro API'
11
+ spec.homepage = 'https://cirro.io/api-docs/v1#cirro-api-documentation'
12
+ spec.license = 'MIT'
13
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
14
14
 
15
- spec.metadata["homepage_uri"] = spec.homepage
16
- spec.metadata["source_code_uri"] = "https://github.com/test-IO/cirro-ruby-client"
17
- spec.metadata["changelog_uri"] = "https://github.com/test-IO/cirro-ruby-client/CHANGELOG.md"
15
+ spec.metadata['homepage_uri'] = spec.homepage
16
+ spec.metadata['source_code_uri'] = 'https://github.com/test-IO/cirro-ruby-client'
17
+ spec.metadata['changelog_uri'] = 'https://github.com/test-IO/cirro-ruby-client/CHANGELOG.md'
18
18
 
19
19
  # Specify which files should be added to the gem when it is released.
20
20
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
21
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
22
22
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
23
  end
24
- spec.bindir = "exe"
24
+ spec.bindir = 'exe'
25
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
- spec.require_paths = ["lib"]
26
+ spec.require_paths = ['lib']
27
+
28
+ spec.add_runtime_dependency 'jwt'
29
+ spec.add_runtime_dependency 'json_api_client'
30
+ spec.add_runtime_dependency 'faraday_middleware'
27
31
  end
@@ -0,0 +1,27 @@
1
+ require 'json_api_client'
2
+ require 'cirro_io/client/version'
3
+ require 'cirro_io/client/configuration'
4
+ require 'cirro_io/client/response_debugging_middleware'
5
+ require 'cirro_io/client/jwt_authentication'
6
+ require 'cirro_io/client/base'
7
+ require 'cirro_io/client/gig_invitation'
8
+ require 'cirro_io/client/app_user'
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'
13
+
14
+ module CirroIO
15
+ module Client
16
+ class Error < StandardError; end
17
+
18
+ def self.configure
19
+ yield configuration if block_given?
20
+ Base.site = "#{configuration.site}/#{configuration.api_version}"
21
+ end
22
+
23
+ def self.configuration
24
+ @configuration ||= Configuration.new
25
+ end
26
+ end
27
+ end
@@ -1,5 +1,6 @@
1
1
  module CirroIO
2
2
  module Client
3
- VERSION = "0.1.0"
3
+ class AppUser < Base
4
+ end
4
5
  end
5
6
  end
@@ -0,0 +1,8 @@
1
+ module CirroIO
2
+ module Client
3
+ class AppWorker < Base
4
+ has_one :app_user
5
+ has_many :gig_invitations
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,33 @@
1
+ module CirroIO
2
+ module Client
3
+ class Base < JsonApiClient::Resource
4
+ self.route_format = :dasherized_route
5
+ self.json_key_format = :dasherized_key
6
+
7
+ # https://github.com/JsonApiClient/json_api_client/issues/215
8
+ def self.site=(url)
9
+ super(url)
10
+ connection.faraday.url_prefix = url
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
25
+ end
26
+ end
27
+ end
28
+
29
+ CirroIO::Client::Base.connection do |connection|
30
+ connection.use CirroIO::Client::JwtAuthentication
31
+ connection.use Faraday::Response::Logger
32
+ # connection.use CirroIO::Client::ResponseDebuggingMiddleware # This middleware can be injected during debugging or while adding new specs
33
+ end
@@ -0,0 +1,30 @@
1
+ module CirroIO
2
+ module Client
3
+ class Configuration
4
+ def app_id(value = nil)
5
+ @app_id = value unless value.nil?
6
+ raise 'app_id must be defined' unless defined?(@app_id)
7
+
8
+ @app_id
9
+ end
10
+
11
+ def private_key_path(value = nil)
12
+ @private_key_path = value unless value.nil?
13
+ raise 'private_key_path must be defined' unless defined?(@private_key_path)
14
+
15
+ @private_key_path
16
+ end
17
+
18
+ def site(value = nil)
19
+ @site = value unless value.nil?
20
+ raise 'site must be defined' unless defined?(@site)
21
+
22
+ @site
23
+ end
24
+
25
+ def api_version
26
+ 'v1'
27
+ end
28
+ end
29
+ end
30
+ 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
@@ -0,0 +1,6 @@
1
+ module CirroIO
2
+ module Client
3
+ class GigInvitation < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module CirroIO
2
+ module Client
3
+ class GigTask < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,25 @@
1
+ require 'jwt'
2
+ require 'openssl'
3
+
4
+ module CirroIO
5
+ module Client
6
+ class JwtAuthentication < Faraday::Middleware
7
+ def call(env)
8
+ private_pem = File.read(CirroIO::Client.configuration.private_key_path)
9
+ private_key = OpenSSL::PKey::RSA.new(private_pem)
10
+
11
+ payload = {
12
+ # JWT expiration time (10 minute maximum)
13
+ exp: Time.now.to_i + (10 * 60),
14
+ # App client id
15
+ iss: CirroIO::Client.configuration.app_id,
16
+ }
17
+
18
+ token = JWT.encode(payload, private_key, 'RS256')
19
+
20
+ env[:request_headers]['Authorization'] = "Bearer #{token}"
21
+ @app.call(env)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,10 @@
1
+ # This middleware can be injected during debugging or while adding new specs
2
+ module CirroIO
3
+ module Client
4
+ class ResponseDebuggingMiddleware < Faraday::Response::Middleware
5
+ def on_complete(env)
6
+ binding.pry # rubocop:disable Lint/Debugger
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ # rubocop:disable Style/MutableConstant
2
+ module CirroIO
3
+ module Client
4
+ VERSION = '1.1.0'
5
+ end
6
+ end
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,15 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cirro-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
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-10-07 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2020-11-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jwt
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json_api_client
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
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'
13
55
  description: Simple wrapper for Cirro API
14
56
  email:
15
57
  - OrgtestIODevelopers@epam.com
@@ -17,8 +59,11 @@ executables: []
17
59
  extensions: []
18
60
  extra_rdoc_files: []
19
61
  files:
62
+ - ".circleci/config.yml"
63
+ - ".circleci/gem_credentials"
20
64
  - ".gitignore"
21
65
  - ".rspec"
66
+ - ".rubocop.yml"
22
67
  - ".travis.yml"
23
68
  - CODE_OF_CONDUCT.md
24
69
  - Gemfile
@@ -29,8 +74,18 @@ files:
29
74
  - bin/console
30
75
  - bin/setup
31
76
  - cirro-ruby-client.gemspec
32
- - lib/cirro_i_o/client.rb
33
- - lib/cirro_i_o/client/version.rb
77
+ - lib/cirro_io/client.rb
78
+ - lib/cirro_io/client/app_user.rb
79
+ - lib/cirro_io/client/app_worker.rb
80
+ - lib/cirro_io/client/base.rb
81
+ - lib/cirro_io/client/configuration.rb
82
+ - lib/cirro_io/client/gig.rb
83
+ - lib/cirro_io/client/gig_invitation.rb
84
+ - lib/cirro_io/client/gig_task.rb
85
+ - lib/cirro_io/client/jwt_authentication.rb
86
+ - lib/cirro_io/client/response_debugging_middleware.rb
87
+ - lib/cirro_io/client/version.rb
88
+ - lib/cirro_io/client/worker_invitation_filter.rb
34
89
  homepage: https://cirro.io/api-docs/v1#cirro-api-documentation
35
90
  licenses:
36
91
  - MIT
@@ -1,8 +0,0 @@
1
- require "cirro_i_o/client/version"
2
-
3
- module CirroIO
4
- module Client
5
- class Error < StandardError; end
6
- # Your code goes here...
7
- end
8
- end