transparent_data-rb 0.1.6 → 0.1.7
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.lock +1 -1
- data/lib/transparent_data.rb +2 -3
- data/lib/transparent_data/{module_functions.rb → actions.rb} +1 -1
- data/lib/transparent_data/request.rb +14 -12
- data/lib/transparent_data/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4a8f55fa7433e0e315d2bbb74b17105bdbb26f547e68cd3e4e869d81a98b836
|
4
|
+
data.tar.gz: 710a59a70647472ac85a443af84a6f5a1fd21b5e9d657a562625c2f5e9d82f14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a93674569fbb5dddd85e95635beff0fbda36e8a3ccd380f89d27eda11c6e368bbf7b4c9fed0fab7335565c806ed1da198310860522e10fda9cde47e81a48af3
|
7
|
+
data.tar.gz: f6390304fb55dcfb2bccfe77a2f979606b3bd60d9e2efea44da569e3967192b9761498164d403c63222d933f4fde4d0d769eb4d2272ab7eb61f571d3b59c4b1f
|
data/Gemfile.lock
CHANGED
data/lib/transparent_data.rb
CHANGED
@@ -4,12 +4,11 @@ require 'json'
|
|
4
4
|
require 'transparent_data/version'
|
5
5
|
require 'transparent_data/exceptions'
|
6
6
|
require 'transparent_data/configurable'
|
7
|
-
require 'transparent_data/
|
8
|
-
require 'transparent_data/module_functions'
|
7
|
+
require 'transparent_data/actions'
|
9
8
|
|
10
9
|
module TransparentData
|
11
10
|
extend TransparentData::Configurable
|
12
|
-
extend TransparentData::
|
11
|
+
extend TransparentData::Actions
|
13
12
|
|
14
13
|
initialize_config_accessors(:url, :user, :password, :key)
|
15
14
|
end
|
@@ -2,24 +2,26 @@ require 'transparent_data/response/struct'
|
|
2
2
|
|
3
3
|
module TransparentData
|
4
4
|
class Request
|
5
|
-
|
6
|
-
|
5
|
+
class << self
|
6
|
+
def call(client, method, query: {}, json: {})
|
7
|
+
response = client.post(build_path(method, query), json.to_json)
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
TransparentData::Response::Struct.new(response)
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
+
private
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
def build_path(method, query)
|
15
|
+
base_path = "/#{TransparentData.key}/#{method}"
|
15
16
|
|
16
|
-
|
17
|
+
return base_path unless query&.any?
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
base_path.concat("?#{convert_params_to_query(query)}")
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
22
|
+
def convert_params_to_query(params)
|
23
|
+
params.map { |pair| pair.join('=') }.join('&')
|
24
|
+
end
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transparent_data-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Kakorin
|
@@ -114,12 +114,12 @@ files:
|
|
114
114
|
- bin/console
|
115
115
|
- bin/setup
|
116
116
|
- lib/transparent_data.rb
|
117
|
+
- lib/transparent_data/actions.rb
|
117
118
|
- lib/transparent_data/actions/add.rb
|
118
119
|
- lib/transparent_data/actions/result.rb
|
119
120
|
- lib/transparent_data/actions/search.rb
|
120
121
|
- lib/transparent_data/configurable.rb
|
121
122
|
- lib/transparent_data/exceptions.rb
|
122
|
-
- lib/transparent_data/module_functions.rb
|
123
123
|
- lib/transparent_data/request.rb
|
124
124
|
- lib/transparent_data/response/struct.rb
|
125
125
|
- lib/transparent_data/version.rb
|