c80_shared 0.1.85 → 0.1.90

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ed5f35d3ff5e11a40541cc2822ae35609f9b1f910959ad86c6e69af57f3b6b2
4
- data.tar.gz: b46e0e82e3d67048dafddf52fbe5c79a4807b487b83c5b7f9052020793bd33c8
3
+ metadata.gz: 8b74798e7fa2ba84239918bc247e89ceca53912539ae784d14ba6556c0ba13a1
4
+ data.tar.gz: b6123aae96bf2611736b5005b2459da881e906e8a9476d067229e975cd00fa1c
5
5
  SHA512:
6
- metadata.gz: 181ca579be539a73581cced8dc9db63fb0253017352df93dd6508e5990a8981844e1554a398f1f6bbf9a0d8f9d7147aacf6635d0e563a075fd345be202204df5
7
- data.tar.gz: 6ec6e7728b432120edcac45ee5f6c189890e008c5d10204505d3c8ab89dc965d85afc8e898efe5923427ec3c9aae81a8b7ef3b77b0916e1e8701e5ee613db100
6
+ metadata.gz: e6ccb76fbbd4df0cf0297c821711e79dd9e3059cb61fad4b20d379244e4937eef719acd1f1c59908f5a0fff595821def85b0b8f18422bce1c011034c8cd5cee1
7
+ data.tar.gz: 9fb4506fab81c11b4ccd8b4fa96a19251c5f39767f187c19b177ff9277fb8ccc97cb289b4566dda9e916ffa894640fd2473140e5c6e03cb3e295f30a248794f8
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- c80_shared (0.1.84)
4
+ c80_shared (0.1.89)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -0,0 +1,2 @@
1
+ build:
2
+ /bin/bash -c "/usr/share/rvm/bin/rvm ruby-2.3.7 do /usr/share/rvm/rubies/ruby-2.3.7/bin/ruby /usr/share/rvm/rubies/ruby-2.3.7/bin/gem build c80_shared.gemspec"
@@ -0,0 +1,7 @@
1
+ # при изменении данного списка необходимо соответственно изменить методы отрисовки кнопок в декораторе ::Lease::Bids::Client::Actions
2
+ module Dicts
3
+ class Operator < ::Dict
4
+ STRIPE = new 1, :stripe
5
+ PAYPAL = new 2, :paypal
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module Dicts
2
+ class RequestInfoState < ::Dict
3
+ CREATED = new 1, :created
4
+ SUBMITTING = new 2, :submitting
5
+ SUCCESS = new 3, :success
6
+ end
7
+ end
@@ -7,6 +7,7 @@ class AccountSerializer < AbstractSerializer
7
7
  id
8
8
  type_index
9
9
  props
10
+ abilities
10
11
  ]
11
12
  end
12
13
 
@@ -38,5 +39,23 @@ class AccountSerializer < AbstractSerializer
38
39
  end
39
40
  { props: props }
40
41
  end
42
+
43
+ # список возможностей с учётом запретов
44
+ def abilities(account)
45
+ account_class = ::Dictionaries::AccountType::CLASS_BY_TYPE[account.type_id]
46
+ default_abilities = ::Dicts::Accounts::Ability.all_for_account_class(account_class)
47
+ prohibited = account.user.permissions
48
+
49
+ # отнимаем запрещённые действия из дефолтных
50
+ not_prohibited = ->(ability) { prohibited.none? { |a| a.action.to_s == ability.index.to_s } }
51
+ abilities = default_abilities.map do |a|
52
+ {
53
+ action: a.index,
54
+ can: not_prohibited[a]
55
+ }
56
+ end
57
+
58
+ { abilities: abilities }
59
+ end
41
60
  end
42
- end
61
+ end
@@ -0,0 +1,25 @@
1
+ module Accounts
2
+ class CentralAgentSerializer < AbstractSerializer
3
+ class << self
4
+ def available_attributes
5
+ %i[
6
+ email
7
+ phone
8
+ name
9
+ ]
10
+ end
11
+
12
+ def email(central_agent)
13
+ { email: central_agent.account.user.email }
14
+ end
15
+
16
+ def phone(central_agent)
17
+ { phone: central_agent.account.user.phone }
18
+ end
19
+
20
+ def name(central_agent)
21
+ { name: central_agent.account.user.name }
22
+ end
23
+ end
24
+ end
25
+ end
@@ -80,7 +80,7 @@ module Lease
80
80
  end
