Create a new instance.
 It is recommended to pass in a meaningful user agent.
 Defaults to using the secure api (https)
 Run a query against Duck Duck Go
 Returns an instance of DuckDuckGo::ZeroClickInfo
434966
def zeroclickinfo(query, skip_disambiguation = false)
      args = {
        'q' => query,
        'o' => 'json'
      }
      if(skip_disambiguation)
        args['d'] = 1
      end
      
      data = @http.get_content(@url, args)
  
      # parse the JSON and return an instance
      # of the ZeroClickInfo class
      DuckDuckGo::ZeroClickInfo.by(JSON.parse(data))
    end
1196559
def create_instance(self, application, revision=None, environment=None, name=None, parameters=None, submodules=None,
                        destroyInterval=None, manifestVersion=None):
        
        from qubell.api.private.instance import Instance
        return Instance.new(self._router, application, revision, environment, name,
                            parameters, submodules, destroyInterval, manifestVersion=manifestVersion)
631032
def create
      @object = resource.new(object_params)
      authorize_for(action: :create,
                    resource: resource.name.underscore.to_sym,
                    object: @object)
      if @object.save
        render json: @object.to_json, status: :created
      else
        render json: @object.errors, status: :unprocessable_entity
      end
    end
504047
function createRegExp (regexp, options) {
    return new DuckType({
      name: options && options.name || null,
      test: function (object) {
        return ((object instanceof String) || typeof(object) === 'string') && regexp.test(object);
      }
    });
  }
1098571
def create(self, **kwargs):
        
        tmos_v = self._meta_data['bigip']._meta_data['tmos_version']
        if LooseVersion(tmos_v) == LooseVersion('11.5.4') or LooseVersion(
                tmos_v) == LooseVersion('12.1.1'):
            if 'uri' in self._meta_data:
                error = "There was an attempt to assign a new uri to this " \
                        "resource, the _meta_data['uri'] is %s and it should" \
                        " not be changed." % (self._meta_data['uri'])
                raise URICreationCollision(error)
            self._check_exclusive_parameters(**kwargs)
            requests_params = self._handle_requests_params(kwargs)
            self._check_create_parameters(**kwargs)

            # Reduce boolean pairs as specified by the meta_data entry below
            for key1, key2 in self._meta_data['reduction_forcing_pairs']:
                kwargs = self._reduce_boolean_pair(kwargs, key1, key2)

            # Make convenience variable with short names for this method.
            _create_uri = self._meta_data['container']._meta_data['uri']
            session = self._meta_data['bigip']._meta_data['icr_session']
            # We using try/except just in case some HF will fix
            # this in 11.5.4

            try:
                response = session.post(
                    _create_uri, json=kwargs, **requests_params)

            except HTTPError as err:
                if err.response.status_code != 404:
                    raise
                if err.response.status_code == 404:
                    return self._return_object(self._meta_data['container'],
                                               kwargs['name'])
            # Make new instance of self
            return self._produce_instance(response)
        else:
            return self._create(**kwargs)
517944
def create_instance(res)
      response = res.parsed_response

      # if there was an error, throw it
      raise_error(response['error'], res.code) if response.nil? || response.key?('error')

      # There must be a top level entity
      # This is either one of payment, refund, or collection at present
      begin
        class_name = response['entity'].split('_').collect(&:capitalize).join

        klass = Razorpay.const_get class_name
      rescue NameError
        # Use Entity class if we don't find any
        klass = Razorpay::Entity
      end
      klass.new(response)
    end
75021
def create(domain, action, url = '')
      res = @client.post("domains/#{domain}/webhooks", id: action, url: url)
      res.to_h['webhook']['url'] == url && res.to_h['message'] == 'Webhook has been created'
    end
95242
def create
      self.resource = new_resource( resource_params )
      
      respond_to do |format|
        if resource.save
          format.html { redirect_to resource_url, notice: "#{resource_name.humanize} was successfully created." }
          format.js
          format.json { render :show, status: :create, location: resource_url }
        else
          format.html { render :new }
          format.js   { render :new }
          format.json { render json: resource.errors, status: :unprocessable_entity }
        end
      end
    end
308016
def create(cls, fqdn, flags, algorithm, public_key):
        """"""
        fqdn = fqdn.lower()

        params = {
            'flags': flags,
            'algorithm': algorithm,
            'public_key': public_key,
        }

        result = cls.call('domain.dnssec.create', fqdn, params)

        return result
