Class: AllegroGraph::Proxy::Mapping

Inherits:
Object
  • Object
show all
Defined in:
lib/allegro_graph/proxy/mapping.rb

Overview

The Mapping class acts as proxy to the data type mapping functions of the AllegroGraph server.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource) ⇒ Mapping

Returns a new instance of Mapping.



11
12
13
# File 'lib/allegro_graph/proxy/mapping.rb', line 11

def initialize(resource)
  @resource = resource
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



9
10
11
# File 'lib/allegro_graph/proxy/mapping.rb', line 9

def resource
  @resource
end

Instance Method Details

#create(type, encoding) ⇒ Object



19
20
21
22
23
# File 'lib/allegro_graph/proxy/mapping.rb', line 19

def create(type, encoding)
  parameters = { :type => type, :encoding => encoding }
  @resource.request_http :put, self.path + "/type", :parameters => parameters, :expected_status_code => 204
  true
end

#delete(type) ⇒ Object



25
26
27
28
29
# File 'lib/allegro_graph/proxy/mapping.rb', line 25

def delete(type)
  parameters = { :type => type }
  @resource.request_http :delete, self.path + "/type", :parameters => parameters, :expected_status_code => 204
  true
end

#pathObject



15
16
17
# File 'lib/allegro_graph/proxy/mapping.rb', line 15

def path
  "#{@resource.path}/mapping"
end