Class: Rel

Inherits:
Object
  • Object
show all
Defined in:
lib/rel/model.rb,
lib/rel.rb

Overview

Mapper for Bandicoot relations.

Defined Under Namespace

Classes: Client, Model

Constant Summary collapse

VERSION =
"0.0.1"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url = "http://localhost:12345") ⇒ Rel

Returns a new instance of Rel.



35
36
37
38
# File 'lib/rel.rb', line 35

def initialize(url = "http://localhost:12345")
  url = URI.parse(url)
  @client = Client.new(url.host, url.port)
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



33
34
35
# File 'lib/rel.rb', line 33

def client
  @client
end

Instance Method Details

#get(fn) ⇒ Object



40
41
42
# File 'lib/rel.rb', line 40

def get(fn)
  _csv_to_hashes(client.get(fn))
end

#post(fn, hashes) ⇒ Object



44
45
46
# File 'lib/rel.rb', line 44

def post(fn, hashes)
  _csv_to_hashes(client.post(fn, _hashes_to_csv(hashes.dup)))
end