pato-client 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ ['setor_active_record', 'pato_client'].each do |file|
2
+ require File.expand_path(File.dirname(__FILE__) + "/pato_client/#{file}")
3
+ end
4
+
@@ -0,0 +1,8 @@
1
+ module PatoClient
2
+ class Config
3
+ class << self
4
+ attr_accessor :setor_uri, :authorization_token
5
+ end
6
+ end
7
+ end
8
+
@@ -0,0 +1,25 @@
1
+ require 'restfulie'
2
+
3
+ module PatoClient
4
+ module SetorActiveRecord
5
+ def usar_como_setor(campo)
6
+ define_method campo do
7
+ resource = Restfulie.at("%s/%s?auth_token=%s" % [
8
+ PatoClient::Config.setor_uri, self.send("#{campo}_id"),
9
+ PatoClient::Config.authorization_token]).get.resource
10
+ resource['setor']['descricao']
11
+ end
12
+ end
13
+ end
14
+
15
+ class Setor
16
+ def self.todos
17
+ resource = Restfulie.at("%s?auth_token=%s" % [PatoClient::Config.setor_uri,
18
+ PatoClient::Config.authorization_token]).get.resource
19
+ resource['setores']
20
+ end
21
+ end
22
+ end
23
+
24
+ ActiveRecord::Base.extend PatoClient::SetorActiveRecord
25
+
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pato-client
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.0
6
+ platform: ruby
7
+ authors:
8
+ - "Rodrigo Manh\xC3\xA3es"
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-07-01 00:00:00 -03:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: restfulie
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ~>
23
+ - !ruby/object:Gem::Version
24
+ version: 1.0.0
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ description: Cliente do Pato
28
+ email: rod@uenf.com
29
+ executables: []
30
+
31
+ extensions: []
32
+
33
+ extra_rdoc_files: []
34
+
35
+ files:
36
+ - lib/pato_client/setor_active_record.rb
37
+ - lib/pato_client/pato_client.rb
38
+ - lib/pato-client.rb
39
+ has_rdoc: true
40
+ homepage: ""
41
+ licenses: []
42
+
43
+ post_install_message:
44
+ rdoc_options:
45
+ - --charset=UTF-8
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: "0"
60
+ requirements: []
61
+
62
+ rubyforge_project:
63
+ rubygems_version: 1.6.2
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: "Cliente dos servi\xC3\xA7os Pato"
67
+ test_files: []
68
+