authorizenet 1.8.1 → 1.8.2
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.
- checksums.yaml +4 -4
- data/lib/authorize_net.rb +5 -0
- data/lib/authorize_net.rb~ +95 -0
- data/lib/authorize_net/aim/response.rb~ +131 -0
- data/lib/authorize_net/arb/fields.rb +24 -0
- data/lib/authorize_net/arb/fields.rb~ +13 -0
- data/lib/authorize_net/arb/paging.rb +33 -0
- data/lib/authorize_net/arb/paging.rb~ +25 -0
- data/lib/authorize_net/arb/response.rb~ +68 -0
- data/lib/authorize_net/arb/sorting.rb +43 -0
- data/lib/authorize_net/arb/sorting.rb~ +43 -0
- data/lib/authorize_net/arb/subscription.rb +5 -5
- data/lib/authorize_net/arb/subscription_detail.rb +14 -0
- data/lib/authorize_net/arb/subscription_detail.rb~ +56 -0
- data/lib/authorize_net/arb/subscription_list_response.rb +43 -0
- data/lib/authorize_net/arb/subscription_list_response.rb~ +45 -0
- data/lib/authorize_net/arb/transaction.rb +35 -4
- data/lib/authorize_net/arb/transaction.rb~ +176 -0
- data/lib/authorize_net/fields.rb +21 -3
- data/lib/authorize_net/fields.rb~ +767 -0
- data/lib/authorize_net/key_value_transaction.rb +0 -2
- data/lib/authorize_net/payment_methods/credit_card.rb +20 -32
- data/lib/authorize_net/xml_response.rb~ +173 -0
- data/lib/authorize_net/xml_transaction.rb +5 -5
- data/lib/authorize_net/xml_transaction.rb~ +276 -0
- data/lib/generators/authorize_net/{direct_post_generator.rb → direct_post/direct_post_generator.rb} +4 -2
- data/lib/generators/authorize_net/direct_post/templates/README-AuthorizeNet +49 -0
- data/lib/generators/authorize_net/direct_post/templates/config.yml.erb +8 -0
- data/lib/generators/authorize_net/direct_post/templates/config.yml.rails3.erb +8 -0
- data/lib/generators/authorize_net/direct_post/templates/controller.rb.erb +31 -0
- data/lib/generators/authorize_net/direct_post/templates/initializer.rb +4 -0
- data/lib/generators/authorize_net/direct_post/templates/layout.erb +18 -0
- data/lib/generators/authorize_net/direct_post/templates/payment.erb +10 -0
- data/lib/generators/authorize_net/direct_post/templates/payment.rails3.erb +10 -0
- data/lib/generators/authorize_net/direct_post/templates/receipt.erb +1 -0
- data/lib/generators/authorize_net/direct_post/templates/relay_response.erb +1 -0
- data/lib/generators/authorize_net/{sim_generator.rb → sim/sim_generator.rb} +2 -2
- data/lib/generators/authorize_net/sim/templates/README-AuthorizeNet +52 -0
- data/lib/generators/authorize_net/sim/templates/config.yml.erb +8 -0
- data/lib/generators/authorize_net/sim/templates/config.yml.rails3.erb +8 -0
- data/lib/generators/authorize_net/sim/templates/controller.rb.erb +21 -0
- data/lib/generators/authorize_net/sim/templates/initializer.rb +4 -0
- data/lib/generators/authorize_net/sim/templates/layout.erb +18 -0
- data/lib/generators/authorize_net/sim/templates/payment.erb +6 -0
- data/lib/generators/authorize_net/sim/templates/payment.rails3.erb +6 -0
- data/lib/generators/authorize_net/sim/templates/thank_you.erb +1 -0
- data/lib/generators/generator_extensions.rb +75 -0
- metadata +41 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff5759dc180906c1a4e49eaa3806666c21e97d80
|
4
|
+
data.tar.gz: 8f68a83f8feb9df35fbbf41c5802666c3a0dd451
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ff763839bf9cc2f6fda6f0a4ac93e86ed93c6d9774af353d8f79a9a398f8a20e2894ad928c16b5810f6f10ebbf8775bbaca08fce87c06f0a346107849dccb65
|
7
|
+
data.tar.gz: 5bdf56b8ffa4586f9a93d964147d167b9e644a1b9eb57948184713d9f91ee6c83612180c35f3e8064a7fa89d8341e1539746fae527fdffad85097d18acb60201
|
data/lib/authorize_net.rb
CHANGED
@@ -52,6 +52,11 @@ require "authorize_net/sim/response"
|
|
52
52
|
|
53
53
|
# ARB
|
54
54
|
|
55
|
+
require "authorize_net/arb/paging"
|
56
|
+
require "authorize_net/arb/sorting"
|
57
|
+
require "authorize_net/arb/subscription_list_response"
|
58
|
+
require "authorize_net/arb/subscription_detail"
|
59
|
+
require "authorize_net/arb/fields"
|
55
60
|
require "authorize_net/arb/subscription"
|
56
61
|
require "authorize_net/arb/response"
|
57
62
|
require "authorize_net/arb/transaction"
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# The SDK initialization enters here. Loads all needed libraries and files. Inspects
|
2
|
+
# the current runtime to see if Rails is present. If it is, we inject our helper into
|
3
|
+
# ActiveSupport.
|
4
|
+
|
5
|
+
require "cgi"
|
6
|
+
require "net/https"
|
7
|
+
require "uri"
|
8
|
+
require "openssl"
|
9
|
+
require 'bigdecimal'
|
10
|
+
require 'nokogiri'
|
11
|
+
require 'date'
|
12
|
+
|
13
|
+
# TODO: Add local data validation where possible
|
14
|
+
|
15
|
+
$:.unshift File.dirname(__FILE__)
|
16
|
+
|
17
|
+
require "authorize_net/authorize_net"
|
18
|
+
require "authorize_net/payment_methods/credit_card"
|
19
|
+
require "authorize_net/payment_methods/echeck"
|
20
|
+
require "authorize_net/addresses/address"
|
21
|
+
require "authorize_net/addresses/shipping_address"
|
22
|
+
require "authorize_net/customer"
|
23
|
+
require "authorize_net/email_receipt"
|
24
|
+
require "authorize_net/order"
|
25
|
+
require "authorize_net/line_item"
|
26
|
+
require "authorize_net/cim/payment_profile"
|
27
|
+
require "authorize_net/cim/customer_profile"
|
28
|
+
require "authorize_net/reporting/batch"
|
29
|
+
require "authorize_net/reporting/batch_statistics"
|
30
|
+
require "authorize_net/reporting/transaction_details"
|
31
|
+
require "authorize_net/reporting/fds_filter"
|
32
|
+
require "authorize_net/reporting/returned_item"
|
33
|
+
require "authorize_net/response"
|
34
|
+
require "authorize_net/key_value_response"
|
35
|
+
require "authorize_net/xml_response"
|
36
|
+
require "authorize_net/transaction"
|
37
|
+
require "authorize_net/key_value_transaction"
|
38
|
+
require "authorize_net/xml_transaction"
|
39
|
+
require "authorize_net/fields"
|
40
|
+
|
41
|
+
# AIM
|
42
|
+
|
43
|
+
require "authorize_net/aim/transaction"
|
44
|
+
require "authorize_net/aim/response"
|
45
|
+
|
46
|
+
# SIM
|
47
|
+
|
48
|
+
require "authorize_net/sim/hosted_payment_form"
|
49
|
+
require "authorize_net/sim/hosted_receipt_page"
|
50
|
+
require "authorize_net/sim/transaction"
|
51
|
+
require "authorize_net/sim/response"
|
52
|
+
|
53
|
+
# ARB
|
54
|
+
|
55
|
+
require "authorize_net/arb/subscription_detail"
|
56
|
+
require "authorize_net/arb/fields"
|
57
|
+
require "authorize_net/arb/subscription"
|
58
|
+
require "authorize_net/arb/response"
|
59
|
+
require "authorize_net/arb/transaction"
|
60
|
+
|
61
|
+
# CIM
|
62
|
+
|
63
|
+
require "authorize_net/cim/response"
|
64
|
+
require "authorize_net/cim/transaction"
|
65
|
+
|
66
|
+
# Reporting
|
67
|
+
|
68
|
+
require "authorize_net/reporting/response"
|
69
|
+
require "authorize_net/reporting/transaction"
|
70
|
+
|
71
|
+
# Load our Rails plugin
|
72
|
+
|
73
|
+
if defined?(Rails)
|
74
|
+
if defined?(Rails::Railtie)
|
75
|
+
module AuthorizeNet
|
76
|
+
class Railtie < Rails::Railtie
|
77
|
+
initializer "authorize_net.load_path_initialize" do |app|
|
78
|
+
%w{ models controllers helpers }.each do |dir|
|
79
|
+
path = File.join(File.dirname(__FILE__), 'app', dir)
|
80
|
+
$LOAD_PATH << path
|
81
|
+
ActiveSupport::Dependencies.autoload_paths << path
|
82
|
+
ActiveSupport::Dependencies.autoload_once_paths.delete(path)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
else
|
88
|
+
%w{ models controllers helpers }.each do |dir|
|
89
|
+
path = File.join(File.dirname(__FILE__), 'app', dir)
|
90
|
+
$LOAD_PATH << path
|
91
|
+
ActiveSupport::Dependencies.load_paths << path
|
92
|
+
ActiveSupport::Dependencies.load_once_paths.delete(path)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
module AuthorizeNet::AIM
|
2
|
+
|
3
|
+
# The AIM response class. Handles parsing the response from the gateway.
|
4
|
+
class Response < AuthorizeNet::KeyValueResponse
|
5
|
+
|
6
|
+
# Our MD5 digest generator.
|
7
|
+
@@digest = OpenSSL::Digest.new('md5')
|
8
|
+
|
9
|
+
include AuthorizeNet::AIM::Fields
|
10
|
+
|
11
|
+
# Fields to convert to/from booleans.
|
12
|
+
@@boolean_fields = [:tax_exempt]
|
13
|
+
|
14
|
+
# Fields to convert to/from BigDecimal.
|
15
|
+
@@decimal_fields = [:amount, :tax, :freight, :duty, :requested, :balance_on_card]
|
16
|
+
|
17
|
+
|
18
|
+
# Constructs a new response object from a +raw_response+ and the +transaction+ that generated
|
19
|
+
# the +raw_response+. You don't typically construct this object yourself, as AuthorizeNet::AIM::Transaction
|
20
|
+
# will build one for you when it makes the request to the gateway.
|
21
|
+
def initialize(raw_response, transaction)
|
22
|
+
@version = transaction.version
|
23
|
+
raise "AuthorizeNet gem only supports AIM version 3.1" unless @version.to_s == '3.1'
|
24
|
+
@raw_response = raw_response
|
25
|
+
@fields = {}
|
26
|
+
@transaction = transaction
|
27
|
+
custom_field_names = transaction.custom_fields.keys.collect(&:to_s).sort.collect(&:to_sym)
|
28
|
+
@custom_fields = {}
|
29
|
+
split_on = transaction.delimiter
|
30
|
+
if @raw_response.kind_of?(Net::HTTPOK) || @raw_response.kind_of?(Nokogiri::XML::Element)
|
31
|
+
if @raw_response.kind_of?(Net::HTTPOK)
|
32
|
+
raw_data = @raw_response.body
|
33
|
+
else
|
34
|
+
raw_data = @raw_response.text
|
35
|
+
end
|
36
|
+
unless transaction.encapsulation_character.nil?
|
37
|
+
split_on = transaction.encapsulation_character + split_on + transaction.encapsulation_character
|
38
|
+
raw_data = raw_data[1..raw_data.length - 2]
|
39
|
+
end
|
40
|
+
raw_data.split(split_on).each_with_index do |field, index|
|
41
|
+
if transaction.cp_version.nil?
|
42
|
+
field_desc = FIELDS
|
43
|
+
else
|
44
|
+
field_desc = CP_FIELDS
|
45
|
+
end
|
46
|
+
if index < field_desc.length
|
47
|
+
@fields[field_desc[index]] = field
|
48
|
+
else
|
49
|
+
@custom_fields[custom_field_names[index - field_desc.length]] = field
|
50
|
+
end
|
51
|
+
end
|
52
|
+
@fields.delete(nil)
|
53
|
+
@fields.each do |k, v|
|
54
|
+
if @@boolean_fields.include?(k)
|
55
|
+
@fields[k] = value_to_boolean(v)
|
56
|
+
elsif @@decimal_fields.include?(k)
|
57
|
+
@fields[k] = value_to_decimal(v)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# Returns True if the MD5 hash found in the response payload validates using
|
64
|
+
# the supplied api_login and secret merchant_value (THIS IS NOT YOUR API KEY).
|
65
|
+
def valid_md5?(api_login, merchant_value)
|
66
|
+
if @fields[:md5_hash].nil?
|
67
|
+
return false
|
68
|
+
end
|
69
|
+
@@digest.hexdigest("#{merchant_value}#{api_login}#{@fields[:transaction_id]}#{@transaction.fields[:amount]}").downcase == @fields[:md5_hash].downcase
|
70
|
+
end
|
71
|
+
|
72
|
+
# Returns the current API version that we are adhering to.
|
73
|
+
def version
|
74
|
+
@version
|
75
|
+
end
|
76
|
+
|
77
|
+
# Check to see if the response indicated success. Success is defined as a 200 OK response indicating
|
78
|
+
# that the transaction was approved.
|
79
|
+
def success?
|
80
|
+
!connection_failure? && approved?
|
81
|
+
end
|
82
|
+
|
83
|
+
# Returns true if we failed to open a connection to the gateway or got back a non-200 OK HTTP response.
|
84
|
+
def connection_failure?
|
85
|
+
!@raw_response.kind_of?(Net::HTTPOK) && !@raw_response.kind_of?(Nokogiri::XML::Element)
|
86
|
+
end
|
87
|
+
|
88
|
+
# Returns the underlying Net::HTTPResponse object. This has the original response body along with
|
89
|
+
# headers and such. Note that if an exception is generated while making the request (which happens
|
90
|
+
# if there is no internet connection for example), you will get the exception object here instead of
|
91
|
+
# a Net::HTTPResponse object.
|
92
|
+
def raw
|
93
|
+
@raw_response
|
94
|
+
end
|
95
|
+
|
96
|
+
# Returns the AuthorizeNet::Transaction instance that owns this response.
|
97
|
+
def transaction
|
98
|
+
@transaction
|
99
|
+
end
|
100
|
+
|
101
|
+
# Returns the transaction's authorization code. This should be shown to the
|
102
|
+
# end user.
|
103
|
+
def authorization_code
|
104
|
+
@fields[:authorization_code]
|
105
|
+
end
|
106
|
+
|
107
|
+
# Returns the transaction's authorization id. You will need this for future void, refund
|
108
|
+
# and prior authorization capture requests.
|
109
|
+
def transaction_id
|
110
|
+
@fields[:transaction_id]
|
111
|
+
end
|
112
|
+
|
113
|
+
# Returns the customer id from the response.
|
114
|
+
def customer_id
|
115
|
+
@fields[:customer_id]
|
116
|
+
end
|
117
|
+
|
118
|
+
# Returns a response code (from AVSResponseCode) indicating the result of any Address Verification
|
119
|
+
# Service checks.
|
120
|
+
def avs_response
|
121
|
+
@fields[:avs_response]
|
122
|
+
end
|
123
|
+
|
124
|
+
# Returns the credit card type used in the transaction. The values returned can be found in CardType.
|
125
|
+
def card_type
|
126
|
+
@fields[:card_type]
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module AuthorizeNet::ARB
|
2
|
+
module Fields
|
3
|
+
EntityDescription = Struct.new(:node_structure, :entity_class, :arg_mapping)
|
4
|
+
|
5
|
+
SUBSCRIPTION_DETAIL_ENTITY_DESCRIPTION = EntityDescription.new(
|
6
|
+
[
|
7
|
+
{:id => :id},
|
8
|
+
{:name => :name},
|
9
|
+
{:status => :status},
|
10
|
+
{:createTimeStampUTC => :create_time_stamp_utc},
|
11
|
+
{:firstName => :first_name},
|
12
|
+
{:lastName => :last_name},
|
13
|
+
{:totalOccurrences => :total_occurrences},
|
14
|
+
{:pastOccurrences => :past_occurrences},
|
15
|
+
{:paymentMethod => :payment_method},
|
16
|
+
{:accountNumber => :account_number},
|
17
|
+
{:invoice => :invoice},
|
18
|
+
{:amount => :amount},
|
19
|
+
{:currencyId => :currency_id}
|
20
|
+
],
|
21
|
+
AuthorizeNet::ARB::SubscriptionDetail
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module AuthorizeNet::ARB
|
2
|
+
module Fields
|
3
|
+
EntityDescription = Struct.new(:node_structure, :entity_class, :arg_mapping)
|
4
|
+
|
5
|
+
SUBSCRIPTION_DETAIL_ENTITY_DESCRIPTION = EntityDescription.new(
|
6
|
+
[
|
7
|
+
{:id => :id},
|
8
|
+
{:name => :name}
|
9
|
+
],
|
10
|
+
AuthorizeNet::ARB::SubscriptionDetail
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module AuthorizeNet::ARB
|
2
|
+
|
3
|
+
class Paging
|
4
|
+
|
5
|
+
# Models Paging
|
6
|
+
include AuthorizeNet::Model
|
7
|
+
|
8
|
+
attr_accessor :offset,:limit
|
9
|
+
|
10
|
+
# Initializes Paging object.
|
11
|
+
#
|
12
|
+
# Typical usage:
|
13
|
+
# paging = AuthorizeNet::ARB::Paging.new(1,1000)
|
14
|
+
#
|
15
|
+
# Valid values for offset: 1 to 100000
|
16
|
+
# Valid values for limit: 1 to 1000
|
17
|
+
#
|
18
|
+
def initialize(offset,limit)
|
19
|
+
@offset = offset
|
20
|
+
@limit = limit
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_hash
|
24
|
+
hash = {
|
25
|
+
:offset => @offset,
|
26
|
+
:limit => @limit
|
27
|
+
}
|
28
|
+
hash.delete_if {|k, v| v.nil?}
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module AuthorizeNet::ARB
|
2
|
+
|
3
|
+
class Paging
|
4
|
+
|
5
|
+
# Models Paging
|
6
|
+
include AuthorizeNet::Model
|
7
|
+
|
8
|
+
attr_accessor :offset,:limit
|
9
|
+
|
10
|
+
def initialize(offset,limit)
|
11
|
+
@offset = offset
|
12
|
+
@limit = limit
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_hash
|
16
|
+
hash = {
|
17
|
+
:offset => @offset,
|
18
|
+
:limit => @limit
|
19
|
+
}
|
20
|
+
hash.delete_if {|k, v| v.nil?}
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module AuthorizeNet::ARB
|
2
|
+
|
3
|
+
# The ARB response class.
|
4
|
+
class Response < AuthorizeNet::XmlResponse
|
5
|
+
# Constructs a new response object from a +raw_response. You don't typically
|
6
|
+
# construct this object yourself, as AuthorizeNet::ARB::Transaction will
|
7
|
+
# build one for you when it makes the request to the gateway.
|
8
|
+
def initialize(raw_response, transaction)
|
9
|
+
super
|
10
|
+
unless connection_failure?
|
11
|
+
begin
|
12
|
+
@subscription_id = node_content_unless_nil(@root.at_css('subscriptionId'))
|
13
|
+
@subscription_status = node_content_unless_nil(@root.at_css('Status'))
|
14
|
+
|
15
|
+
rescue
|
16
|
+
@raw_response = $!
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Returns the subscriptionId from the response if there is one. Otherwise returns nil.
|
22
|
+
def subscription_id
|
23
|
+
@subscription_id
|
24
|
+
end
|
25
|
+
|
26
|
+
# Returns the status of the Subscription from the response if there is one. Otherwise returns nil. This value
|
27
|
+
# is only returned in response to a get_status transaction.
|
28
|
+
def subscription_status
|
29
|
+
@subscription_status
|
30
|
+
end
|
31
|
+
|
32
|
+
end #Response
|
33
|
+
|
34
|
+
class SubscriptionListResponse < AuthorizeNet::XmlResponse
|
35
|
+
def initialize(raw_response, transaction)
|
36
|
+
super
|
37
|
+
unless connection_failure?
|
38
|
+
begin
|
39
|
+
@subscription_details = @root.at_css('subscriptionDetails')
|
40
|
+
@subscription_detail = @root.at_css('subscriptionDetail')
|
41
|
+
@total_num_in_resultset = node_content_unless_nil(@root.at_css('totalNumInResultSet'))
|
42
|
+
|
43
|
+
rescue
|
44
|
+
@raw_response = $!
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def total_num_in_resultset
|
50
|
+
@total_num_in_resultset
|
51
|
+
end
|
52
|
+
|
53
|
+
# Returns an Array of SubscriptionDetail objects built from the entities returned in the response. Returns nil if no subscriptions were returned.
|
54
|
+
def subscription_details
|
55
|
+
unless @subscription_details.nil?
|
56
|
+
subscription_details = []
|
57
|
+
@subscription_details.element_children.each do |child|
|
58
|
+
unless child.nil?
|
59
|
+
subscription_detail = build_entity(child, Fields::SUBSCRIPTION_DETAIL_ENTITY_DESCRIPTION)
|
60
|
+
|
61
|
+
subscription_details <<= subscription_detail
|
62
|
+
end
|
63
|
+
end
|
64
|
+
return subscription_details unless subscription_details.length == 0
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end #SubscriptionListResponse
|
68
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module AuthorizeNet::ARB
|
2
|
+
|
3
|
+
class Sorting
|
4
|
+
|
5
|
+
# Models Sorting
|
6
|
+
include AuthorizeNet::Model
|
7
|
+
|
8
|
+
attr_accessor :order_by, :order_descending
|
9
|
+
|
10
|
+
# Initializes Sorting object.
|
11
|
+
#
|
12
|
+
# Typical usage:
|
13
|
+
# sorting = AuthorizeNet::ARB::Sorting.new('name',true)
|
14
|
+
#
|
15
|
+
# Valid values for order_by values of the AuthorizeNet::ARB::Sorting:
|
16
|
+
# id
|
17
|
+
# name
|
18
|
+
# status
|
19
|
+
# createTimeStampUTC
|
20
|
+
# lastName
|
21
|
+
# firstName
|
22
|
+
# accountNumber
|
23
|
+
# amount
|
24
|
+
# pastOccurrences
|
25
|
+
#
|
26
|
+
# Valid values for order_descending: true, false, 1, 0
|
27
|
+
#
|
28
|
+
def initialize(order_by, order_descending)
|
29
|
+
@order_by = order_by
|
30
|
+
@order_descending = order_descending
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_hash
|
34
|
+
hash = {
|
35
|
+
:order_by => @order_by,
|
36
|
+
:order_descending => @order_descending
|
37
|
+
}
|
38
|
+
hash.delete_if {|k, v| v.nil?}
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|