c80_shared 0.1.30 → 0.1.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/serializers/boat_serializer.rb +37 -4
- data/lib/c80_shared/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67ee8d9c2b4f04abc4ed5421e832edcdc9a03db966d6f43d70cea4305ced4ae6
|
4
|
+
data.tar.gz: b773639ed62b3d0c23c5c3ba0117c5b58ac32e12a9e86dac749205bf968549d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fdd80cf449a1ccbd7ba17e346032f28d392bdbdfa0bcdb919b49902963c9481d2a34c6f5f54f99bc4f1a35d44963b8152e3b80eddbee6c61273bfd5cc0f5e22
|
7
|
+
data.tar.gz: 13b08b0e82d619f40aafac1ffd536ae183903ae0ce007218673301591a10c5eeaa17d2f042e27d5a5b39aac47baa2132e6c7c3711cb7a8a7318fe9043ced3086
|
@@ -57,7 +57,9 @@ class BoatSerializer < AbstractSerializer
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def serialize(model, attributes: available_attributes, opts: {})
|
60
|
-
super(model, attributes: attributes, opts: default_opts.merge(opts))
|
60
|
+
result = super(model, attributes: attributes, opts: default_opts.merge(opts))
|
61
|
+
result[:opts] = serialize_opts
|
62
|
+
result
|
61
63
|
end
|
62
64
|
|
63
65
|
def id(boat)
|
@@ -259,17 +261,21 @@ class BoatSerializer < AbstractSerializer
|
|
259
261
|
|
260
262
|
def prices(boat)
|
261
263
|
currency_id = ::Dicts::Currency.find_by_index(@opts[:currency]).id
|
262
|
-
|
264
|
+
business = ::Dicts::Business.find_by_index @opts[:business]
|
265
|
+
|
266
|
+
prices = if business.index == ::Dicts::Business::RENT.index
|
263
267
|
boat.boat_prices.select { |bp| bp.currency_id == currency_id }.map { |bp| ::BoatPriceSerializer.serialize bp }
|
264
268
|
else
|
265
269
|
# noinspection RubyResolve
|
266
270
|
boat.boat_sale_prices.select { |bp| bp.currency_id == currency_id }.map { |bps| ::BoatSalePriceSerializer.serialize bps }
|
267
271
|
end
|
268
|
-
|
269
272
|
{
|
270
273
|
prices: {
|
271
274
|
list: prices,
|
272
|
-
business:
|
275
|
+
business: {
|
276
|
+
index: business.index,
|
277
|
+
id: business.id
|
278
|
+
}
|
273
279
|
}
|
274
280
|
}
|
275
281
|
end
|
@@ -460,5 +466,32 @@ class BoatSerializer < AbstractSerializer
|
|
460
466
|
def visits_total(boat)
|
461
467
|
{ visits_total: boat.visits_total }
|
462
468
|
end
|
469
|
+
|
470
|
+
def serialize_opts
|
471
|
+
locale = ::Dicts::Locale.find_by_index @opts[:locale]
|
472
|
+
uol = ::Dicts::Length.find_by_index @opts[:uol]
|
473
|
+
business = ::Dicts::Business.find_by_index @opts[:business]
|
474
|
+
currency = ::Dicts::Currency.find_by_index @opts[:currency]
|
475
|
+
|
476
|
+
{
|
477
|
+
locale: {
|
478
|
+
index: locale.index,
|
479
|
+
id: locale.id
|
480
|
+
},
|
481
|
+
uol: {
|
482
|
+
index: uol.index,
|
483
|
+
id: uol.id
|
484
|
+
},
|
485
|
+
business: {
|
486
|
+
index: business.index,
|
487
|
+
id: business.id
|
488
|
+
},
|
489
|
+
currency: {
|
490
|
+
index: currency.index,
|
491
|
+
id: currency.id,
|
492
|
+
symbol: currency.symbol
|
493
|
+
}
|
494
|
+
}
|
495
|
+
end
|
463
496
|
end
|
464
497
|
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.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- C80609A
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|