cirro-ruby-client 1.2.0 → 1.2.1
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 +4 -4
- data/Gemfile +0 -2
- data/Gemfile.lock +12 -15
- data/cirro-ruby-client.gemspec +1 -0
- data/lib/cirro_io/base_association.rb +33 -0
- data/lib/cirro_io/client.rb +6 -0
- data/lib/cirro_io/client/version.rb +1 -1
- data/lib/cirro_io/has_one.rb +16 -0
- metadata +17 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae8201867c4e81773872690ee39df951dfb161d68cdf4ab10807a497a8e2744b
|
4
|
+
data.tar.gz: 59b06b8045b93026ddae29649542f54398ecc5c8fd5eb727608709153bcd57ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e664faa51a535dec4b7544c5bd43870e31dfa014d3f5e8665df7c20f4a6fa075529b226ae9835276105e229a86ab020cdfc005662bc5f972d587a43cba40515
|
7
|
+
data.tar.gz: f3263a656d9d2cc6500233dafdd40d47dee4727a3d1d1b4e9f464a4ecdc4e2c399b8a728360061b498f32dc77c30dfed40515560ce8b33ad01bdd6031b002861
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,20 +1,9 @@
|
|
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
|
-
|
13
1
|
PATH
|
14
2
|
remote: .
|
15
3
|
specs:
|
16
|
-
cirro-ruby-client (1.1
|
4
|
+
cirro-ruby-client (1.2.1)
|
17
5
|
faraday_middleware
|
6
|
+
json_api_client
|
18
7
|
jwt
|
19
8
|
|
20
9
|
GEM
|
@@ -37,13 +26,21 @@ GEM
|
|
37
26
|
diff-lcs (1.4.4)
|
38
27
|
faker (2.14.0)
|
39
28
|
i18n (>= 1.6, < 2)
|
40
|
-
faraday (1.0
|
29
|
+
faraday (1.1.0)
|
41
30
|
multipart-post (>= 1.2, < 3)
|
31
|
+
ruby2_keywords
|
42
32
|
faraday_middleware (1.0.0)
|
43
33
|
faraday (~> 1.0)
|
44
34
|
hashdiff (1.0.1)
|
45
35
|
i18n (1.8.5)
|
46
36
|
concurrent-ruby (~> 1.0)
|
37
|
+
json_api_client (1.17.1)
|
38
|
+
activemodel (>= 3.2.0)
|
39
|
+
activesupport (>= 3.2.0)
|
40
|
+
addressable (~> 2.2)
|
41
|
+
faraday (>= 0.15.2, < 1.2.0)
|
42
|
+
faraday_middleware (>= 0.9.0, < 1.2.0)
|
43
|
+
rack (>= 0.2)
|
47
44
|
jwt (2.2.2)
|
48
45
|
method_source (1.0.0)
|
49
46
|
minitest (5.14.2)
|
@@ -87,6 +84,7 @@ GEM
|
|
87
84
|
rubocop-rspec (1.43.2)
|
88
85
|
rubocop (~> 0.87)
|
89
86
|
ruby-progressbar (1.10.1)
|
87
|
+
ruby2_keywords (0.0.2)
|
90
88
|
thread_safe (0.3.6)
|
91
89
|
tzinfo (1.2.8)
|
92
90
|
thread_safe (~> 0.1)
|
@@ -103,7 +101,6 @@ PLATFORMS
|
|
103
101
|
DEPENDENCIES
|
104
102
|
cirro-ruby-client!
|
105
103
|
faker
|
106
|
-
json_api_client!
|
107
104
|
pry
|
108
105
|
rake (~> 12.0)
|
109
106
|
rspec (~> 3.0)
|
data/cirro-ruby-client.gemspec
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
module JsonApiClient
|
2
|
+
module Associations
|
3
|
+
class BaseAssociation
|
4
|
+
attr_reader :attr_name, :klass, :options
|
5
|
+
def initialize(attr_name, klass, options = {})
|
6
|
+
@attr_name = attr_name
|
7
|
+
@klass = klass
|
8
|
+
@options = options
|
9
|
+
end
|
10
|
+
|
11
|
+
def association_class
|
12
|
+
@association_class ||= Utils.compute_type(klass, options.fetch(:class_name) do
|
13
|
+
attr_name.to_s.classify
|
14
|
+
end)
|
15
|
+
end
|
16
|
+
|
17
|
+
def data(url)
|
18
|
+
from_result_set(association_class.requestor.linked(url))
|
19
|
+
end
|
20
|
+
|
21
|
+
def from_result_set(result_set)
|
22
|
+
result_set.to_a
|
23
|
+
end
|
24
|
+
|
25
|
+
def load_records(data)
|
26
|
+
data.map do |d|
|
27
|
+
record_class = Utils.compute_type(klass, klass.key_formatter.unformat(d['type']).classify)
|
28
|
+
record_class.load id: d['id']
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/cirro_io/client.rb
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
require 'json_api_client'
|
2
|
+
|
3
|
+
# temporary monkey patch code to fix gem bug
|
4
|
+
require 'cirro_io/has_one'
|
5
|
+
require 'cirro_io/base_association'
|
6
|
+
# temporary monkey patch code to fix gem bug
|
7
|
+
|
2
8
|
require 'cirro_io/client/version'
|
3
9
|
require 'cirro_io/client/configuration'
|
4
10
|
require 'cirro_io/client/response_debugging_middleware'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module JsonApiClient
|
2
|
+
module Associations
|
3
|
+
module HasOne
|
4
|
+
class Association < BaseAssociation
|
5
|
+
def from_result_set(result_set)
|
6
|
+
result_set.first
|
7
|
+
end
|
8
|
+
|
9
|
+
def load_records(data)
|
10
|
+
record_class = Utils.compute_type(klass, klass.key_formatter.unformat(data['type']).classify)
|
11
|
+
record_class.load id: data['id']
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cirro-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cirro Dev Team
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: json_api_client
|
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
|
@@ -60,6 +74,7 @@ files:
|
|
60
74
|
- bin/console
|
61
75
|
- bin/setup
|
62
76
|
- cirro-ruby-client.gemspec
|
77
|
+
- lib/cirro_io/base_association.rb
|
63
78
|
- lib/cirro_io/client.rb
|
64
79
|
- lib/cirro_io/client/app_user.rb
|
65
80
|
- lib/cirro_io/client/app_worker.rb
|
@@ -74,6 +89,7 @@ files:
|
|
74
89
|
- lib/cirro_io/client/response_debugging_middleware.rb
|
75
90
|
- lib/cirro_io/client/version.rb
|
76
91
|
- lib/cirro_io/client/worker_invitation_filter.rb
|
92
|
+
- lib/cirro_io/has_one.rb
|
77
93
|
homepage: https://cirro.io/api-docs/v1#cirro-api-documentation
|
78
94
|
licenses:
|
79
95
|
- MIT
|