c80_shared 0.1.53 → 0.1.54

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: c34615c25251680c3ffbeec7308ebc828b2779e8b48195481a38e42a4f428470
4
- data.tar.gz: 8cfb9a50eeeff2bc726e0221de7ec7a9ee6d2e631e42b2f0369f09f52ec3c4ea
3
+ metadata.gz: 43282acbf906a1ff70e0477cb6a7c62cedf83eb651fb91533eac15d0ac92605f
4
+ data.tar.gz: 70f016a3a61a94e095567c147425ddf836298ec58d4dd208209dda8de5b99516
5
5
  SHA512:
6
- metadata.gz: 202523ae0c3adfc009828c10695054fa9db8b7ea9e68c7322aacb2bfd23388d0189413c3ec45fa15bb8f4667a06d4864e8c3c3b5cecdba236a41e4ac8d7f5633
7
- data.tar.gz: 32c677d6a29534daae6a3f25fb5f324660c9108b1e6ddc3c9ff6e31f0dab76b5f8e52fcc4c8b74687c46e73fc142584e67ee969668425dc6da43eeaa394dc948
6
+ metadata.gz: 22eb8c0e71cbc24f44068e8e2b6272f6d2056ac73ae346d68832ee78101f4aa99ff537c56c0e5b3b566d4ed4164bfd650c0051878cd48c35934f153fc6b481a6
7
+ data.tar.gz: f4b0514f669d4632d1887ead136614423a4c7067112ba9f84d39798afc3bb0ad88c3774e42c2ca7e946f4454ed091e9ddda2251f78ffd998db871532254d0c26
@@ -0,0 +1,9 @@
1
+ module Dicts
2
+ class FuelType < ::Dict
3
+ DIESEL = new 1, 'diesel'
4
+ PETROL = new 2, 'petrol'
5
+ ELECTRIC = new 3, 'electric'
6
+ HYBRYD = new 4, 'hybryd'
7
+ OTHER = new 5, 'other'
8
+ end
9
+ end
@@ -3,20 +3,26 @@ class BoatSerializer < AbstractSerializer
3
3
  class << self
4
4
  def available_attributes
5
5
  %i[
6
+ amenities
6
7
  boat_beam
7
8
  boat_beam_metrics
8
9
  boat_contacts
10
+ boat_cruise_speed
9
11
  boat_draft
10
12
  boat_draft_metrics
13
+ boat_engines
11
14
  boat_hull_id
15
+ boat_generators
12
16
  boat_length
13
17
  boat_length_metrics
14
18
  boat_length_metrics_ft
15
19
  boat_length_metrics_meters
16
20
  boat_locations_attributes
21
+ boat_max_speed
17
22
  boat_model
18
23
  boat_photos
19
24
  boat_photos_attributes
25
+ boat_range
20
26
  boat_type
21
27
  boat_type_id
22
28
  builder
@@ -25,10 +31,12 @@ class BoatSerializer < AbstractSerializer
25
31
  crew_total
26
32
  crew_cabins
27
33
  description
34
+ engine_hours
28
35
  exterior_color
29
36
  equipment
30
37
  for_rent
31
38
  for_sale
39
+ fuel_type
32
40
  guest_cabins
33
41
  guest_heads
34
42
  guest_sleeps
@@ -52,6 +60,7 @@ class BoatSerializer < AbstractSerializer
52
60
  refit_year
53
61
  rent_prices
54
62
  rental_type
63
+ safety
55
64
  sale_price
56
65
  short_description
57
66
  state
@@ -80,7 +89,8 @@ class BoatSerializer < AbstractSerializer
80
89
  # определяем "простые" методы
81
90
  %i[id comments tender name description built_year boat_model boat_type_id boat_hull_id refit_year
82
91
  crew_cabins crew_total guest_heads guest_sleeps maximum_guests_during_cruise interior_designer
83
- naval_architect guests_total guest_cabins state visits_today visits_total].each do |f|
92
+ naval_architect guests_total guest_cabins state visits_today visits_total
93
+ boat_cruise_speed boat_max_speed boat_range boat_engines boat_generators engine_hours].each do |f|
84
94
  define_method f do |boat|
85
95
  { f => boat.send(f) }
