Class: MailHatchSerializer

Inherits:
ActiveJob::Serializers::ObjectSerializer
  • Object
show all
Defined in:
lib/mail_hatch_serializer.rb

Instance Method Summary collapse

Instance Method Details

#deserialize(hash) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/mail_hatch_serializer.rb', line 20

def deserialize(hash)
  mh = OpenStruct.new(hash)
  MailHatch.new(
    api_key: mh.api_key,
    brand_color: mh.brand_color,
    debug: mh.debug, 
    dry_run: mh.dry_run,
    sendgrid_api_key: mh.sendgrid_api_key,
    title: mh.title,
    address: mh.address,
    ios_store_url: mh.ios_store_url, 
    google_play_store_url: mh.google_play_store_url
  )
end

#serialize(mh) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/mail_hatch_serializer.rb', line 6

def serialize(mh)
  super(
    api_key: mh.api_key,
    brand_color: mh.brand_color,
    debug: mh.debug, 
    dry_run: mh.dry_run,
    sendgrid_api_key: mh.sendgrid_api_key,
    title: mh.title,
    address: mh.address,
    ios_store_url: mh.ios_store_url, 
    google_play_store_url: mh.google_play_store_url
  )
end

#serialize?(argument) ⇒ Boolean



2
3
4
# File 'lib/mail_hatch_serializer.rb', line 2

def serialize?(argument)
  argument.is_a? MailHatch
end