dmx-storage 0.0.1.pre.alpha24 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -2
- data/.semaphore/rubygems.yml +5 -3
- data/Gemfile.lock +2 -2
- data/lib/storage.rb +5 -0
- data/lib/{dmxstorage → storage}/algolia/actions/all.rb +3 -3
- data/lib/{dmxstorage → storage}/algolia/actions/create.rb +3 -3
- data/lib/{dmxstorage → storage}/algolia/actions/delete.rb +4 -4
- data/lib/{dmxstorage → storage}/algolia/actions/get.rb +3 -3
- data/lib/{dmxstorage → storage}/algolia/actions/update.rb +4 -4
- data/lib/{dmxstorage → storage}/algolia/algolia.rb +7 -7
- data/lib/{dmxstorage → storage}/algolia/base.rb +3 -3
- data/lib/{dmxstorage → storage}/algolia/index/clear.rb +3 -3
- data/lib/storage/algolia/normalize_id.rb +26 -0
- data/lib/{dmxstorage → storage}/application_service.rb +0 -0
- data/lib/{dmxstorage → storage}/version.rb +1 -1
- data/{dmxstorage.gemspec → storage.gemspec} +3 -3
- metadata +18 -18
- data/lib/dmxstorage.rb +0 -12
- data/lib/dmxstorage/algolia/normalize_id.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aac14aa5f53e407f83c51642bf04e2d3146f29b31f335ae367f8a3b9e4ee1ddb
|
4
|
+
data.tar.gz: '095b5d94a0810e065af53235a84ece2ec4561befdff8d3453c2334475e32e64c'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2837d913b830cd6581584cb3816ba88ecde0d5c23b8e3a3f21b988bbe4989ac9f0e0033c648d76867f587269cb76568a17f64bc1ec7fd0ae7b3e6b779ab9930
|
7
|
+
data.tar.gz: bad55c4e5ef10d1ee01c92a559e5f908b4ac3a5b07756a89f340cd93f738eb096195f97df549636c1dd6bdfe23a02b2403e3334b61bf40332e9a6aff71399eb9
|
data/.gitignore
CHANGED
data/.semaphore/rubygems.yml
CHANGED
@@ -16,6 +16,7 @@ blocks:
|
|
16
16
|
- |
|
17
17
|
echo -e "---\r\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
|
18
18
|
- chmod 0600 ~/.gem/credentials
|
19
|
+
- gem owner storage --add ben@dee.mx
|
19
20
|
- sem-version ruby 2.6.1
|
20
21
|
- checkout
|
21
22
|
- cache restore
|
@@ -24,8 +25,9 @@ blocks:
|
|
24
25
|
- name: 'Build and deploy'
|
25
26
|
commands:
|
26
27
|
- export GEM_VERSION=0.0.1.pre.alpha$SEMAPHORE_WORKFLOW_NUMBER
|
27
|
-
- export GEM_NAME=
|
28
|
+
- export GEM_NAME=storage-$GEM_VERSION
|
28
29
|
- cat ~/.gem/credentials
|
29
|
-
- gem build
|
30
|
-
-
|
30
|
+
- gem build storage.gemspec
|
31
|
+
- echo $GEM_NAME
|
32
|
+
# - gem push "storage-$GEM_VERSION.gem"
|
31
33
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
|
4
|
+
storage (0.1.0)
|
5
5
|
activesupport (~> 6.0.0)
|
6
6
|
algoliasearch (~> 1.27.1)
|
7
7
|
dotenv (~> 2.7.5)
|
@@ -65,9 +65,9 @@ PLATFORMS
|
|
65
65
|
DEPENDENCIES
|
66
66
|
bundler (~> 2.0)
|
67
67
|
byebug (~> 11.0.1)
|
68
|
-
dmx-storage!
|
69
68
|
rake (~> 10.0)
|
70
69
|
rspec (~> 3.0)
|
70
|
+
storage!
|
71
71
|
webmock (~> 3.7.6)
|
72
72
|
|
73
73
|
BUNDLED WITH
|
data/lib/storage.rb
ADDED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require './lib/
|
3
|
+
require './lib/storage/algolia/base'
|
4
4
|
|
5
|
-
module
|
5
|
+
module Storage
|
6
6
|
module Algolia
|
7
7
|
module Actions
|
8
|
-
class All < ::
|
8
|
+
class All < ::Storage::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/storage/algolia/base'
|
4
4
|
|
5
|
-
module
|
5
|
+
module Storage
|
6
6
|
module Algolia
|
7
7
|
module Actions
|
8
|
-
class Create < ::
|
8
|
+
class Create < ::Storage::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/storage/algolia/base'
|
4
4
|
|
5
|
-
module
|
5
|
+
module Storage
|
6
6
|
module Algolia
|
7
7
|
module Actions
|
8
|
-
class Delete < ::
|
8
|
+
class Delete < ::Storage::Algolia::Base
|
9
9
|
MAX_RETRIES = 3
|
10
10
|
|
11
11
|
attr_reader :model_name, :id, :retries
|
@@ -23,7 +23,7 @@ module DmxStorage
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def original_object
|
26
|
-
@original_object ||= ::
|
26
|
+
@original_object ||= ::Storage::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/storage/algolia/base'
|
4
4
|
|
5
|
-
module
|
5
|
+
module Storage
|
6
6
|
module Algolia
|
7
7
|
module Actions
|
8
|
-
class Get < ::
|
8
|
+
class Get < ::Storage::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/storage/algolia/base'
|
4
4
|
|
5
|
-
module
|
5
|
+
module Storage
|
6
6
|
module Algolia
|
7
7
|
module Actions
|
8
|
-
class Update < ::
|
8
|
+
class Update < ::Storage::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 DmxStorage
|
|
30
30
|
private
|
31
31
|
|
32
32
|
def original_object
|
33
|
-
@original_object ||= ::
|
33
|
+
@original_object ||= ::Storage::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 Storage
|
4
4
|
module Algolia
|
5
5
|
def self.all(model_name:, cursor: nil)
|
6
|
-
::
|
6
|
+
::Storage::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
|
+
::Storage::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
|
+
::Storage::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
|
+
::Storage::Algolia::Actions::Update.process(
|
28
28
|
model_name: model_name,
|
29
29
|
params: params,
|
30
30
|
id: id
|
@@ -32,14 +32,14 @@ module DmxStorage
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def self.delete(model_name:, id:)
|
35
|
-
::
|
35
|
+
::Storage::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
|
+
::Storage::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/storage/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 Storage
|
12
12
|
module Algolia
|
13
13
|
class Base < ::ApplicationService
|
14
14
|
private
|
@@ -24,7 +24,7 @@ module DmxStorage
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def normalize(data)
|
27
|
-
::
|
27
|
+
::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/storage/algolia/base'
|
4
4
|
|
5
|
-
module
|
5
|
+
module Storage
|
6
6
|
module Algolia
|
7
7
|
module Index
|
8
|
-
class Clear < ::
|
8
|
+
class Clear < ::Storage::Algolia::Base
|
9
9
|
attr_reader :model_name
|
10
10
|
|
11
11
|
def initialize(model_name:)
|
@@ -0,0 +1,26 @@
|
|
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
|
File without changes
|
@@ -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 "storage/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'] || Storage::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.}
|
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
|
4
|
+
version: 0.0.1
|
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-28 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
|
+
- lib/storage.rb
|
160
|
+
- lib/storage/algolia/actions/all.rb
|
161
|
+
- lib/storage/algolia/actions/create.rb
|
162
|
+
- lib/storage/algolia/actions/delete.rb
|
163
|
+
- lib/storage/algolia/actions/get.rb
|
164
|
+
- lib/storage/algolia/actions/update.rb
|
165
|
+
- lib/storage/algolia/algolia.rb
|
166
|
+
- lib/storage/algolia/base.rb
|
167
|
+
- lib/storage/algolia/index/clear.rb
|
168
|
+
- lib/storage/algolia/normalize_id.rb
|
169
|
+
- lib/storage/application_service.rb
|
170
|
+
- lib/storage/version.rb
|
171
|
+
- storage.gemspec
|
172
172
|
homepage: http://github.com
|
173
173
|
licenses:
|
174
174
|
- MIT
|
@@ -188,11 +188,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
188
188
|
version: '0'
|
189
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
190
|
requirements:
|
191
|
-
- - "
|
191
|
+
- - ">="
|
192
192
|
- !ruby/object:Gem::Version
|
193
|
-
version:
|
193
|
+
version: '0'
|
194
194
|
requirements: []
|
195
|
-
rubygems_version: 3.0.
|
195
|
+
rubygems_version: 3.0.6
|
196
196
|
signing_key:
|
197
197
|
specification_version: 4
|
198
198
|
summary: Write a short summary, because RubyGems requires one.
|
data/lib/dmxstorage.rb
DELETED
@@ -1,28 +0,0 @@
|
|
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
|