lib/phraseapp-ruby.rb
def upload_create(project_id, params)
      path = sprintf("/api/v2/projects/%s/uploads", project_id)
      data_hash = {}
      post_body = nil
  
      if params.present?
        unless params.kind_of?(PhraseApp::RequestParams::UploadParams)
          raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::UploadParams")
        end
      end
      if params.autotranslate != nil
        data_hash["autotranslate"] = (params.autotranslate == true)
      end

      if params.branch != nil
        data_hash["branch"] = params.branch
      end

      if params.convert_emoji != nil
        data_hash["convert_emoji"] = (params.convert_emoji == true)
      end

      if params.file != nil
        post_body = []
        post_body << "--#{PhraseApp::MULTIPART_BOUNDARY}\r\n"
        post_body << "Content-Disposition: form-data; name=\"file\"; filename=\"#{File.basename(params.file )}\"\r\n"
        post_body << "Content-Type: text/plain\r\n"
        post_body << "\r\n"
        post_body << File.read(params.file)
        post_body << "\r\n"
      end

      if params.file_encoding != nil
        data_hash["file_encoding"] = params.file_encoding
      end

      if params.file_format != nil
        data_hash["file_format"] = params.file_format
      end

      if params.format_options != nil
        params.format_options.each do |key, value|
          data_hash["format_options"][key] = value
        end
      end

      if params.locale_id != nil
        data_hash["locale_id"] = params.locale_id
      end

      if params.locale_mapping != nil
        params.locale_mapping.each do |key, value|
          data_hash["locale_mapping"][key] = value
        end
      end

      if params.mark_reviewed != nil
        data_hash["mark_reviewed"] = (params.mark_reviewed == true)
      end

      if params.skip_unverification != nil
        data_hash["skip_unverification"] = (params.skip_unverification == true)
      end

      if params.skip_upload_tags != nil
        data_hash["skip_upload_tags"] = (params.skip_upload_tags == true)
      end

      if params.tags != nil
        data_hash["tags"] = params.tags
      end

      if params.update_descriptions != nil
        data_hash["update_descriptions"] = (params.update_descriptions == true)
      end

      if params.update_translations != nil
        data_hash["update_translations"] = (params.update_translations == true)
      end

  
  
      reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
      rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
      if err != nil
        return nil, err
      end
      
      return PhraseApp::ResponseObjects::Upload.new(JSON.load(rc.body)), err
    end
def upload_create(project_id, params)
      path = sprintf("/api/v2/projects/%s/uploads", project_id)
      data_hash = {}
      post_body = nil
  
      if params.present?
        unless params.kind_of?(PhraseApp::RequestParams::UploadParams)
          raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::UploadParams")
        end
      end
      if params.autotranslate != nil
        data_hash["autotranslate"] = (params.autotranslate == true)
      end

      if params.branch != nil
        data_hash["branch"] = params.branch
      end

      if params.convert_emoji != nil
        data_hash["convert_emoji"] = (params.convert_emoji == true)
      end

      if params.file != nil
        post_body = []
        post_body << "--#{PhraseApp::MULTIPART_BOUNDARY}\r\n"
        post_body << "Content-Disposition: form-data; name=\"file\"; filename=\"#{File.basename(params.file )}\"\r\n"
        post_body << "Content-Type: text/plain\r\n"
        post_body << "\r\n"
        post_body << File.read(params.file)
        post_body << "\r\n"
      end

      if params.file_encoding != nil
        data_hash["file_encoding"] = params.file_encoding
      end

      if params.file_format != nil
        data_hash["file_format"] = params.file_format
      end

      if params.format_options != nil
        params.format_options.each do |key, value|
          data_hash["format_options"][key] = value
        end
      end

      if params.locale_id != nil
        data_hash["locale_id"] = params.locale_id
      end

      if params.locale_mapping != nil
        params.locale_mapping.each do |key, value|
          data_hash["locale_mapping"][key] = value
        end
      end

      if params.mark_reviewed != nil
        data_hash["mark_reviewed"] = (params.mark_reviewed == true)
      end

      if params.skip_unverification != nil
        data_hash["skip_unverification"] = (params.skip_unverification == true)
      end

      if params.skip_upload_tags != nil
        data_hash["skip_upload_tags"] = (params.skip_upload_tags == true)
      end

      if params.tags != nil
        data_hash["tags"] = params.tags
      end

      if params.update_descriptions != nil
        data_hash["update_descriptions"] = (params.update_descriptions == true)
      end

      if params.update_translations != nil
        data_hash["update_translations"] = (params.update_translations == true)
      end

  
  
      reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
      rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
      if err != nil
        return nil, err
      end
      
      return PhraseApp::ResponseObjects::Upload.new(JSON.load(rc.body)), err
    end
Upload a new language file. Creates necessary resources in your project.
 API Path: /api/v2/projects/:project_id/uploads
 == Parameters:
 project_id::
   project_id
 params::
   Parameters of type PhraseApp::RequestParams::UploadParams

 == Returns:
   PhraseApp::ResponseObjects::Upload
   err