Sha256: 63d311c7125861d6033a22a8b748266306d55b2222e626775f671e46c2251266
Contents?: true
Size: 827 Bytes
Versions: 4
Compression:
Stored size: 827 Bytes
Contents
# -*- encoding: utf-8 -*- module SendGrid4r::REST # # SendGrid Web API v3 Categories # module Categories include Request Category = Struct.new(:category) def self.create_category(resp) return resp if resp.nil? Category.new(resp['category']) end def self.create_categories(resp) return resp if resp.nil? resp.map { |category| Categories.create_category(category) } end 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 end end
Version data entries
4 entries across 4 versions & 1 rubygems