Module: SendGrid4r::REST::MarketingCampaigns::Contacts::ReservedFields

Includes:
Request
Included in:
API
Defined in:
lib/sendgrid4r/rest/marketing_campaigns/contacts/reserved_fields.rb

Overview

SendGrid Web API v3 Contacts - Reserved Fields

Defined Under Namespace

Classes: Field, Fields

Constant Summary

Constants included from Request

Request::BASE_URL

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Request

#create_args, #delete, #execute, #finish, #get, #patch, #post, #process_array_params, #process_url_params, #put

Class Method Details

.create_field(resp) ⇒ Object



32
33
34
35
# File 'lib/sendgrid4r/rest/marketing_campaigns/contacts/reserved_fields.rb', line 32

def self.create_field(resp)
  return resp if resp.nil?
  Field.new(resp['name'], resp['type'])
end

.create_fields(resp) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/sendgrid4r/rest/marketing_campaigns/contacts/reserved_fields.rb', line 24

def self.create_fields(resp)
  return resp if resp.nil?
  reserved_fields = resp['reserved_fields'].map do |field|
    Contacts::ReservedFields.create_field(field)
  end
  Fields.new(reserved_fields)
end

Instance Method Details

#get_reserved_fields(&block) ⇒ Object



37
38
39
40
41
42
# File 'lib/sendgrid4r/rest/marketing_campaigns/contacts/reserved_fields.rb', line 37

def get_reserved_fields(&block)
  resp = get(@auth, "#{BASE_URL}/contactdb/reserved_fields", &block)
  finish(resp, @raw_resp) do |r|
    Contacts::ReservedFields.create_fields(r)
  end
end