Sha256: 2eaf39fc0a701605376c95ac1e4c857c2cfcf9d3c17dc76bf93b404ad0496bf0
Contents?: true
Size: 1.34 KB
Versions: 5
Compression:
Stored size: 1.34 KB
Contents
require_relative 'api/resource_collection' require_relative 'source' class ContextIO class SourceCollection include ContextIO::API::ResourceCollection self.resource_class = ContextIO::Source self.association_name = :sources belongs_to :account # Creates a new source for an account. # # @param [String] email The email address for the new source. # @param [String] server The address of the server for the source. # @param [String] username The name for logging into the server. Often the # same as the email. # @param [Boolean] use_ssl Whether to use SSL for the new source. # @param [Numeric, String] port The port to connect on. # @param [String] type Currently, only 'IMAP' is supported. # @param [Hash{String, Symbol => String}] options Information you can # provide at creation. Check out the Context.IO documentation for what's # required and what's optional. def create(email, server, username, use_ssl, port, type, options={}) api_args = options.merge( 'email' => email, 'username' => username, 'use_ssl' => use_ssl ? '1' : '0', 'port' => port.to_s, 'type' => type ) result_hash = api.request(:post, resource_url, api_args) result_hash.delete('success') resource_class.new(api, result_hash) end end end
Version data entries
5 entries across 5 versions & 1 rubygems