Class: SendGrid4r::Factory::SegmentFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/sendgrid4r/factory/segment_factory.rb

Overview

SendGrid Web API v3 Segment Factory Class implementation

Instance Method Summary collapse

Instance Method Details

#create(name: nil, list_id: nil, conditions:) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/sendgrid4r/factory/segment_factory.rb', line 9

def create(name: nil, list_id: nil, conditions:)
  segment = SendGrid4r::REST::Contacts::Segments::Segment.new(
    nil,
    name,
    list_id,
    conditions,
    nil
  )
  hash = segment.to_h
  hash.delete(:id)
  hash.delete(:list_id) if list_id.nil?
  hash
end