Class: AsposeCellsCloud::PostProtectRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/aspose_cells_cloud/requests/post_protect_request.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ PostProtectRequest

Returns a new instance of PostProtectRequest.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/aspose_cells_cloud/requests/post_protect_request.rb', line 38

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

  if attributes.has_key?(:'File')
      self.file = attributes[:'File']
  end
  if attributes.has_key?(:'protectWorkbookRequest')
      self.protect_workbook_request = attributes[:'protectWorkbookRequest']
  end
  if attributes.has_key?(:'password')
      self.password = attributes[:'password']
  end

end

Instance Attribute Details

#fileObject

Returns the value of attribute file.



34
35
36
# File 'lib/aspose_cells_cloud/requests/post_protect_request.rb', line 34

def file
  @file
end

#passwordObject

Returns the value of attribute password.



36
37
38
# File 'lib/aspose_cells_cloud/requests/post_protect_request.rb', line 36

def password
  @password
end

#protect_workbook_requestObject

Returns the value of attribute protect_workbook_request.



35
36
37
# File 'lib/aspose_cells_cloud/requests/post_protect_request.rb', line 35

def protect_workbook_request
  @protect_workbook_request
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



56
57
58
59
60
61
62
# File 'lib/aspose_cells_cloud/requests/post_protect_request.rb', line 56

def self.attribute_map
  {
    :'file' => :'File',
    :'protect_workbook_request' => :'protectWorkbookRequest',
    :'password' => :'password'
  }
end

.swagger_typesObject

Attribute type mapping.



65
66
67
68
69
70
71
# File 'lib/aspose_cells_cloud/requests/post_protect_request.rb', line 65

def self.swagger_types
  {
    :'file' => :'Hash',
    :'protect_workbook_request' => :'ProtectWorkbookRequest',
    :'password' => :'String'
  }
end

Instance Method Details

#create_http_request(api_client, opts = {}) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/aspose_cells_cloud/requests/post_protect_request.rb', line 73

def create_http_request(api_client,opts = {})
  if api_client.config.debugging
    api_client.config.logger.debug "Calling API: CellsApi.post_protect ..."
  end
  api_client.request_token_if_needed
  # verify the required parameter 'file' is set
  if api_client.config.client_side_validation && file.nil?
      fail ArgumentError, "Missing the required parameter 'file' when calling CellsApi.post_protect "
  end 
  # verify the required parameter 'protect_workbook_request' is set
  if api_client.config.client_side_validation && protect_workbook_request.nil?
      fail ArgumentError, "Missing the required parameter 'protect_workbook_request' when calling CellsApi.post_protect "
  end 

  # resource path
  local_var_path = "/cells/protect"
  # query parameters
  query_params = {}
  query_params[:'password'] = self.password if !self.password.nil? 

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}
  post_body = nil 
      file.each do |filename , context|
        form_params[filename]  = context
      end 
  form_params['protect_workbook_request']  = post_body.to_json
  header_params['Content-Type'] = api_client.select_header_content_type(['multipart/form-data'])
     

  #auth_names = []
  auth_names = ['JWT']
  data, status_code, headers = api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'FilesResult')
  if api_client.config.debugging
    api_client.config.logger.debug "API called: Specification.Name>Api.post_protect\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end