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

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



106
107
108
# File 'lib/files.com/models/support_request.rb', line 106

def self.all(params = {}, options = {})
  list(params, options)
end

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

Parameters:

customer_success_access - string - Enable Customer Success access to your user account?
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.
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)


116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/files.com/models/support_request.rb', line 116

def self.create(params = {}, options = {})
  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: 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: priority must be an String") if params.dig(:priority) and !params.dig(:priority).is_a?(String)
  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

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

Parameters:

page - integer - Current page number.
per_page - integer - Number of records to show per page.  (Max: 10,000, 1,000 or less is recommended).
action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.


97
98
99
100
101
102
103
104
# File 'lib/files.com/models/support_request.rb', line 97

def self.list(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)

  response, options = Api.send_request("/support_requests", :get, params, options)
  response.data.map { |object| SupportRequest.new(object, options) }
end

.update(id, params = {}, options = {}) ⇒ Object

Parameters:

customer_success_access - string - Enable Customer Success access to your user account?


132
133
134
135
136
137
138
139
140
141
# File 'lib/files.com/models/support_request.rb', line 132

def self.update(id, params = {}, options = {})
  params ||= {}
  params[:id] = id
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
  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 MissingParameterError.new("Parameter missing: id") unless params.dig(:id)

  response, options = Api.send_request("/support_requests/#{params[:id]}", :patch, params, options)
  SupportRequest.new(response.data, options)
end

Instance Method Details

#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

#created_atObject

date - When this support request was made.



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

def created_at
  @attributes[:created_at]
end

#customer_success_accessObject

string - Enable Customer Success access to your user account?



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

def customer_success_access
  @attributes[:customer_success_access]
end

#customer_success_access=(value) ⇒ Object



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

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

#emailObject

string - Email address of the user requesting support.



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

def email
  @attributes[:email]
end

#email=(value) ⇒ Object



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

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)



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

def priority
  @attributes[:priority]
end

#priority=(value) ⇒ Object



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

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

#saveObject



84
85
86
87
88
89
90
91
# File 'lib/files.com/models/support_request.rb', line 84

def save
  if @attributes[:id]
    update(@attributes)
  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

#update(params = {}) ⇒ Object

Parameters:

customer_success_access - string - Enable Customer Success access to your user account?


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

def update(params = {})
  params ||= {}
  params[:id] = @attributes[:id]
  raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
  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 MissingParameterError.new("Parameter missing: id") unless params.dig(:id)

  Api.send_request("/support_requests/#{@attributes[:id]}", :patch, params, @options)
end