Class: Asana::Resources::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/checkoff/monkeypatches/resource_marshalling.rb

Overview

Public: The base resource class which provides some sugar over common resource functionality.

Instance Method Summary collapse

Instance Method Details

#marshal_dumpHash

Returns:

  • (Hash)


23
24
25
26
# File 'lib/checkoff/monkeypatches/resource_marshalling.rb', line 23

def marshal_dump
  { 'data' => @_data,
    'client' => @_client }
end

#marshal_load(data) ⇒ void

This method returns an undefined value.

Parameters:

  • data (Hash)


31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/checkoff/monkeypatches/resource_marshalling.rb', line 31

def marshal_load(data)
  # @sg-ignore
  # @type [Asana::Client]
  @_client = data.fetch('client')
  # @sg-ignore
  # @type [Hash]
  @_data = data.fetch('data')
  @_data.each do |k, v|
    if respond_to?(k)
      variable = :"@#{k}"
      instance_variable_set(variable, v)
    end
  end
end