81
81
 
82
82
  def cancellation_type(bid)
83
- return if bid.cancellation_type.nil?
83
+ return { cancellation_type: nil } if bid.cancellation_type.nil?
84
84
 
85
85
  ct = ::Dicts::Lease::OfferCancelation.find bid.cancellation_type
86
86
 
@@ -0,0 +1,64 @@
1
+ module Lease
2
+ class RequestInfoSerializer < ::AbstractSerializer
3
+ class << self
4
+ def serialize(model, attributes:, opts: {})
5
+ super
6
+ end
7
+
8
+ def available_attributes
9
+ %i[
10
+ id
11
+ uuid
12
+ operator
13
+ amount
14
+ currency
15
+ external_transaction_id
16
+ state
17
+ created_at
18
+ updated_at
19
+ ]
20
+ end
21
+
22
+ def id(request_info)
23
+ { id: request_info.id }
24
+ end
25
+
26
+ def uuid(request_info)
27
+ { uuid: request_info.uuid }
28
+ end
29
+
30
+ def operator(request_info)
31
+ {
32
+ operator: {
33
+ id: request_info.operator.id,
34
+ index: request_info.operator.type_index
35
+ }
36
+ }
37
+ end
38
+
39
+ def amount(request_info)
40
+ { amount: request_info.amount }
41
+ end
42
+
43
+ def currency(request_info)
44
+ { currency: request_info.currency }
45
+ end
46
+
47
+ def external_transaction_id(request_info)
48
+ { external_transaction_id: request_info.external_transaction_id }
49
+ end
50
+
51
+ def state(request_info)
52
+ { state: request_info.state }
53
+ end
54
+
55
+ def created_at(request_info)
56
+ { created_at: request_info.created_at }
57
+ end
58
+
59
+ def updated_at(request_info)
60
+ { updated_at: request_info.updated_at }
61
+ end
62
+ end
63
+ end
64
+ end
@@ -1,3 +1,3 @@
1
1
  module C80Shared
2
- VERSION = "0.1.85"
2
+ VERSION = "0.1.90"
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.85
4
+ version: 0.1.90
5
5
  platform: ruby
6
6
  authors:
7
7
  - C80609A
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-20 00:00:00.000000000 Z
11
+ date: 2020-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -49,6 +49,7 @@ files:
49
49
  - ".rubocop.yml"
50
50
  - Gemfile
51
51
  - Gemfile.lock
52
+ - Makefile
52
53
  - README.md
53
54
  - app/dicts/account_type.rb
54
55
  - app/dicts/boat_condition.rb
@@ -68,8 +69,10 @@ files:
68
69
  - app/dicts/length.rb
69
70
  - app/dicts/locale.rb
70
71
  - app/dicts/motor.rb
72
+ - app/dicts/operators.rb
71
73
  - app/dicts/reject_type.rb
72
74
  - app/dicts/rent_skip_type.rb
75
+ - app/dicts/request_info_state.rb
73
76
  - app/dicts/role.rb
74
77
  - app/forms/application_form.rb
75
78
  - app/forms/rent_form.rb
@@ -88,6 +91,7 @@ files:
88
91
  - app/repositories/accounts/client_account_repository.rb
89
92
  - app/repositories/events/rejects_repository.rb
90
93
  - app/serializers/account_serializer.rb
94
+ - app/serializers/accounts/account_central_agent_serializer.rb
91
95
  - app/serializers/boat_location_serializer.rb
92
96
  - app/serializers/boat_price_serializer.rb
93
97
  - app/serializers/boat_sale_price_serializer.rb
@@ -101,6 +105,7 @@ files:
101
105
  - app/serializers/lease/bid_serializer.rb
102
106
  - app/serializers/lease/inquiry_serializer.rb
103
107
  - app/serializers/lease/rebate_serializer.rb
108
+ - app/serializers/lease/request_info_serializer.rb
104
109
  - app/serializers/lib/boats/dimensions.rb
105
110
  - app/serializers/lib/boats/rent_price_per_season.rb
106
111
  - app/serializers/lib/boats/sale_price.rb
@@ -201,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
206
  - !ruby/object:Gem::Version
202
207
  version: '0'
203
208
  requirements: []
204
- rubygems_version: 3.0.6
209
+ rubygems_version: 3.0.8
205
210
  signing_key:
206
211
  specification_version: 4
207
212
  summary: Write a short summary, because RubyGems requires one.