Module: SendGrid4r::REST::Categories
Overview
SendGrid Web API v3 Categories
Defined Under Namespace
Classes: Category
Constant Summary
Constants included from Request
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_categories(resp) ⇒ Object
17 18 19 20 |
# File 'lib/sendgrid4r/rest/categories.rb', line 17 def self.create_categories(resp) return resp if resp.nil? resp.map { |category| Categories.create_category(category) } end |
.create_category(resp) ⇒ Object
12 13 14 15 |
# File 'lib/sendgrid4r/rest/categories.rb', line 12 def self.create_category(resp) return resp if resp.nil? Category.new(resp['category']) end |
Instance Method Details
#get_categories(category: nil, limit: nil, offset: nil, &block) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/sendgrid4r/rest/categories.rb', line 22 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 |