gnoso-fafactory 0.0.2 → 0.0.3

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.
@@ -47,5 +47,22 @@ if Rails.env == "test"
47
47
  format.xml { head :ok }
48
48
  end
49
49
  end
50
+
51
+ # Find the instance of model identified by id and return it's xml.
52
+ #
53
+ # ==== Parameters
54
+ # id<Integer>:: The id of the instance to look up.
55
+ # model<String>:: The model to look up the instance for.
56
+ #
57
+ # ==== Returns
58
+ #
59
+ def find
60
+ obj = Module.const_get(params[:model].to_sym).find(params[:id])
61
+ respond_to do |format|
62
+ format.xml do
63
+ render :xml => obj
64
+ end
65
+ end
66
+ end
50
67
  end
51
68
  end
@@ -1,6 +1,7 @@
1
1
  ActionController::Routing::Routes.draw do |map|
2
2
  if Rails.env == "test"
3
3
  map.resources :fafactories, :only => [:none],
4
- :collection => { :create_instance => :post, :purge => :delete }
4
+ :collection => { :create_instance => :post, :purge => :delete,
5
+ :find => :get }
5
6
  end
6
7
  end
@@ -20,6 +20,12 @@ class Fafactory < ActiveResource::Base
20
20
  nil
21
21
  end
22
22
 
23
+ # Loads an instance of a remote model based on the id given
24
+ def self.find(service, model, id)
25
+ Fafactory.configure_site(service)
26
+ Fafactory.get(:find, { :model => model, :id => id })
27
+ end
28
+
23
29
  private
24
30
  def self.configure_site(service)
25
31
  @@fafactory_config ||= YAML.load_file('config/fafactory.yml')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gnoso-fafactory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gnoso, Inc.
@@ -36,7 +36,7 @@ files:
36
36
  - bin/fafactory
37
37
  - config/routes.rb
38
38
  has_rdoc: true
39
- homepage: http://www.gnoso.com
39
+ homepage: http://github.com/gnoso/fafactory
40
40
  licenses:
41
41
  post_install_message:
42
42
  rdoc_options: []