spreedly_core 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,7 +26,7 @@ module SpreedlyCore
26
26
  # make a post request to path
27
27
  # If the request succeeds, provide the respones to the &block
28
28
  def self.verify_post(path, options={}, &block)
29
- verify_request(:post, path, options, 200, 422, &block)
29
+ verify_request(:post, path, options, 200, 422, 201, &block)
30
30
  end
31
31
 
32
32
  # make a put request to path
@@ -1,5 +1,6 @@
1
1
  require 'cgi'
2
2
  require 'uri'
3
+ require 'rexml/document'
3
4
 
4
5
  module SpreedlyCore
5
6
  module TestHelper
@@ -46,16 +47,10 @@ module SpreedlyCore
46
47
  data = cc_data.merge(:redirect_url => "http://example.com",
47
48
  :api_login => SpreedlyCore::Base.login,
48
49
  :data => pass_through_data)
49
-
50
- response = self.post("/payment_methods", :body => data, :no_follow => true)
51
- rescue HTTParty::RedirectionTooDeep => e
52
- if e.response.body =~ /href="(.*?)"/
53
- # rescuing the RedirectionTooDeep exception is apparently the way to
54
- # handle redirect following
55
- token = CGI::parse(URI.parse($1).query)["token"].first
50
+
51
+ self.verify_post "/payment_methods", :body => data, :has_key => "transaction" do |r|
52
+ r['transaction']['payment_method']['token']
56
53
  end
57
- raise "Could not find token in body: #{e.response.body}" if token.nil?
58
- return token
59
54
  end
60
55
  end
61
56
  end
@@ -1,3 +1,3 @@
1
1
  module SpreedlyCore
2
- Version = VERSION = "0.1.2"
2
+ Version = VERSION = "0.1.3"
3
3
  end
@@ -1,3 +1,5 @@
1
- login: 'Ud8NWIpG66s5ki5EX1n3ijCdGCe'
2
- secret: 'lS1jRuOr642CapweB4Au74oM48k9et935YXluG2Gd9sj0qCedUfG44qT3F1HNFnt'
3
- gateway_token: 'JncEWj22g59t3CRB1VnPXmUUgKc'
1
+ login: 'FBI2NgUPyZrfi8Ooqa3gcJZG6V7'
2
+ secret: 'bCVj2nIPSNf77xummxI2UTc5lAC2YCuVGryj4jC4p4Pwu44P44VucIgAvfeRDD77'
3
+ gateway_token: 'H3TcLhLkdFxKMCXBlCHJybjw1MO'
4
+
5
+
metadata CHANGED
@@ -1,21 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spreedly_core
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - 403 Labs
14
+ - Spreedly
14
15
  autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2012-02-29 00:00:00 Z
19
+ date: 2012-03-22 00:00:00 Z
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: httparty