agilibox 1.0.14 → 1.0.15
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/CHANGELOG.md +7 -0
- data/app/controllers/concerns/agilibox/api_controller_concern.rb +7 -5
- data/app/filters/agilibox/small_data/filter_strategy_by_time_period.rb +5 -3
- data/app/libs/agilibox/initialize_with.rb +20 -0
- data/app/services/agilibox/service.rb +11 -0
- data/app/sms/agilibox/sms/strategies/amazon_sns.rb +3 -3
- data/features/support/env.rb +1 -1
- data/lib/agilibox/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ed08a7d086225ae4abf9cac6f5f7a2e4e9250f0
|
4
|
+
data.tar.gz: c2c2fb53c41d945c973f0938f2809209090b02f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca24f0844a6aca0e1abcac9db9d11a1620dc132034afa8aa8c737eb90b177f169cf1dfaef242e286bc7d1890f433ef23f257787d1bc2e232081ad82c288c57f5
|
7
|
+
data.tar.gz: 1bc57502c9ba25e4645ba42135967b258df0be8a30ff3f2f4460399056fcffdd0774a41b7d2cb46b993ade48b8d21f832b617122de0e2e81dcb45e8038c21f63
|
data/CHANGELOG.md
CHANGED
@@ -12,16 +12,18 @@ module Agilibox::ApiControllerConcern
|
|
12
12
|
render options.merge(json: json)
|
13
13
|
end
|
14
14
|
|
15
|
-
def render_json_error(
|
16
|
-
if
|
17
|
-
|
15
|
+
def render_json_error(any_object, options = {})
|
16
|
+
if any_object.is_a?(ActiveRecord::Base)
|
17
|
+
json = {error: any_object.errors.full_messages.join(", ")}
|
18
|
+
elsif any_object.is_a?(String)
|
19
|
+
json = {error: any_object}
|
18
20
|
else
|
19
|
-
|
21
|
+
json = any_object
|
20
22
|
end
|
21
23
|
|
22
24
|
options[:status] ||= :unprocessable_entity
|
23
25
|
|
24
|
-
render_json(
|
26
|
+
render_json(json, options)
|
25
27
|
end
|
26
28
|
|
27
29
|
def render_not_found
|
@@ -1,5 +1,7 @@
|
|
1
1
|
class Agilibox::SmallData::FilterStrategyByTimePeriod < ::Agilibox::SmallData::FilterStrategyByKeyValue
|
2
2
|
def apply(query, value) # rubocop:disable Metrics/MethodLength
|
3
|
+
value = value.to_s
|
4
|
+
|
3
5
|
if value == "today"
|
4
6
|
a = Time.zone.now.beginning_of_day
|
5
7
|
b = Time.zone.now.end_of_day
|
@@ -28,10 +30,10 @@ class Agilibox::SmallData::FilterStrategyByTimePeriod < ::Agilibox::SmallData::F
|
|
28
30
|
return query
|
29
31
|
end
|
30
32
|
|
31
|
-
|
33
|
+
column = key.is_a?(Symbol) ? "#{query.model.table_name}.#{key}" : key.to_s
|
32
34
|
|
33
35
|
query
|
34
|
-
.where("#{
|
35
|
-
.where("#{
|
36
|
+
.where("DATE(#{column}) >= ?", a.to_date)
|
37
|
+
.where("DATE(#{column}) <= ?", b.to_date)
|
36
38
|
end
|
37
39
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Agilibox::InitializeWith
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
class_methods do
|
5
|
+
def initialize_with(*attrs)
|
6
|
+
attr_reader(*attrs)
|
7
|
+
|
8
|
+
define_method(:initialize) do |*args|
|
9
|
+
if attrs.length != args.length
|
10
|
+
message = "wrong number of arguments (given #{args.length}, expected #{attrs.length})"
|
11
|
+
raise ArgumentError, message
|
12
|
+
end
|
13
|
+
|
14
|
+
attrs.length.times do |i|
|
15
|
+
instance_variable_set("@#{attrs[i]}", args[i])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end # class_methods
|
20
|
+
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
class Agilibox::SMS::Strategies::AmazonSNS < Agilibox::SMS::Strategies::Base
|
2
2
|
class << self
|
3
|
-
attr_writer :
|
3
|
+
attr_writer :sns_region
|
4
4
|
|
5
5
|
def sns_region
|
6
6
|
@sns_region ||= (ENV["SNS_REGION"] || ENV["AWS_REGION"])
|
7
7
|
end
|
8
8
|
|
9
|
-
attr_writer :
|
9
|
+
attr_writer :sns_access_key_id
|
10
10
|
|
11
11
|
def sns_access_key_id
|
12
12
|
@sns_access_key_id ||= (ENV["SNS_ACCESS_KEY_ID"] || ENV["AWS_ACCESS_KEY_ID"])
|
13
13
|
end
|
14
14
|
|
15
|
-
attr_writer :
|
15
|
+
attr_writer :sns_secret_access_key
|
16
16
|
|
17
17
|
def sns_secret_access_key
|
18
18
|
@sns_secret_access_key ||= (ENV["SNS_SECRET_ACCESS_KEY"] || ENV["AWS_SECRET_ACCESS_KEY"])
|
data/features/support/env.rb
CHANGED
data/lib/agilibox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agilibox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- agilidée
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails-i18n
|
@@ -102,6 +102,7 @@ files:
|
|
102
102
|
- app/helpers/agilibox/sorting_helper.rb
|
103
103
|
- app/helpers/agilibox/text_helper.rb
|
104
104
|
- app/helpers/h.rb
|
105
|
+
- app/libs/agilibox/initialize_with.rb
|
105
106
|
- app/libs/agilibox/mini_model_serializer/serialize.rb
|
106
107
|
- app/libs/agilibox/mini_model_serializer/serializer.rb
|
107
108
|
- app/libs/agilibox/phone_number_sanitizer.rb
|
@@ -117,6 +118,7 @@ files:
|
|
117
118
|
- app/serializers/agilibox/serializers.rb
|
118
119
|
- app/serializers/agilibox/serializers/base.rb
|
119
120
|
- app/serializers/agilibox/serializers/xlsx.rb
|
121
|
+
- app/services/agilibox/service.rb
|
120
122
|
- app/sms/agilibox/sms.rb
|
121
123
|
- app/sms/agilibox/sms/application_sms.rb
|
122
124
|
- app/sms/agilibox/sms/strategies/amazon_sns.rb
|