foxy_sync 0.2.0 → 0.3.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.
@@ -36,6 +36,12 @@ module FoxySync::Api
|
|
36
36
|
:customer_password_salt => salt
|
37
37
|
)
|
38
38
|
end
|
39
|
-
end
|
40
39
|
|
40
|
+
|
41
|
+
#
|
42
|
+
# Returns true if FoxyCart has a record of this customer, false otherwise
|
43
|
+
def found?
|
44
|
+
!(api_response.message =~ /Customer Found/i).nil?
|
45
|
+
end
|
46
|
+
end
|
41
47
|
end
|
data/lib/foxy_sync/datafeed.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
module FoxySync::Xml
|
2
|
+
#
|
3
|
+
# Encapsulates FoxyCart's transaction XML datafeed
|
4
|
+
class Transaction < Document
|
5
|
+
#
|
6
|
+
# Returns an +Array+ of the +TransactionDetail+s in this +Transaction+
|
7
|
+
def details
|
8
|
+
unless @details
|
9
|
+
@details = []
|
10
|
+
|
11
|
+
node.xpath('//transaction_details').each do |detail|
|
12
|
+
@details << TransactionDetail.new(detail)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
@details
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
#
|
21
|
+
# Returns custom fields in a 'name' => 'value' +Hash+
|
22
|
+
def custom_fields
|
23
|
+
fields = {}
|
24
|
+
fields_xml = node.xpath '//custom_field'
|
25
|
+
|
26
|
+
fields_xml.each do |node|
|
27
|
+
name = node.at_css('custom_field_name').content.strip
|
28
|
+
value = node.at_css('custom_field_value').content.strip
|
29
|
+
fields[name] = value
|
30
|
+
end
|
31
|
+
|
32
|
+
fields
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -3,22 +3,6 @@ module FoxySync::Xml
|
|
3
3
|
# Provides methods to easily query the transaction_detail
|
4
4
|
# elements found in a FoxyCart transaction XML datafeed
|
5
5
|
class TransactionDetail < Base
|
6
|
-
|
7
|
-
#
|
8
|
-
# Returns an +Array+ of the +TransactionDetail+s in +xml_base+
|
9
|
-
# [_xml_base_]
|
10
|
-
# A +FoxySync::Xml::Base+ that has a transaction_details element
|
11
|
-
def self.all(xml_base)
|
12
|
-
transactions = []
|
13
|
-
|
14
|
-
xml_base.node.xpath('//transaction_details').each do |detail|
|
15
|
-
transactions << new(detail)
|
16
|
-
end
|
17
|
-
|
18
|
-
transactions
|
19
|
-
end
|
20
|
-
|
21
|
-
|
22
6
|
#
|
23
7
|
# Returns custom product options in a 'name' => 'value' +Hash+
|
24
8
|
def custom_product_options
|
@@ -33,7 +17,5 @@ module FoxySync::Xml
|
|
33
17
|
|
34
18
|
options
|
35
19
|
end
|
36
|
-
|
37
20
|
end
|
38
|
-
|
39
21
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foxy_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.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: 2013-03-
|
12
|
+
date: 2013-03-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -81,6 +81,8 @@ files:
|
|
81
81
|
Li9saWIvZm94eV9zeW5jL3htbC9iYXNlLnJi
|
82
82
|
- !binary |-
|
83
83
|
Li9saWIvZm94eV9zeW5jL3htbC9kb2N1bWVudC5yYg==
|
84
|
+
- !binary |-
|
85
|
+
Li9saWIvZm94eV9zeW5jL3htbC90cmFuc2FjdGlvbi5yYg==
|
84
86
|
- !binary |-
|
85
87
|
Li9saWIvZm94eV9zeW5jL3htbC90cmFuc2FjdGlvbl9kZXRhaWwucmI=
|
86
88
|
- !binary |-
|