chockstone 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.
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  doc/*
2
2
  *.gem
3
- Gemfile.lock
3
+ Gemfile.lock
4
+ test/test_icle_private.rb
data/README.rdoc CHANGED
@@ -1,7 +1,7 @@
1
1
  = Chockstone API
2
2
 
3
3
  == Description
4
- This a Ruby interface for the Chockstone [http://www.heartlandpaymentsystems.com/loyaltymarketing] service.
4
+ This a Ruby interface for the Chockstone API service.
5
5
 
6
6
  == Installation
7
7
  gem install chockstone
data/chockstone.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{chockstone}
3
- s.version = %q{0.2.0}
3
+ s.version = %q{0.3.0}
4
4
  s.summary = ""
5
5
  s.description = "Wrapper for Chockstone API requests"
6
6
  s.authors = ["Thomas Mulloy"]
@@ -126,23 +126,27 @@ module Chockstone
126
126
  p = XML::Parser.string(resp)
127
127
  doc = p.parse
128
128
 
129
- #puts "RESPONSE: " + doc.to_s
130
-
131
129
  response = doc.find('//response')[0]
132
130
  status = response.find('//status')[0]
131
+
132
+ alert_name = status.find('//alert-name')[0]
133
+ alert_type = status.find('//alert-type')[0]
134
+
135
+ alert = {
136
+ :name => alert_name ? alert_name.content : nil,
137
+ :type => alert_type ? alert_type.content : nil
138
+ }
139
+
133
140
  method = status.find('//type')[0].content
134
141
  data = Hash.from_xml(response.find("//#{method}")[0].to_s)
135
142
 
136
143
  formatted_response = {
137
144
  :status => status.find('//code')[0].content,
138
- :alert => {
139
- :name => code = status.find('//alert-name')[0].content,
140
- :type => code = status.find('//alert-type')[0].content
141
- },
142
145
  :method => method,
143
146
  :description => status.find('//description')[0].content
144
147
  }
145
148
 
149
+ formatted_response.merge!({ :alert => alert }) unless alert[:name].nil? and alert[:type].nil?
146
150
  formatted_response.merge!({ :data => data }) unless data.blank?
147
151
 
148
152
  formatted_response
@@ -167,8 +171,6 @@ module Chockstone
167
171
  req.attributes['version'] = '1'
168
172
  req.attributes['revision'] = '1'
169
173
 
170
- #puts "REQUEST: " + xml.to_s
171
-
172
174
  send(xml)
173
175
  end
174
176
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chockstone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.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: 2012-04-11 00:00:00.000000000 Z
12
+ date: 2012-04-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: libxml-ruby