Class: Files::CrashReport

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of CrashReport.



7
8
9
10
# File 'lib/files.com/models/crash_report.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/crash_report.rb', line 5

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Class Method Details

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

Parameters:

build (required) - string
platform (required) - string
product_name (required) - string
version (required) - string
comment - string
email - string
platform_version - string
release_channel - string


111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/files.com/models/crash_report.rb', line 111

def self.create(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: build must be an String") if params.dig(:build) and !params.dig(:build).is_a?(String)
  raise InvalidParameterError.new("Bad parameter: platform must be an String") if params.dig(:platform) and !params.dig(:platform).is_a?(String)
  raise InvalidParameterError.new("Bad parameter: product_name must be an String") if params.dig(:product_name) and !params.dig(:product_name).is_a?(String)
  raise InvalidParameterError.new("Bad parameter: version must be an String") if params.dig(:version) and !params.dig(:version).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: email must be an String") if params.dig(:email) and !params.dig(:email).is_a?(String)
  raise InvalidParameterError.new("Bad parameter: platform_version must be an String") if params.dig(:platform_version) and !params.dig(:platform_version).is_a?(String)
  raise InvalidParameterError.new("Bad parameter: release_channel must be an String") if params.dig(:release_channel) and !params.dig(:release_channel).is_a?(String)
  raise MissingParameterError.new("Parameter missing: build") unless params.dig(:build)
  raise MissingParameterError.new("Parameter missing: platform") unless params.dig(:platform)
  raise MissingParameterError.new("Parameter missing: product_name") unless params.dig(:product_name)
  raise MissingParameterError.new("Parameter missing: version") unless params.dig(:version)

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

Instance Method Details

#buildObject

string



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

def build
  @attributes[:build]
end

#build=(value) ⇒ Object



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

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

#commentObject

string



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

def comment
  @attributes[:comment]
end

#comment=(value) ⇒ Object



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

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

#emailObject

string



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

def email
  @attributes[:email]
end

#email=(value) ⇒ Object



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

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

#idObject

int64 - Crash Report ID



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

def id
  @attributes[:id]
end

#id=(value) ⇒ Object



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

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

#platformObject

string



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

def platform
  @attributes[:platform]
end

#platform=(value) ⇒ Object



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

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

#platform_versionObject

string



76
77
78
# File 'lib/files.com/models/crash_report.rb', line 76

def platform_version
  @attributes[:platform_version]
end

#platform_version=(value) ⇒ Object



80
81
82
# File 'lib/files.com/models/crash_report.rb', line 80

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

#product_nameObject

string



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

def product_name
  @attributes[:product_name]
end

#product_name=(value) ⇒ Object



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

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

#release_channelObject

string



85
86
87
# File 'lib/files.com/models/crash_report.rb', line 85

def release_channel
  @attributes[:release_channel]
end

#release_channel=(value) ⇒ Object



89
90
91
# File 'lib/files.com/models/crash_report.rb', line 89

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

#saveObject



93
94
95
96
97
98
99
100
# File 'lib/files.com/models/crash_report.rb', line 93

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

#versionObject

string



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

def version
  @attributes[:version]
end

#version=(value) ⇒ Object



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

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