Class: Files::SupportRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/files.com/models/support_request.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}, options = {}) ⇒ SupportRequest

Returns a new instance of SupportRequest.



7
8
9
10
# File 'lib/files.com/models/support_request.rb', line 7

def initialize(attributes = {}, options = {})
  @attributes = attributes || {}
  @options = options || {}
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



5
6
7
# File 'lib/files.com/models/support_request.rb', line 5

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/files.com/models/support_request.rb', line 5

def options
  @options
end

Class Method Details

.create(params = {}, options = {}) ⇒ Object

Parameters:

email (required) - string - Email address of the user requesting support.
subject (required) - string - Subject of the support request.
comment (required) - string - Main body of the support request.
customer_success_access - string - Enable Customer Success access to your user account?
priority - string - Priority. Can be `low` (e.g. general or billing/acount questions), `normal` (e.g. the system is impaired), `high` (e.g. a production workflow or business process is impaired), `urgent` (e.g. a production workflow or business process is down), `critical` (e.g. a business-critical workflow or business process is down)
attachments_files - array - Files to send to Customer Success along with this support request


91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/files.com/models/support_request.rb', line 91

def self.create(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: email must be an String") if params.dig(:email) and !params.dig(:email).is_a?(String)
  raise InvalidParameterError.new("Bad parameter: subject must be an String") if params.dig(:subject) and !params.dig(:subject).is_a?(String)
  raise InvalidParameterError.new("Bad parameter: comment must be an String") if params.dig(:comment) and !params.dig(:comment).is_a?(String)
  raise InvalidParameterError.new("Bad parameter: customer_success_access must be an String") if params.dig(:customer_success_access) and !params.dig(:customer_success_access).is_a?(String)
  raise InvalidParameterError.new("Bad parameter: priority must be an String") if params.dig(:priority) and !params.dig(:priority).is_a?(String)
  raise InvalidParameterError.new("Bad parameter: attachments_files must be an Array") if params.dig(:attachments_files) and !params.dig(:attachments_files).is_a?(Array)
  raise MissingParameterError.new("Parameter missing: email") unless params.dig(:email)
  raise MissingParameterError.new("Parameter missing: subject") unless params.dig(:subject)
  raise MissingParameterError.new("Parameter missing: comment") unless params.dig(:comment)

  response, options = Api.send_request("/support_requests", :post, params, options)
  SupportRequest.new(response.data, options)
end

Instance Method Details

#attachments_filesObject

array(file) - Files to send to Customer Success along with this support request



67
68
69
# File 'lib/files.com/models/support_request.rb', line 67

def attachments_files
  @attributes[:attachments_files]
end

#attachments_files=(value) ⇒ Object



71
72
73
# File 'lib/files.com/models/support_request.rb', line 71

def attachments_files=(value)
  @attributes[:attachments_files] = value
end

#commentObject

string - Main body of the support request.



31
32
33
# File 'lib/files.com/models/support_request.rb', line 31

def comment
  @attributes[:comment]
end

#comment=(value) ⇒ Object



35
36
37
# File 'lib/files.com/models/support_request.rb', line 35

def comment=(value)
  @attributes[:comment] = value
end

#customer_success_accessObject

string - Enable Customer Success access to your user account?



40
41
42
# File 'lib/files.com/models/support_request.rb', line 40

def customer_success_access
  @attributes[:customer_success_access]
end

#customer_success_access=(value) ⇒ Object



44
45
46
# File 'lib/files.com/models/support_request.rb', line 44

def customer_success_access=(value)
  @attributes[:customer_success_access] = value
end

#emailObject

string - Email address of the user requesting support.



58
59
60
# File 'lib/files.com/models/support_request.rb', line 58

def email
  @attributes[:email]
end

#email=(value) ⇒ Object



62
63
64
# File 'lib/files.com/models/support_request.rb', line 62

def email=(value)
  @attributes[:email] = value
end

#idObject

int64 - ID



13
14
15
# File 'lib/files.com/models/support_request.rb', line 13

def id
  @attributes[:id]
end

#id=(value) ⇒ Object



17
18
19
# File 'lib/files.com/models/support_request.rb', line 17

def id=(value)
  @attributes[:id] = value
end

#priorityObject

string - Priority. Can be ‘low` (e.g. general or billing/acount questions), `normal` (e.g. the system is impaired), `high` (e.g. a production workflow or business process is impaired), `urgent` (e.g. a production workflow or business process is down), `critical` (e.g. a business-critical workflow or business process is down)



49
50
51
# File 'lib/files.com/models/support_request.rb', line 49

def priority
  @attributes[:priority]
end

#priority=(value) ⇒ Object



53
54
55
# File 'lib/files.com/models/support_request.rb', line 53

def priority=(value)
  @attributes[:priority] = value
end

#saveObject



75
76
77
78
79
80
81
82
# File 'lib/files.com/models/support_request.rb', line 75

def save
  if @attributes[:id]
    raise NotImplementedError.new("The SupportRequest object doesn't support updates.")
  else
    new_obj = SupportRequest.create(@attributes, @options)
    @attributes = new_obj.attributes
  end
end

#subjectObject

string - Subject of the support request.



22
23
24
# File 'lib/files.com/models/support_request.rb', line 22

def subject
  @attributes[:subject]
end

#subject=(value) ⇒ Object



26
27
28
# File 'lib/files.com/models/support_request.rb', line 26

def subject=(value)
  @attributes[:subject] = value
end