178571
def create
      if env['warden'].authenticate(:password, :scope => :user)
        #return the user JSON on success
        render json: current_user, status: :created
      else
        #return error mesage in a JSON on error
        render json: {errors: {user:["Invalid email or password"]}}, status: :unprocessable_entity
      end
    end
986029
def create
      return false unless new_record?
      run_callbacks :save do
        run_callbacks :create do
          httparty = self.class.post(self.class.index_path, request_options.merge(:body => to_json))
          handle_save_response(httparty)
        end
      end
    end
63022
function createObject (type, options) {
    // retrieve the test functions for each of the objects properties
    var tests = {},
        prop;
    for (prop in type) {
      if (type.hasOwnProperty(prop)) {
        tests[prop] = ducktype(type[prop]).test;
      }
    }

    // non-empty object
    var isObject = basic.object.test;
    return new DuckType({
      name: options && options.name || null,
      test: function test (object) {
        var prop;
        
        // test whether we have an object
        if (!isObject(object)) {
          return false;
        }

        // test each of the defined properties
        for (prop in tests) {
          if (tests.hasOwnProperty(prop)) {
            if (!tests[prop](object[prop])) {
              return false;
            }
          }
        }
        return true;
      }
    });
  }
797198
def build(
        cls,
        *,
        scheme="",
        user="",
        password=None,
        host="",
        port=None,
        path="",
        query=None,
        query_string="",
        fragment="",
        encoded=False
    ):
        """"""

        if not host and scheme:
            raise ValueError('Can\'t build URL with "scheme" but without "host".')
        if port and not host:
            raise ValueError('Can\'t build URL with "port" but without "host".')
        if query and query_string:
            raise ValueError('Only one of "query" or "query_string" should be passed')
        if path is None or query_string is None or fragment is None:
            raise TypeError('NoneType is illegal for "path", "query_string" and '
                            '"fragment" args, use string values instead.')

        if not user and not password and not host and not port:
            netloc = ""
        else:
            netloc = cls._make_netloc(user, password, host, port, encode=not encoded)
        if not encoded:
            path = cls._PATH_QUOTER(path)
            if netloc:
                path = cls._normalize_path(path)

            cls._validate_authority_uri_abs_path(host=host, path=path)
            query_string = cls._QUERY_QUOTER(query_string)
            fragment = cls._FRAGMENT_QUOTER(fragment)

        url = cls(
            SplitResult(scheme, netloc, path, query_string, fragment), encoded=True
        )

        if query:
            return url.with_query(query)
        else:
            return url
