Module: SendGrid4r::REST::Contacts::CustomFields
- Includes:
- Request
- Included in:
- API
- Defined in:
- lib/sendgrid4r/rest/contacts/custom_fields.rb
Overview
SendGrid Web API v3 Contacts - Custom 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, #get, #patch, #post, #process_array_params, #process_url_params, #put
Class Method Details
.create_field(resp) ⇒ Object
30
31
32
33
|
# File 'lib/sendgrid4r/rest/contacts/custom_fields.rb', line 30
def self.create_field(resp)
return resp if resp.nil?
Field.new(resp['id'], resp['name'], resp['type'], resp['value'])
end
|
.create_fields(resp) ⇒ Object
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/sendgrid4r/rest/contacts/custom_fields.rb', line 35
def self.create_fields(resp)
return resp if resp.nil?
custom_fields = []
resp['custom_fields'].each do |field|
custom_fields.push(
SendGrid4r::REST::Contacts::CustomFields.create_field(field)
)
end
Fields.new(custom_fields)
end
|
.url(custom_field_id = nil) ⇒ Object
24
25
26
27
28
|
# File 'lib/sendgrid4r/rest/contacts/custom_fields.rb', line 24
def self.url(custom_field_id = nil)
url = "#{BASE_URL}/contactdb/custom_fields"
url = "#{url}/#{custom_field_id}" unless custom_field_id.nil?
url
end
|
Instance Method Details
#delete_custom_field(custom_field_id:, &block) ⇒ Object
72
73
74
75
76
77
78
|
# File 'lib/sendgrid4r/rest/contacts/custom_fields.rb', line 72
def delete_custom_field(custom_field_id:, &block)
delete(
@auth,
SendGrid4r::REST::Contacts::CustomFields.url(custom_field_id),
&block
)
end
|
#get_custom_field(custom_field_id:, &block) ⇒ Object
#get_custom_fields(&block) ⇒ Object
#post_custom_field(name:, type:, &block) ⇒ Object