86
96
  end
@@ -138,7 +148,49 @@ class BoatSerializer < AbstractSerializer
138
148
  tv
139
149
  vhf
140
150
  wi_fi
141
- ]
151
+ ].freeze
152
+ end
153
+
154
+ def amenities_attributes
155
+ %i[
156
+ air_conditioner
157
+ bow_thruster
158
+ electric_toilet
159
+ essentials
160
+ family_kid_friendly
161
+ gym
162
+ hardtop
163
+ heating
164
+ helipad
165
+ hot_cold_cockpit_shower
166
+ jacuzzi_on_deck
167
+ kitchen
168
+ pet_allowed
169
+ sauna
170
+ soft_top
171
+ stabilisers_underway
172
+ stabilizers_at_anchor
173
+ steam_room
174
+ toilet
175
+ ].freeze
176
+ end
177
+
178
+ def safety_attributes
179
+ %i[
180
+ carbon_detector
181
+ epirb
182
+ fire_extinguisher
183
+ first_aid_kit
184
+ flares
185
+ horn
186
+ lifebuoy
187
+ life_jackets
188
+ personal_flotation_devices
189
+ raft
190
+ smoke_detector
191
+ vessel_lighting
192
+ visual_distress_signals
193
+ ].freeze
142
194
  end
143
195
 
144
196
  def equipment(boat)
@@ -149,6 +201,22 @@ class BoatSerializer < AbstractSerializer
149
201
  }
150
202
  end
151
203
 
204
+ def amenities(boat)
205
+ {
206
+ amenities: amenities_attributes.map do |f|
207
+ [f, boat.send(f)]
208
+ end.to_h
209
+ }
210
+ end
211
+
212
+ def safety(boat)
213
+ {
214
+ safety: safety_attributes.map do |f|
215
+ [f, boat.send(f)]
216
+ end.to_h
217
+ }
218
+ end
219
+
152
220
  # noinspection RubyResolve
153
221
  def picture_medium_url(boat)
154
222
  url = if boat.boat_photo.present?
@@ -249,6 +317,12 @@ class BoatSerializer < AbstractSerializer
249
317
  }
250
318
  end
251
319
 
320
+ def fuel_type(boat)
321
+ {
322
+ fuel_type: boat.fuel_type
323
+ }
324
+ end
325
+
252
326
  def boat_type(boat)
253
327
  {
254
328
  boat_type: {
@@ -0,0 +1,8 @@
1
+ en:
2
+ dicts:
3
+ fuel_type:
4
+ diesel: Diesel
5
+ petrol: Petrol
6
+ electric: Electric
7
+ hybryd: Hybrid
8
+ other: Other
@@ -0,0 +1,8 @@
1
+ ru:
2
+ dicts:
3
+ fuel_type:
4
+ diesel: Дизель
5
+ petrol: Бензин
6
+ electric: Электричество
7
+ hybryd: Гибрид
8
+ other: Другое
@@ -1,3 +1,3 @@
1
1
  module C80Shared
2
- VERSION = "0.1.53"
2
+ VERSION = "0.1.54"
3
3
  end
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.53
4
+ version: 0.1.54
5
5
  platform: ruby
6
6
  authors:
7
7
  - C80609A
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-27 00:00:00.000000000 Z
11
+ date: 2019-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,6 +58,7 @@ files:
58
58
  - app/dicts/currency.rb
59
59
  - app/dicts/email_token_subj.rb
60
60
  - app/dicts/exterior_color.rb
61
+ - app/dicts/fuel_type.rb
61
62
  - app/dicts/hull_material.rb
62
63
  - app/dicts/length.rb
63
64
  - app/dicts/locale.rb
@@ -100,6 +101,8 @@ files:
100
101
  - config/locales/dicts/charter_category/ru.yml
101
102
  - config/locales/dicts/exterior_color/en.yml
102
103
  - config/locales/dicts/exterior_color/ru.yml
104
+ - config/locales/dicts/fuel_type/en.yml
105
+ - config/locales/dicts/fuel_type/ru.yml
103
106
  - config/locales/dicts/hull_material/en.yml
104
107
  - config/locales/dicts/hull_material/ru.yml
105
108
  - config/locales/dicts/length/en.yml