Class: VLC360::Work

Inherits:
Resource show all
Includes:
APIOperations::Save, APIResource
Defined in:
lib/vlc360/work.rb

Constant Summary collapse

SAVE_URL =
'/api/customerPortalWebServices/work'

Instance Attribute Summary

Attributes inherited from Resource

#errors

Instance Method Summary collapse

Methods included from APIOperations::Save

#save

Methods included from APIResource

included

Methods inherited from Resource

attributes, nested_resource, nested_resources, new_from_hash, #set_attributes, #to_hash, #valid?

Constructor Details

#initialize(attributes = {}) ⇒ Work

Returns a new instance of Work.



15
16
17
18
19
# File 'lib/vlc360/work.rb', line 15

def initialize(attributes = {})
  @id = -1

  super
end

Instance Method Details

#persisted?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/vlc360/work.rb', line 21

def persisted?
  @id != -1
end

#process_response(data) ⇒ Object



25
26
27
28
29
# File 'lib/vlc360/work.rb', line 25

def process_response(data)
  super(data).tap do |result|
    @id = data.parsed_response['ServiceID'] if result
  end
end