516266
def build(options = {})
      DuckMap.logger.info "\r\n\r\n====================================================================="
      DuckMap.logger.info "#{self.class.name} session begin at: #{Time.now}"
      DuckMap.logger.info "options: #{options}"

      verbose = options[:verbose].blank? ? false : true

      # always replace ALL of the existing content, so, the list is always current.
      # actions / views may have been deleted, renamed, etc.
      content = {sitemap: {}}
      grand_total = 0

      # controllers full physical path for the current app.
      base_dir = File.join(Rails.root, "app", "controllers").to_s

      # this is a little bit complex.
      # - traverse the entire directory structure for controllers.
      # - for each
      #   - inline gsub! to remove the base_dir.
      #   - inline gsub! to remove _controller.
      #   - then, prevent the application controller from making it into the list as
      #     there should not be any actions / views for the application controller.


      list = Dir["#{File.join(base_dir, "**", "*.rb")}"].each {|f| f.gsub!("#{base_dir}/", "").gsub!("_controller.rb", "")}.map.find_all {|x| x.eql?("application") ? false : true}

      DuckMap.console "Total number of controllers found within the app: #{list.length}"
      DuckMap.console "Views Controller"
      DuckMap.console "-------------------------------------------------------------"

      DuckMap.logger.show_console = verbose ? true : false

      list.each do |controller|

        file_spec = File.join("app", "views", controller)

        clazz = "#{controller}_controller".camelize.constantize

        DuckMap.console "===================================================================================="
        DuckMap.console "controller: #{controller.ljust(30)}  path: #{file_spec}"

        actions = {}
        methods = clazz.action_methods

        methods.each do |action|

          latest_timestamp = nil
          winner = nil

          DuckMap.console "    action: #{action}"

          Dir["#{File.join(file_spec, action)}.html.*"].each do |view|

            begin
              view_timestamp = File.stat(File.join(Rails.root, view)).mtime
              if view_timestamp.blank?
                DuckMap.console "          : cannot stat file: #{view}"
              else

                if latest_timestamp.blank? || view_timestamp > latest_timestamp
                  latest_timestamp = view_timestamp
                  winner = "timestamp from file"
                  DuckMap.console "          : Using    file timestamp? YES #{view}"
                  DuckMap.console "          :     file timestamp #{view_timestamp} greater than: #{latest_timestamp}"
                else
                  DuckMap.console "          : Using    file timestamp? NO #{view}"
                  DuckMap.console "          :     file timestamp #{view_timestamp} less than: #{latest_timestamp}"
                end

              end
            rescue Exception => e
              DuckMap.logger.debug "#{e}"
            end

            begin
              output = %x(git log --format='%ci' -- #{view} | head -n 1)
              if output.blank?
                DuckMap.console "          : cannot get date from GIT for file: #{view}"
              else

                view_timestamp = LastMod.to_date(output)
                if latest_timestamp.blank? || view_timestamp > latest_timestamp
                  latest_timestamp = view_timestamp
                  winner = "timestamp from GIT"
                  DuckMap.console "          : Using     GIT timestamp? YES #{view}"
                  DuckMap.console "          :     file timestamp #{view_timestamp} greater than: #{latest_timestamp}"
                else
                  DuckMap.console "          : Using     GIT timestamp? NO #{view}"
                  DuckMap.console "          :     file timestamp #{view_timestamp} less than: #{latest_timestamp}"
                end

              end
            rescue Exception => e
              DuckMap.logger.debug "#{e}"
            end

            begin
              view_timestamp = LastMod.to_date(I18n.t("#{controller.gsub("/", ".")}.#{action}", :locale => :sitemap))

              if view_timestamp.blank?
                DuckMap.console "          : cannot find item in locale sitemap.yml for file: #{view}"
              else

                view_timestamp = LastMod.to_date(output)
                if latest_timestamp.blank? || view_timestamp > latest_timestamp
                  latest_timestamp = view_timestamp
                  winner = "timestamp from locale sitemap.yml"
                  DuckMap.console "          : Using  locale timestamp? YES #{view}"
                  DuckMap.console "          :     file timestamp #{view_timestamp} greater than: #{latest_timestamp}"
                else
                  DuckMap.console "          : Using  locale timestamp? NO #{view}"
                  DuckMap.console "          :     file timestamp #{view_timestamp} less than: #{latest_timestamp}"
                end

              end

            rescue Exception => e
              DuckMap.logger.debug "#{e}"
            end

            DuckMap.console "          : winner #{winner}"

            begin
              actions.merge!(action => latest_timestamp.strftime("%m/%d/%Y %H:%M:%S"))
            rescue Exception => e
              DuckMap.logger.debug "#{e}"
            end

          end
        end

        # add all of the actions found for the current controller to the :sitemap section of the yaml file.
        if actions.length > 0
          grand_total += actions.length
          namespaces = controller.split("/")
          content[:sitemap] = merge_controller(content[:sitemap], namespaces, 0, actions)

          DuckMap.logger.show_console = true
          DuckMap.console "#{actions.length.to_s.rjust(5)} #{controller}"
          DuckMap.logger.show_console = verbose ? true : false

        end

      end

      DuckMap.logger.show_console = true
      DuckMap.console "\r\nTotal number of views synchronized: #{grand_total}\r\n"
      DuckMap.logger.info "#{self.class.name} session end at: #{Time.now}"
      DuckMap.logger.info "---------------------------------------------------------------------"

      # done.
      write_config(content)
      DuckMap.console "done."

    end
145593
function newInstance (controller, args) {
    // get model from controller
    var model = controller.model
    // form to create new instance
    var form
    // get model data from input
    var data = args[model.name]
    // if pre-fill input is passed then initialize form with it
    if (defined(data)) {
        form = controller.form.newInstance({
            input: data,
            redirect: args.redirect,
        })
    }
    // otherwise use default form
    else {
        form = controller.form.newInstance({
            action: './?redirect=./',
        })
    }

    return {
        form: form,
    }
}
440942
def build_http_object(uri)
      http = Net::HTTP.new(uri.host, uri.port)
      http.use_ssl = true if uri.scheme == 'https'
      if @ssl_enabled
        http.cert_store = @cert_store if @cert_store
      else http.verify_mode = OpenSSL::SSL::VERIFY_NONE
      end
      http.read_timeout = @timeout if @timeout # Timeout for a request
      http.open_timeout = @timeout if @timeout # Timeout for a connection
      http
    end
702303
def create_http
      http = Net::HTTP.new(
        API_URI.host, 
        API_URI.port
      )
      http.use_ssl = true
      apply_ca_cert_path(http)
      apply_pem(http)
      http
    end