Module: PatoClient::SetorActiveRecord

Defined in:
lib/pato_client/setor_active_record.rb

Instance Method Summary collapse

Instance Method Details

#usar_como_setor(campo) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/pato_client/setor_active_record.rb', line 5

def usar_como_setor(campo)
  define_method campo do
    resource = Restfulie.at("%s/%s?auth_token=%s" % [
      PatoClient::Config.setor_uri, self.send("#{campo}_id"),
      PatoClient::Config.authorization_token]).get.resource
    resource['setor']['descricao']
  end
end