Class: Lease::RequestInfoSerializer

Inherits:
AbstractSerializer show all
Defined in:
app/serializers/lease/request_info_serializer.rb

Class Method Summary collapse

Methods inherited from AbstractSerializer

opts

Class Method Details

.amount(request_info) ⇒ Object



39
40
41
# File 'app/serializers/lease/request_info_serializer.rb', line 39

def amount(request_info)
  { amount: request_info.amount }
end

.available_attributesObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/serializers/lease/request_info_serializer.rb', line 8

def available_attributes
  i[
    id
    uuid
    operator
    amount
    currency
    external_transaction_id
    state
    created_at
    updated_at
  ]
end

.created_at(request_info) ⇒ Object



55
56
57
# File 'app/serializers/lease/request_info_serializer.rb', line 55

def created_at(request_info)
  { created_at: request_info.created_at }
end

.currency(request_info) ⇒ Object



43
44
45
# File 'app/serializers/lease/request_info_serializer.rb', line 43

def currency(request_info)
  { currency: request_info.currency }
end

.external_transaction_id(request_info) ⇒ Object



47
48
49
# File 'app/serializers/lease/request_info_serializer.rb', line 47

def external_transaction_id(request_info)
  { external_transaction_id: request_info.external_transaction_id }
end

.id(request_info) ⇒ Object



22
23
24
# File 'app/serializers/lease/request_info_serializer.rb', line 22

def id(request_info)
  { id: request_info.id }
end

.operator(request_info) ⇒ Object



30
31
32
33
34
35
36
37
# File 'app/serializers/lease/request_info_serializer.rb', line 30

def operator(request_info)
  {
    operator: {
      id:    request_info.operator.id,
      index: request_info.operator.type_index
    }
  }
end

.serialize(model, attributes:, opts: {}) ⇒ Object



4
5
6
# File 'app/serializers/lease/request_info_serializer.rb', line 4

def serialize(model, attributes:, opts: {})
  super
end

.state(request_info) ⇒ Object



51
52
53
# File 'app/serializers/lease/request_info_serializer.rb', line 51

def state(request_info)
  { state: request_info.state }
end

.updated_at(request_info) ⇒ Object



59
60
61
# File 'app/serializers/lease/request_info_serializer.rb', line 59

def updated_at(request_info)
  { updated_at: request_info.updated_at }
end

.uuid(request_info) ⇒ Object



26
27
28
# File 'app/serializers/lease/request_info_serializer.rb', line 26

def uuid(request_info)
  { uuid: request_info.uuid }
end