Class: UpGuard::ChangeRequest

Inherits:
BaseObject show all
Defined in:
lib/upguard/ChangeRequest.rb

Instance Attribute Summary collapse

Attributes inherited from BaseObject

#appliance_api_key, #appliance_url, #insecure, #sec_key

Instance Method Summary collapse

Methods inherited from BaseObject

#http_delete, #http_get, #http_post, #http_put, #make_headers

Constructor Details

#initialize(appliance_url, appliance_api_key, sec_key, insecure = false) ⇒ ChangeRequest

Returns a new instance of ChangeRequest.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/upguard/ChangeRequest.rb', line 12

def initialize(appliance_url, appliance_api_key, sec_key, insecure = false)
  super(appliance_url, appliance_api_key, sec_key, insecure)
  self.data = nil
  self.ended_at = nil
  self.external_id = nil
  self.id = nil
  self.planned_end_at = nil
  self.planned_start_at = nil
  self.short_description = nil
  self.started_at = nil
  self.url = nil
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



3
4
5
# File 'lib/upguard/ChangeRequest.rb', line 3

def data
  @data
end

#ended_atObject

Returns the value of attribute ended_at.



4
5
6
# File 'lib/upguard/ChangeRequest.rb', line 4

def ended_at
  @ended_at
end

#external_idObject

Returns the value of attribute external_id.



5
6
7
# File 'lib/upguard/ChangeRequest.rb', line 5

def external_id
  @external_id
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/upguard/ChangeRequest.rb', line 6

def id
  @id
end

#planned_end_atObject

Returns the value of attribute planned_end_at.



7
8
9
# File 'lib/upguard/ChangeRequest.rb', line 7

def planned_end_at
  @planned_end_at
end

#planned_start_atObject

Returns the value of attribute planned_start_at.



8
9
10
# File 'lib/upguard/ChangeRequest.rb', line 8

def planned_start_at
  @planned_start_at
end

#short_descriptionObject

Returns the value of attribute short_description.



9
10
11
# File 'lib/upguard/ChangeRequest.rb', line 9

def short_description
  @short_description
end

#started_atObject

Returns the value of attribute started_at.



10
11
12
# File 'lib/upguard/ChangeRequest.rb', line 10

def started_at
  @started_at
end

#urlObject

Returns the value of attribute url.



11
12
13
# File 'lib/upguard/ChangeRequest.rb', line 11

def url
  @url
end

Instance Method Details

#from_hash(h) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/upguard/ChangeRequest.rb', line 25

def from_hash(h)
  self.data = h['data'] if h.include?('data')
  self.ended_at = h['ended_at'] if h.include?('ended_at')
  self.external_id = h['external_id'] if h.include?('external_id')
  self.id = h['id'] if h.include?('id')
  self.planned_end_at = h['planned_end_at'] if h.include?('planned_end_at')
  self.planned_start_at = h['planned_start_at'] if h.include?('planned_start_at')
  self.short_description = h['short_description'] if h.include?('short_description')
  self.started_at = h['started_at'] if h.include?('started_at')
  self.url = h['url'] if h.include?('url')
end

#to_hashObject



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/upguard/ChangeRequest.rb', line 36

def to_hash
  h = {}
  h['data'] = self.data
  h['ended_at'] = self.ended_at
  h['external_id'] = self.external_id
  h['id'] = self.id
  h['planned_end_at'] = self.planned_end_at
  h['planned_start_at'] = self.planned_start_at
  h['short_description'] = self.short_description
  h['started_at'] = self.started_at
  h['url'] = self.url
  return h
end

#to_json(options = nil) ⇒ Object



49
50
51
52
# File 'lib/upguard/ChangeRequest.rb', line 49

def to_json(options = nil)
  h = to_hash
  return h.to_json(options)
end