module SendGrid4r::REST::MarketingCampaigns::Contacts::CustomFields
Constants
- Field
- Fields
Public Class Methods
create_field(resp)
click to toggle source
# File lib/sendgrid4r/rest/marketing_campaigns/contacts/custom_fields.rb, line 29 def self.create_field(resp) return resp if resp.nil? Field.new(resp['id'], resp['name'], resp['type'], resp['value']) end
create_fields(resp)
click to toggle source
# File lib/sendgrid4r/rest/marketing_campaigns/contacts/custom_fields.rb, line 34 def self.create_fields(resp) return resp if resp.nil? custom_fields = resp['custom_fields'].map do |field| Contacts::CustomFields.create_field(field) end Fields.new(custom_fields) end
url(custom_field_id = nil)
click to toggle source
# File lib/sendgrid4r/rest/marketing_campaigns/contacts/custom_fields.rb, line 23 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
Public Instance Methods
delete_custom_field(custom_field_id:, &block)
click to toggle source
# File lib/sendgrid4r/rest/marketing_campaigns/contacts/custom_fields.rb, line 66 def delete_custom_field(custom_field_id:, &block) delete(@auth, Contacts::CustomFields.url(custom_field_id), &block) end
get_custom_field(custom_field_id:, &block)
click to toggle source
# File lib/sendgrid4r/rest/marketing_campaigns/contacts/custom_fields.rb, line 59 def get_custom_field(custom_field_id:, &block) resp = get(@auth, Contacts::CustomFields.url(custom_field_id), &block) finish(resp, @raw_resp) do |r| Contacts::CustomFields.create_field(r) end end
get_custom_fields(&block)
click to toggle source
# File lib/sendgrid4r/rest/marketing_campaigns/contacts/custom_fields.rb, line 52 def get_custom_fields(&block) resp = get(@auth, Contacts::CustomFields.url, &block) finish(resp, @raw_resp) do |r| Contacts::CustomFields.create_fields(r) end end
post_custom_field(name:, type:, &block)
click to toggle source
# File lib/sendgrid4r/rest/marketing_campaigns/contacts/custom_fields.rb, line 42 def post_custom_field(name:, type:, &block) params = {} params['name'] = name params['type'] = type resp = post(@auth, Contacts::CustomFields.url, params, &block) finish(resp, @raw_resp) do |r| Contacts::CustomFields.create_field(r) end end