c80_shared 0.1.14 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -9
- data/app/serializers/boat_serializer.rb +106 -101
- data/app/serializers/configs/boats/boat_prices.rb +2 -1
- data/config/locales/boat/en.yml +4 -0
- data/config/locales/boat/ru.yml +4 -0
- data/lib/c80_shared/version.rb +1 -1
- metadata +5 -4
- data/lib/c80_shared/string/sanitize_url.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f84795cb065e618a232fb00682c7c86e72b75a711e95a0775a38efeef30760c0
|
4
|
+
data.tar.gz: 97291d1a16b348ac5282c0c4076c3fc1272eef290b421ed162eaf48ea4a6b66e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0854fbb3a527864d20de902e31271f89caeedfa4aa7abe76399b8f1b049a8a1a45587afbf3535fb2581eb050e6ce2cef26f0051e088d2092465f94a1fa5c7dcf'
|
7
|
+
data.tar.gz: 2c940900cb0c71603daa845b47ff8188be748c009ae6f3d41b064bae9690fb3cbaa4b5b2c3888b3f77079a66d32884c8237ec98b94ed65de133d7848b49b3252
|
data/.rubocop.yml
CHANGED
@@ -12,15 +12,9 @@ Metrics/LineLength:
|
|
12
12
|
Max: 120
|
13
13
|
Enabled: false
|
14
14
|
Metrics/MethodLength:
|
15
|
-
CountComments: false # count full line comments?
|
16
|
-
Max: 20
|
17
15
|
Enabled: false
|
18
16
|
Metrics/ModuleLength:
|
19
|
-
|
20
|
-
Max: 150
|
21
|
-
Metrics/ClassLength:
|
22
|
-
CountComments: false # count full line comments?
|
23
|
-
Max: 150
|
17
|
+
Enabled: false
|
24
18
|
Metrics/ParameterLists:
|
25
19
|
Max: 3
|
26
20
|
CountKeywordArgs: true
|
@@ -32,8 +26,6 @@ Layout/ExtraSpacing:
|
|
32
26
|
Enabled: false
|
33
27
|
Layout/CaseIndentation:
|
34
28
|
Enabled: false
|
35
|
-
Layout/TrailingWhitespase:
|
36
|
-
Enabled: false
|
37
29
|
Layout/SpaceAroundOperators:
|
38
30
|
Enabled: false
|
39
31
|
Style/FormatString:
|
@@ -50,3 +42,9 @@ Metrics/AbcSize:
|
|
50
42
|
Enabled: false
|
51
43
|
Style/Documentation:
|
52
44
|
Enabled: false
|
45
|
+
Layout/AlignHash:
|
46
|
+
Enabled: false
|
47
|
+
Metrics/ClassLength:
|
48
|
+
Enabled: false
|
49
|
+
Lint/Syntax:
|
50
|
+
Enabled: false
|
@@ -1,74 +1,73 @@
|
|
1
1
|
class BoatSerializer < AbstractSerializer
|
2
|
-
extend SanitizeUrl
|
3
2
|
|
4
3
|
class << self
|
5
4
|
def available_attributes
|
6
5
|
%i[
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
boat_beam_metrics
|
7
|
+
boat_beam_metrics_ft
|
8
|
+
boat_beam_metrics_meters
|
9
|
+
boat_contacts
|
10
|
+
boat_draft_metrics
|
11
|
+
boat_draft_metrics_ft
|
12
|
+
boat_draft_metrics_meters
|
13
|
+
boat_hull_id
|
14
|
+
boat_length_metrics
|
15
|
+
boat_length_metrics_ft
|
16
|
+
boat_length_metrics_meters
|
17
|
+
boat_model
|
18
|
+
boat_photos
|
19
|
+
boat_type
|
20
|
+
boat_type_id
|
21
|
+
builder
|
22
|
+
built_year
|
23
|
+
charter_1_day_high_eur
|
24
|
+
charter_1_day_high_rub
|
25
|
+
charter_1_day_high_usd
|
12
26
|
charter_1_day_low_eur
|
13
|
-
|
14
|
-
|
15
|
-
charter_1_week_low_eur
|
16
|
-
charter_1_month_low_usd
|
17
|
-
charter_1_month_low_rub
|
18
|
-
charter_1_month_low_eur
|
19
|
-
charter_1_hour_high_usd
|
20
|
-
charter_1_hour_high_rub
|
27
|
+
charter_1_day_low_rub
|
28
|
+
charter_1_day_low_usd
|
21
29
|
charter_1_hour_high_eur
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
charter_1_week_high_eur
|
28
|
-
charter_1_month_high_usd
|
29
|
-
charter_1_month_high_rub
|
30
|
+
charter_1_hour_high_rub
|
31
|
+
charter_1_hour_high_usd
|
32
|
+
charter_1_hour_low_eur
|
33
|
+
charter_1_hour_low_rub
|
34
|
+
charter_1_hour_low_usd
|
30
35
|
charter_1_month_high_eur
|
31
|
-
|
32
|
-
|
33
|
-
|
36
|
+
charter_1_month_high_rub
|
37
|
+
charter_1_month_high_usd
|
38
|
+
charter_1_month_low_eur
|
39
|
+
charter_1_month_low_rub
|
40
|
+
charter_1_month_low_usd
|
41
|
+
charter_1_week_high_eur
|
42
|
+
charter_1_week_high_rub
|
43
|
+
charter_1_week_high_usd
|
44
|
+
charter_1_week_low_eur
|
45
|
+
charter_1_week_low_rub
|
46
|
+
charter_1_week_low_usd
|
47
|
+
crew_total
|
48
|
+
guest_cabins
|
49
|
+
guests_total
|
50
|
+
hull_material
|
34
51
|
id
|
35
|
-
picture_medium_url
|
36
|
-
name
|
37
|
-
builder
|
38
|
-
naval_architect
|
39
52
|
interior_designer
|
53
|
+
latitude
|
54
|
+
location_address
|
55
|
+
longitude
|
56
|
+
main_boat_photo_id
|
57
|
+
motor
|
58
|
+
name
|
40
59
|
name_builder
|
41
|
-
|
60
|
+
naval_architect
|
42
61
|
per_season
|
62
|
+
picture_medium_url
|
43
63
|
price
|
44
64
|
price_discount
|
45
|
-
guests_total
|
46
|
-
guest_cabins
|
47
|
-
crew_total
|
48
|
-
built_year
|
49
65
|
refit_year
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
boat_type_id
|
55
|
-
boat_type
|
56
|
-
boat_hull_id
|
57
|
-
motor
|
58
|
-
hull_material
|
59
|
-
boat_length_metrics
|
60
|
-
boat_length_metrics_meters
|
61
|
-
boat_length_metrics_ft
|
62
|
-
boat_beam_metrics
|
63
|
-
boat_beam_metrics_ft
|
64
|
-
boat_beam_metrics_meters
|
65
|
-
boat_draft_metrics
|
66
|
-
boat_draft_metrics_ft
|
67
|
-
boat_draft_metrics_meters
|
66
|
+
sale_price_eur
|
67
|
+
sale_price_rub
|
68
|
+
sale_price_usd
|
69
|
+
short_description
|
68
70
|
state
|
69
|
-
boat_contacts
|
70
|
-
boat_photos
|
71
|
-
main_boat_photo_id
|
72
71
|
].freeze
|
73
72
|
end
|
74
73
|
|
@@ -89,10 +88,34 @@ class BoatSerializer < AbstractSerializer
|
|
89
88
|
{ id: boat.id }
|
90
89
|
end
|
91
90
|
|
91
|
+
def interior_designer(boat)
|
92
|
+
{ interior_designer: boat.interior_designer }
|
93
|
+
end
|
94
|
+
|
95
|
+
def naval_architect(boat)
|
96
|
+
{ naval_architect: boat.naval_architect }
|
97
|
+
end
|
98
|
+
|
99
|
+
# Для страницы просмотра лодки
|
100
|
+
#
|
101
|
+
# example: Carpe Diem by Lazzara
|
102
|
+
# example: Ismail
|
103
|
+
def name_builder(boat)
|
104
|
+
arr = []
|
105
|
+
arr << boat.name&.strip
|
106
|
+
if boat.builder.present?
|
107
|
+
arr << I18n.t('boat.builder.prefix')
|
108
|
+
arr << boat.builder.strip
|
109
|
+
end
|
110
|
+
|
111
|
+
{ name_builder: arr * ' ' }
|
112
|
+
end
|
113
|
+
|
114
|
+
|
92
115
|
# noinspection RubyResolve
|
93
116
|
def picture_medium_url(boat)
|
94
117
|
url = if boat.boat_photo.present?
|
95
|
-
|
118
|
+
boat.boat_photo.picture.url(:medium)
|
96
119
|
else
|
97
120
|
''
|
98
121
|
end
|
@@ -100,45 +123,24 @@ class BoatSerializer < AbstractSerializer
|
|
100
123
|
{ picture_medium_url: url }
|
101
124
|
end
|
102
125
|
|
103
|
-
def main_boat_photo_id(boat)
|
104
|
-
{ main_boat_photo_id: boat.boat_photo.id }
|
105
|
-
end
|
106
|
-
|
107
126
|
def name(boat)
|
108
127
|
{ name: boat.name }
|
109
128
|
end
|
110
129
|
|
111
|
-
def builder(boat)
|
112
|
-
{ builder: boat.builder&.strip }
|
113
|
-
end
|
114
|
-
|
115
130
|
def motor(boat)
|
116
131
|
{ motor: boat.motor }
|
117
132
|
end
|
118
133
|
|
119
|
-
def
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
def naval_architect(boat)
|
124
|
-
{ naval_architect: boat.naval_architect }
|
125
|
-
end
|
134
|
+
def main_boat_photo_id(boat)
|
135
|
+
boat_photo_id = if boat.boat_photo.present?
|
136
|
+
boat.boat_photo.id
|
137
|
+
end
|
126
138
|
|
127
|
-
|
128
|
-
{ interior_designer: boat.interior_designer }
|
139
|
+
{ main_boat_photo_id: boat_photo_id }
|
129
140
|
end
|
130
141
|
|
131
|
-
|
132
|
-
|
133
|
-
def name_builder(boat)
|
134
|
-
arr = []
|
135
|
-
arr << boat.name&.strip
|
136
|
-
if boat.builder.present?
|
137
|
-
arr << I18n.t('boat.builder.prefix')
|
138
|
-
arr << boat.builder.strip
|
139
|
-
end
|
140
|
-
|
141
|
-
{ name_builder: arr * ' ' }
|
142
|
+
def builder(boat)
|
143
|
+
{ builder: boat.builder&.strip }
|
142
144
|
end
|
143
145
|
|
144
146
|
def short_description(boat)
|
@@ -186,6 +188,10 @@ class BoatSerializer < AbstractSerializer
|
|
186
188
|
{ guest_cabins: boat.guest_cabins || '' }
|
187
189
|
end
|
188
190
|
|
191
|
+
def hull_material(boat)
|
192
|
+
{ hull_material: boat.hull_material }
|
193
|
+
end
|
194
|
+
|
189
195
|
def crew_total(boat)
|
190
196
|
{ crew_total: boat.crew_total || '' }
|
191
197
|
end
|
@@ -219,16 +225,12 @@ class BoatSerializer < AbstractSerializer
|
|
219
225
|
{ boat_type_id: boat.boat_type_id }
|
220
226
|
end
|
221
227
|
|
222
|
-
def boat_hull_id(boat)
|
223
|
-
{ boat_hull_id: boat.boat_hull_id }
|
224
|
-
end
|
225
|
-
|
226
228
|
def boat_type(boat)
|
227
|
-
{
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
229
|
+
{
|
230
|
+
boat_type: {
|
231
|
+
id: boat.boat_type_id,
|
232
|
+
title: boat.boat_type&.name&.strip
|
233
|
+
}
|
232
234
|
}
|
233
235
|
end
|
234
236
|
|
@@ -271,6 +273,10 @@ class BoatSerializer < AbstractSerializer
|
|
271
273
|
{ boat_draft_metrics_meters: boat.boat_draft_metrics_meters }
|
272
274
|
end
|
273
275
|
|
276
|
+
def boat_hull_id(boat)
|
277
|
+
{ boat_hull_id: boat.boat_hull_id }
|
278
|
+
end
|
279
|
+
|
274
280
|
|
275
281
|
# --[low]-----------------------------------------------------------------------------------------------------------
|
276
282
|
|
@@ -391,23 +397,22 @@ class BoatSerializer < AbstractSerializer
|
|
391
397
|
end
|
392
398
|
|
393
399
|
def boat_photos(boat)
|
400
|
+
# FIXME:: выяснить, нужно ли всётаки использовать .gsub('\'', ''') для строк с путями к фоткам?
|
394
401
|
boat_photos = boat.boat_photos.map do |boat_photo|
|
395
402
|
{
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
thumb_path: san(boat_photo.picture.url(:thumb))
|
403
|
+
gallery_path: boat_photo.picture.url(:gallery),
|
404
|
+
medium_path: boat_photo.picture.url(:medium),
|
405
|
+
thumb_path: boat_photo.picture.url(:thumb)
|
400
406
|
}
|
401
407
|
end
|
402
408
|
{ boat_photos: boat_photos }
|
403
409
|
end
|
404
410
|
|
411
|
+
# Контакты владельцев: то, что приходит в `boat_users_attributes` из админской формы
|
405
412
|
def boat_contacts(boat)
|
406
|
-
boat_contacts = boat.
|
413
|
+
boat_contacts = boat.boat_users.map do |user|
|
407
414
|
{
|
408
|
-
|
409
|
-
name: user.name,
|
410
|
-
email: user.email
|
415
|
+
user_id: user.user_id
|
411
416
|
}
|
412
417
|
end
|
413
418
|
{ boat_contacts: boat_contacts }
|
@@ -8,6 +8,7 @@ module Configs
|
|
8
8
|
price_attributes.map do |attr|
|
9
9
|
field = Currency.attribute_name currency.index, attr
|
10
10
|
next unless field
|
11
|
+
|
11
12
|
attributes << field.to_sym
|
12
13
|
end
|
13
14
|
field = Currency.attribute_name currency.index, :sale_price
|
@@ -23,4 +24,4 @@ module Configs
|
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
26
|
-
end
|
27
|
+
end
|
data/lib/c80_shared/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: c80_shared
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- C80609A
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -75,6 +75,8 @@ files:
|
|
75
75
|
- bin/rails
|
76
76
|
- bin/setup
|
77
77
|
- c80_shared.gemspec
|
78
|
+
- config/locales/boat/en.yml
|
79
|
+
- config/locales/boat/ru.yml
|
78
80
|
- config/locales/rent_skip_type/en.yml
|
79
81
|
- config/locales/rent_skip_type/ru.yml
|
80
82
|
- lib/c80_shared.rb
|
@@ -84,7 +86,6 @@ files:
|
|
84
86
|
- lib/c80_shared/engine.rb
|
85
87
|
- lib/c80_shared/geo/distance.rb
|
86
88
|
- lib/c80_shared/middleware/images_proxy.rb
|
87
|
-
- lib/c80_shared/string/sanitize_url.rb
|
88
89
|
- lib/c80_shared/token_generator.rb
|
89
90
|
- lib/c80_shared/version.rb
|
90
91
|
homepage: http://google.com
|
@@ -107,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
108
|
version: '0'
|
108
109
|
requirements: []
|
109
110
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.7.
|
111
|
+
rubygems_version: 2.7.8
|
111
112
|
signing_key:
|
112
113
|
specification_version: 4
|
113
114
|
summary: Write a short summary, because RubyGems requires one.
|