module SendGrid4r::REST::Categories

SendGrid Web API v3 Categories

Constants

Category

Public Class Methods

create_categories(resp) click to toggle source
# File lib/sendgrid4r/rest/categories.rb, line 16
def self.create_categories(resp)
  return resp if resp.nil?
  resp.map { |category| Categories.create_category(category) }
end
create_category(resp) click to toggle source
# File lib/sendgrid4r/rest/categories.rb, line 11
def self.create_category(resp)
  return resp if resp.nil?
  Category.new(resp['category'])
end

Public Instance Methods

get_categories(category: nil, limit: nil, offset: nil, &block) click to toggle source
# File lib/sendgrid4r/rest/categories.rb, line 21
def get_categories(category: nil, limit: nil, offset: nil, &block)
  params = {}
  params['category'] = category unless category.nil?
  params['limit'] = limit unless limit.nil?
  params['offset'] = offset unless limit.nil?
  resp = get(@auth, "#{BASE_URL}/categories", params, &block)
  finish(resp, @raw_resp) { |r| Categories.create_categories(r) }
end