dmx-storage 0.0.1.pre.alpha21 → 0.0.1.pre.alpha24
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/.semaphore/rubygems.yml +1 -1
- data/{storage.gemspec → dmxstorage.gemspec} +3 -3
- data/lib/dmxstorage.rb +12 -0
- data/lib/{storage → dmxstorage}/algolia/actions/all.rb +3 -3
- data/lib/{storage → dmxstorage}/algolia/actions/create.rb +3 -3
- data/lib/{storage → dmxstorage}/algolia/actions/delete.rb +4 -4
- data/lib/{storage → dmxstorage}/algolia/actions/get.rb +3 -3
- data/lib/{storage → dmxstorage}/algolia/actions/update.rb +4 -4
- data/lib/{storage → dmxstorage}/algolia/algolia.rb +7 -7
- data/lib/{storage → dmxstorage}/algolia/base.rb +3 -3
- data/lib/{storage → dmxstorage}/algolia/index/clear.rb +3 -3
- data/lib/dmxstorage/algolia/normalize_id.rb +28 -0
- data/lib/{storage → dmxstorage}/application_service.rb +0 -0
- data/lib/{storage → dmxstorage}/version.rb +1 -1
- metadata +15 -15
- data/lib/storage.rb +0 -5
- data/lib/storage/algolia/normalize_id.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61d7c38d2844073e61e0a9fd8e583f694696ddf92606b9fff5174f7fe9ad95bd
|
4
|
+
data.tar.gz: 987558fb64b93ef57c072042d324e268d658b4751bb656105ed8efb362d0d55d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc3ff903589cb09c83e8c17518c7d0173b9b1fc85ba163aba5ef18360bc0de0c6abef428cef4a761cc8b4fa8b8ec9bde6950dce03da8ba027f4f6b71b299bb8a
|
7
|
+
data.tar.gz: 549c78785a6343650eb94c8c021e585be48404523a8d96ce8c5e1b1f4e96d53db1b1f7aa1915722df1f75f8c1142863373d849c02f8d3c5f50ab5699e2918b64
|
data/.semaphore/rubygems.yml
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
lib = File.expand_path(
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require "
|
3
|
+
require "dmxstorage/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'dmx-storage'
|
7
|
-
spec.version = ENV['GEM_VERSION'] ||
|
7
|
+
spec.version = ENV['GEM_VERSION'] || ::DmxStorage::VERSION
|
8
8
|
spec.authors = ["CCTV"]
|
9
9
|
spec.email = ["ben@dee.mx"]
|
10
10
|
spec.summary = %q{Write a short summary, because RubyGems requires one.}
|
data/lib/dmxstorage.rb
ADDED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require './lib/
|
3
|
+
require './lib/dmxstorage/algolia/base'
|
4
4
|
|
5
|
-
module
|
5
|
+
module DmxStorage
|
6
6
|
module Algolia
|
7
7
|
module Actions
|
8
|
-
class All < ::
|
8
|
+
class All < ::DmxStorage::Algolia::Base
|
9
9
|
attr_reader :model_name, :cursor
|
10
10
|
|
11
11
|
def initialize(model_name:, cursor: nil)
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require './lib/
|
3
|
+
require './lib/dmxstorage/algolia/base'
|
4
4
|
|
5
|
-
module
|
5
|
+
module DmxStorage
|
6
6
|
module Algolia
|
7
7
|
module Actions
|
8
|
-
class Create < ::
|
8
|
+
class Create < ::DmxStorage::Algolia::Base
|
9
9
|
attr_reader :model_name, :params
|
10
10
|
|
11
11
|
def initialize(model_name:, params:)
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require './lib/
|
3
|
+
require './lib/dmxstorage/algolia/base'
|
4
4
|
|
5
|
-
module
|
5
|
+
module DmxStorage
|
6
6
|
module Algolia
|
7
7
|
module Actions
|
8
|
-
class Delete < ::
|
8
|
+
class Delete < ::DmxStorage::Algolia::Base
|
9
9
|
MAX_RETRIES = 3
|
10
10
|
|
11
11
|
attr_reader :model_name, :id, :retries
|
@@ -23,7 +23,7 @@ module Storage
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def original_object
|
26
|
-
@original_object ||= ::
|
26
|
+
@original_object ||= ::DmxStorage::Algolia::Actions::Get.process(
|
27
27
|
model_name: model_name,
|
28
28
|
id: id
|
29
29
|
)
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require './lib/
|
3
|
+
require './lib/dmxstorage/algolia/base'
|
4
4
|
|
5
|
-
module
|
5
|
+
module DmxStorage
|
6
6
|
module Algolia
|
7
7
|
module Actions
|
8
|
-
class Get < ::
|
8
|
+
class Get < ::DmxStorage::Algolia::Base
|
9
9
|
MAX_RETRIES = 3
|
10
10
|
|
11
11
|
attr_reader :model_name, :id, :retries
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require './lib/
|
3
|
+
require './lib/dmxstorage/algolia/base'
|
4
4
|
|
5
|
-
module
|
5
|
+
module DmxStorage
|
6
6
|
module Algolia
|
7
7
|
module Actions
|
8
|
-
class Update < ::
|
8
|
+
class Update < ::DmxStorage::Algolia::Base
|
9
9
|
attr_reader :model_name, :params, :id, :retries
|
10
10
|
|
11
11
|
def initialize(model_name:, params:, id:)
|
@@ -30,7 +30,7 @@ module Storage
|
|
30
30
|
private
|
31
31
|
|
32
32
|
def original_object
|
33
|
-
@original_object ||= ::
|
33
|
+
@original_object ||= ::DmxStorage::Algolia::Actions::Get.process(
|
34
34
|
model_name: model_name,
|
35
35
|
id: id
|
36
36
|
)
|
@@ -1,30 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module DmxStorage
|
4
4
|
module Algolia
|
5
5
|
def self.all(model_name:, cursor: nil)
|
6
|
-
::
|
6
|
+
::DmxStorage::Algolia::Actions::All.new(
|
7
7
|
model_name: model_name,
|
8
8
|
cursor: cursor
|
9
9
|
)
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.get(model_name:, id:)
|
13
|
-
::
|
13
|
+
::DmxStorage::Algolia::Actions::Get.process(
|
14
14
|
model_name: model_name,
|
15
15
|
id: id
|
16
16
|
)
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.create(model_name:, params:)
|
20
|
-
::
|
20
|
+
::DmxStorage::Algolia::Actions::Create.process(
|
21
21
|
model_name: model_name,
|
22
22
|
params: params
|
23
23
|
)
|
24
24
|
end
|
25
25
|
|
26
26
|
def self.update(model_name:, params:, id:)
|
27
|
-
::
|
27
|
+
::DmxStorage::Algolia::Actions::Update.process(
|
28
28
|
model_name: model_name,
|
29
29
|
params: params,
|
30
30
|
id: id
|
@@ -32,14 +32,14 @@ module Storage
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def self.delete(model_name:, id:)
|
35
|
-
::
|
35
|
+
::DmxStorage::Algolia::Actions::Delete.process(
|
36
36
|
model_name: model_name,
|
37
37
|
id: id
|
38
38
|
)
|
39
39
|
end
|
40
40
|
|
41
41
|
def self.clear(model_name:)
|
42
|
-
::
|
42
|
+
::DmxStorage::Algolia::Index::Clear.process(
|
43
43
|
model_name: model_name
|
44
44
|
)
|
45
45
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require './lib/
|
3
|
+
require './lib/dmxstorage/application_service'
|
4
4
|
require 'algoliasearch'
|
5
5
|
require 'hashugar'
|
6
6
|
require 'active_support/core_ext/hash/except'
|
@@ -8,7 +8,7 @@ require 'active_support/core_ext/hash/keys'
|
|
8
8
|
require 'dotenv/load'
|
9
9
|
::Dotenv.load
|
10
10
|
|
11
|
-
module
|
11
|
+
module DmxStorage
|
12
12
|
module Algolia
|
13
13
|
class Base < ::ApplicationService
|
14
14
|
private
|
@@ -24,7 +24,7 @@ module Storage
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def normalize(data)
|
27
|
-
::Algolia::NormalizeId.process(data)
|
27
|
+
::DmxStorage::Algolia::NormalizeId.process(data)
|
28
28
|
end
|
29
29
|
|
30
30
|
def params
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require './lib/
|
3
|
+
require './lib/dmxstorage/algolia/base'
|
4
4
|
|
5
|
-
module
|
5
|
+
module DmxStorage
|
6
6
|
module Algolia
|
7
7
|
module Index
|
8
|
-
class Clear < ::
|
8
|
+
class Clear < ::DmxStorage::Algolia::Base
|
9
9
|
attr_reader :model_name
|
10
10
|
|
11
11
|
def initialize(model_name:)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require './lib/dmxstorage/application_service'
|
4
|
+
|
5
|
+
module DmxStorage
|
6
|
+
module Algolia
|
7
|
+
class NormalizeId < ::ApplicationService
|
8
|
+
attr_reader :data
|
9
|
+
|
10
|
+
def initialize(data)
|
11
|
+
@data = data
|
12
|
+
end
|
13
|
+
|
14
|
+
def process
|
15
|
+
data.kind_of?(Array) ?
|
16
|
+
data.map { |node| objectid_to_id(node) }.to_hashugar :
|
17
|
+
objectid_to_id(data)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def objectid_to_id(node)
|
23
|
+
node[:id] = node.delete(:objectID)
|
24
|
+
node.to_hashugar
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dmx-storage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.pre.
|
4
|
+
version: 0.0.1.pre.alpha24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CCTV
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashugar
|
@@ -156,19 +156,19 @@ files:
|
|
156
156
|
- Rakefile
|
157
157
|
- bin/console
|
158
158
|
- bin/setup
|
159
|
-
-
|
160
|
-
- lib/
|
161
|
-
- lib/
|
162
|
-
- lib/
|
163
|
-
- lib/
|
164
|
-
- lib/
|
165
|
-
- lib/
|
166
|
-
- lib/
|
167
|
-
- lib/
|
168
|
-
- lib/
|
169
|
-
- lib/
|
170
|
-
- lib/
|
171
|
-
-
|
159
|
+
- dmxstorage.gemspec
|
160
|
+
- lib/dmxstorage.rb
|
161
|
+
- lib/dmxstorage/algolia/actions/all.rb
|
162
|
+
- lib/dmxstorage/algolia/actions/create.rb
|
163
|
+
- lib/dmxstorage/algolia/actions/delete.rb
|
164
|
+
- lib/dmxstorage/algolia/actions/get.rb
|
165
|
+
- lib/dmxstorage/algolia/actions/update.rb
|
166
|
+
- lib/dmxstorage/algolia/algolia.rb
|
167
|
+
- lib/dmxstorage/algolia/base.rb
|
168
|
+
- lib/dmxstorage/algolia/index/clear.rb
|
169
|
+
- lib/dmxstorage/algolia/normalize_id.rb
|
170
|
+
- lib/dmxstorage/application_service.rb
|
171
|
+
- lib/dmxstorage/version.rb
|
172
172
|
homepage: http://github.com
|
173
173
|
licenses:
|
174
174
|
- MIT
|
data/lib/storage.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require './lib/storage/application_service'
|
4
|
-
|
5
|
-
module Algolia
|
6
|
-
class NormalizeId < ::ApplicationService
|
7
|
-
attr_reader :data
|
8
|
-
|
9
|
-
def initialize(data)
|
10
|
-
@data = data
|
11
|
-
end
|
12
|
-
|
13
|
-
def process
|
14
|
-
data.kind_of?(Array) ?
|
15
|
-
data.map { |node| objectid_to_id(node) }.to_hashugar :
|
16
|
-
objectid_to_id(data)
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def objectid_to_id(node)
|
22
|
-
node[:id] = node.delete(:objectID)
|
23
|
-
node.to_hashugar
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|