ifd_tools 0.2.6 → 0.2.7
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.
@@ -26,6 +26,14 @@ class ApiController < ApplicationController
|
|
26
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
|
+
|
30
|
+
# Customizing the JSON/XML responses on success
|
31
|
+
#
|
32
|
+
# You have no control over what the response is when there is a failure (that's provided via ActiveRecord validations)
|
33
|
+
# However, you can customize the response on a successfuly registration (no validation errors)
|
34
|
+
#
|
35
|
+
# @response = { first_name: customer.first_name, auth_token: customer.authentication_token }
|
36
|
+
# The @response object will be used in generating a response, if provided
|
29
37
|
|
30
38
|
customer
|
31
39
|
end
|
@@ -8,11 +8,12 @@ module IfdTools
|
|
8
8
|
if params[:request][:customer]
|
9
9
|
@customer = Customer.new params[:request][:customer]
|
10
10
|
@customer = instance_exec @customer, &self.class.create_customer_block
|
11
|
-
if @customer.
|
12
|
-
@customer.save
|
11
|
+
if @customer.save
|
13
12
|
respond_to do |format|
|
14
|
-
|
15
|
-
|
13
|
+
response = { success: "Registered" }
|
14
|
+
response.merge! @response if @response
|
15
|
+
format.json { render json: response, status: :ok }
|
16
|
+
format.xml { render xml: response, status: :ok }
|
16
17
|
end
|
17
18
|
else
|
18
19
|
respond_to do |format|
|
data/lib/ifd_tools/version.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.7
|
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:
|
12
|
+
date: 2013-01-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -460,7 +460,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
460
460
|
version: '0'
|
461
461
|
segments:
|
462
462
|
- 0
|
463
|
-
hash:
|
463
|
+
hash: 2521405696788137394
|
464
464
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
465
465
|
none: false
|
466
466
|
requirements:
|
@@ -469,7 +469,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
469
469
|
version: '0'
|
470
470
|
segments:
|
471
471
|
- 0
|
472
|
-
hash:
|
472
|
+
hash: 2521405696788137394
|
473
473
|
requirements: []
|
474
474
|
rubyforge_project:
|
475
475
|
rubygems_version: 1.8.24
|