ifd_tools 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -40,7 +40,7 @@ A special helper method is provided on the `ApiController` class to facilitate e
40
40
  include IfdTools::ApiControllerExtensions
41
41
 
42
42
  create_customer do |customer|
43
- # customer = Customer.new(params[:customer]) already passed in to us, just handle special use cases for data transformations
43
+ # customer = Customer.new(params[:request][:customer]) already passed in to us, just handle special use cases for data transformations
44
44
  customer.account_level = CustomerAccountLevel.find_by_abbreviation(params[:account_level])
45
45
  customer
46
46
  end
@@ -9,8 +9,8 @@ class ApiController < ApplicationController
9
9
  # The return value of this block will be assigned back to the
10
10
  # @customer ivar, which is used to generate the HTTP response (validations failed, etc)
11
11
  #
12
- # The request must be to "/api/create_customer" and the params namespaced under "params[:customer]"
13
- # If you have special params that will throw exception if passed to Customer.new(params[:customer]), for example params[:customer][:account_level]
12
+ # The request must be to "/api/create_customer" and the params namespaced under "params[:request][:customer]"
13
+ # If you have special params that will throw exception if passed to Customer.new(params[:request][:customer]), for example params[:request][:customer][:account_level]
14
14
  # then you should move that special attribute outside of the :customer hash & process it separately
15
15
  #
16
16
  create_customer do |customer|
@@ -19,11 +19,11 @@ class ApiController < ApplicationController
19
19
  #
20
20
  # "customer" is initially set to this before it is passed into this block
21
21
  # "customer" is also available as @customer
22
- # customer = Customer.new params[:customer]
22
+ # customer = Customer.new params[:request][:customer]
23
23
 
24
24
  # Example request
25
25
  # To make use of some parameter that's not directly an attribute, for example :account_level
26
- # Just make sure that :account_level is outside of the params[:customer] hash
26
+ # Just make sure that :account_level is outside of the params[:request][:customer] hash
27
27
  #
28
28
  # customer.account_level = CustomerAccountLevel.find_by_abbreviation(params[:account_level])
29
29
 
@@ -5,8 +5,8 @@ module IfdTools
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  def create_customer
8
- if params[:customer]
9
- @customer = Customer.new params[:customer]
8
+ if params[:request][:customer]
9
+ @customer = Customer.new params[:request][:customer]
10
10
  @customer = instance_exec @customer, &self.class.create_customer_block
11
11
  if @customer.valid?
12
12
  @customer.save
@@ -1,3 +1,3 @@
1
1
  module IfdTools
2
- VERSION = "0.1.9"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ifd_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-17 00:00:00.000000000 Z
12
+ date: 2012-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails