Module: RedboothRuby::Operations::Meta

Included in:
Task, TaskList
Defined in:
lib/redbooth-ruby/operations/meta.rb

Instance Method Summary collapse

Instance Method Details

#metadataHash

Returns a hash with the object metadata

Returns:

  • (Hash)

    the object metadata



7
8
9
10
11
12
# File 'lib/redbooth-ruby/operations/meta.rb', line 7

def 
  response = RedboothRuby.request(:get, nil, 'metadata',
                                  { target_id: id, target_type: klass_name },
                                  { session: session })
  response.data
end

#metadata=(hash) ⇒ Hash

Sets the given hash as the desired metadata

Returns:

  • (Hash)

    the object metadata



17
18
19
20
21
22
23
# File 'lib/redbooth-ruby/operations/meta.rb', line 17

def metadata=(hash)
  response = RedboothRuby.request(:post, nil, 'metadata',
                                  { target_id: id, target_type: klass_name, metadata: hash },
                                  { session: session })

  response.data
end

#metadata_merge(hash) ⇒ Hash

Merges the given hash with the exiting metadata and set the result

Returns:

  • (Hash)

    the object metadata



28
29
30
31
32
33
34
# File 'lib/redbooth-ruby/operations/meta.rb', line 28

def (hash)
  response = RedboothRuby.request(:put, nil, 'metadata',
                                  { target_id: id, target_type: klass_name, metadata: hash },
                                  { session: session })

  response.data
end