c80_shared 0.1.13 → 0.1.14
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbd50ef3777c29cb4f39f60dc814e27f661b777b4e27dd57d97a95da3acce58e
|
4
|
+
data.tar.gz: de9300ef9898852e3a258524d2130f6b1a66566f067dc978655f1334949d3c32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3bef6c9c366e52f070edcda193259acf2e13ac20116ff61e281bf94460daacdc4b9800f9568d744a7a489e918f760c2f864d65cb011d723fd07522940c5a3ec
|
7
|
+
data.tar.gz: 976d69f14a5c41b467011e59a04b0c408e4d3b8979624cd7e687e3837154811b18b5d63fd86170a58f53b711c6d2ab62103c61bc021dce1f33c08e55e4d1d33e
|
@@ -1,4 +1,5 @@
|
|
1
1
|
class BoatSerializer < AbstractSerializer
|
2
|
+
extend SanitizeUrl
|
2
3
|
|
3
4
|
class << self
|
4
5
|
def available_attributes
|
@@ -34,6 +35,9 @@ class BoatSerializer < AbstractSerializer
|
|
34
35
|
picture_medium_url
|
35
36
|
name
|
36
37
|
builder
|
38
|
+
naval_architect
|
39
|
+
interior_designer
|
40
|
+
name_builder
|
37
41
|
short_description
|
38
42
|
per_season
|
39
43
|
price
|
@@ -48,6 +52,10 @@ class BoatSerializer < AbstractSerializer
|
|
48
52
|
latitude
|
49
53
|
longitude
|
50
54
|
boat_type_id
|
55
|
+
boat_type
|
56
|
+
boat_hull_id
|
57
|
+
motor
|
58
|
+
hull_material
|
51
59
|
boat_length_metrics
|
52
60
|
boat_length_metrics_meters
|
53
61
|
boat_length_metrics_ft
|
@@ -60,6 +68,7 @@ class BoatSerializer < AbstractSerializer
|
|
60
68
|
state
|
61
69
|
boat_contacts
|
62
70
|
boat_photos
|
71
|
+
main_boat_photo_id
|
63
72
|
].freeze
|
64
73
|
end
|
65
74
|
|
@@ -83,7 +92,7 @@ class BoatSerializer < AbstractSerializer
|
|
83
92
|
# noinspection RubyResolve
|
84
93
|
def picture_medium_url(boat)
|
85
94
|
url = if boat.boat_photo.present?
|
86
|
-
boat.boat_photo.picture.url(:medium)
|
95
|
+
san boat.boat_photo.picture.url(:medium)
|
87
96
|
else
|
88
97
|
''
|
89
98
|
end
|
@@ -91,12 +100,45 @@ class BoatSerializer < AbstractSerializer
|
|
91
100
|
{ picture_medium_url: url }
|
92
101
|
end
|
93
102
|
|
103
|
+
def main_boat_photo_id(boat)
|
104
|
+
{ main_boat_photo_id: boat.boat_photo.id }
|
105
|
+
end
|
106
|
+
|
94
107
|
def name(boat)
|
95
108
|
{ name: boat.name }
|
96
109
|
end
|
97
110
|
|
98
111
|
def builder(boat)
|
99
|
-
{ builder: boat.builder }
|
112
|
+
{ builder: boat.builder&.strip }
|
113
|
+
end
|
114
|
+
|
115
|
+
def motor(boat)
|
116
|
+
{ motor: boat.motor }
|
117
|
+
end
|
118
|
+
|
119
|
+
def hull_material(boat)
|
120
|
+
{ hull_material: boat.hull_material }
|
121
|
+
end
|
122
|
+
|
123
|
+
def naval_architect(boat)
|
124
|
+
{ naval_architect: boat.naval_architect }
|
125
|
+
end
|
126
|
+
|
127
|
+
def interior_designer(boat)
|
128
|
+
{ interior_designer: boat.interior_designer }
|
129
|
+
end
|
130
|
+
|
131
|
+
# example: Carpe Diem by Lazzara
|
132
|
+
# example: Ismail
|
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 * ' ' }
|
100
142
|
end
|
101
143
|
|
102
144
|
def short_description(boat)
|
@@ -177,6 +219,19 @@ class BoatSerializer < AbstractSerializer
|
|
177
219
|
{ boat_type_id: boat.boat_type_id }
|
178
220
|
end
|
179
221
|
|
222
|
+
def boat_hull_id(boat)
|
223
|
+
{ boat_hull_id: boat.boat_hull_id }
|
224
|
+
end
|
225
|
+
|
226
|
+
def boat_type(boat)
|
227
|
+
{
|
228
|
+
boat_type: {
|
229
|
+
id: boat.boat_type_id,
|
230
|
+
title: boat.boat_type&.name&.strip
|
231
|
+
}
|
232
|
+
}
|
233
|
+
end
|
234
|
+
|
180
235
|
def boat_length_metrics(boat)
|
181
236
|
value = ::Lib::Boats::Dimensions.boatlength(boat, @opts[:uom])
|
182
237
|
{ boat_length_metrics: value }
|
@@ -338,9 +393,10 @@ class BoatSerializer < AbstractSerializer
|
|
338
393
|
def boat_photos(boat)
|
339
394
|
boat_photos = boat.boat_photos.map do |boat_photo|
|
340
395
|
{
|
341
|
-
|
342
|
-
|
343
|
-
|
396
|
+
id: boat_photo.id,
|
397
|
+
gallery_path: san(boat_photo.picture.url(:gallery)),
|
398
|
+
medium_path: san(boat_photo.picture.url(:medium)),
|
399
|
+
thumb_path: san(boat_photo.picture.url(:thumb))
|
344
400
|
}
|
345
401
|
end
|
346
402
|
{ boat_photos: boat_photos }
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Configs
|
2
|
+
module Boats
|
3
|
+
class BoatPrices
|
4
|
+
# список ценовых (продажа/аренда) атрибутов Лодки
|
5
|
+
def self.attributes(price_attributes = ::Dictionaries::BoatCharterAttribute::ALL)
|
6
|
+
attributes = []
|
7
|
+
::Dicts::Currency.all.each do |currency|
|
8
|
+
price_attributes.map do |attr|
|
9
|
+
field = Currency.attribute_name currency.index, attr
|
10
|
+
next unless field
|
11
|
+
attributes << field.to_sym
|
12
|
+
end
|
13
|
+
field = Currency.attribute_name currency.index, :sale_price
|
14
|
+
attributes << field.to_sym
|
15
|
+
end
|
16
|
+
if block_given?
|
17
|
+
attributes.each do |attribute|
|
18
|
+
yield attribute
|
19
|
+
end
|
20
|
+
else
|
21
|
+
attributes
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
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.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- C80609A
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- app/helpers/site/time_helper.rb
|
61
61
|
- app/serializers/boat_serializer.rb
|
62
62
|
- app/serializers/boat_visit_day_serializer.rb
|
63
|
+
- app/serializers/configs/boats/boat_prices.rb
|
63
64
|
- app/serializers/configs/boats/central_agent/boat_list.rb
|
64
65
|
- app/serializers/configs/lease/central_agent/inquiry_list.rb
|
65
66
|
- app/serializers/lease/bid_serializer.rb
|
@@ -83,6 +84,7 @@ files:
|
|
83
84
|
- lib/c80_shared/engine.rb
|
84
85
|
- lib/c80_shared/geo/distance.rb
|
85
86
|
- lib/c80_shared/middleware/images_proxy.rb
|
87
|
+
- lib/c80_shared/string/sanitize_url.rb
|
86
88
|
- lib/c80_shared/token_generator.rb
|
87
89
|
- lib/c80_shared/version.rb
|
88
90
|
homepage: http://google.com
|