Class: Paperlex::Contract::Responses

Inherits:
Base
  • Object
show all
Defined in:
lib/paperlex/contract/responses.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

[], delete, get, parse, post, put, #to_uuid

Constructor Details

#initialize(contract_uuid) ⇒ Responses

Returns a new instance of Responses.



6
7
8
# File 'lib/paperlex/contract/responses.rb', line 6

def initialize(contract_uuid)
  @contract_uuid = contract_uuid
end

Instance Attribute Details

#contract_uuidObject (readonly)

Returns the value of attribute contract_uuid.



4
5
6
# File 'lib/paperlex/contract/responses.rb', line 4

def contract_uuid
  @contract_uuid
end

Instance Method Details

#allObject



10
11
12
# File 'lib/paperlex/contract/responses.rb', line 10

def all
  self.class.get(collection_url)
end

#destroy(key) ⇒ Object



26
27
28
# File 'lib/paperlex/contract/responses.rb', line 26

def destroy(key)
  self.class.delete(url_for(key))
end

#find(key) ⇒ Object



18
19
20
# File 'lib/paperlex/contract/responses.rb', line 18

def find(key)
  self.class.get(url_for(key)).first
end

#update(key, value) ⇒ Object



22
23
24
# File 'lib/paperlex/contract/responses.rb', line 22

def update(key, value)
  self.class.put(url_for(key), {:value => value})
end

#update_all(responses) ⇒ Object



14
15
16
# File 'lib/paperlex/contract/responses.rb', line 14

def update_all(responses)
  self.class.post(collection_url, {:responses => responses})
end