aws_agcod 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2c7b423fd17d651666be0cdf9364a66a7351f95
4
- data.tar.gz: 55366e36d0d9d52aa9603fa4660821662a3c252d
3
+ metadata.gz: 0a1b1ac339a100d50c0d98bb7344dc04c53dafc1
4
+ data.tar.gz: d53d69895bfd0bd1856d6d3bc4dcef0fc4613fa0
5
5
  SHA512:
6
- metadata.gz: 2b5e9a91d5145e49166f745d6788e395d6fa72d660feb38544d6116aed338d257c8d8d0707590e5732d3da63fdb8ba3e5aac83d7d7693828a07bee71bfe75e27
7
- data.tar.gz: b51ee3bc5ecbd98ab0701769bafd81f13457ff899d8a33f36d8ff2c0b17a1aab4dc051eb52fcb23f4107e6993c9721c4bdcf79bab869bb19267e755e65cbc313
6
+ metadata.gz: b7b82634947c65584dbd3e1e92ef10845479c1e52bf2d5e0940720ac6ec0fb3b0bd3dcd5090ec3543e956126956dd7a7e1061637ce1e6e368b9aa55ef70c2292
7
+ data.tar.gz: 6043c7c81ba9a5e0f666eb8da1f8c85d74b2a7a7a58548994126ca06e2824cb305ec47f72b2d18a0f829b142285e2cd389fc610ac032b200c5db986bb071162b
@@ -8,7 +8,7 @@ module AGCOD
8
8
 
9
9
  def initialize(request_id, gc_id)
10
10
  @response = Request.new("CancelGiftCard",
11
- "creationRequestId" => "#{AGCOD.config.partner_id}#{request_id}",
11
+ "creationRequestId" => request_id,
12
12
  "gcId" => gc_id
13
13
  ).response
14
14
  end
@@ -16,7 +16,7 @@ module AGCOD
16
16
  end
17
17
 
18
18
  @response = Request.new("CreateGiftCard",
19
- "creationRequestId" => "#{AGCOD.config.partner_id}#{request_id}",
19
+ "creationRequestId" => request_id,
20
20
  "value" => {
21
21
  "currencyCode" => currency,
22
22
  "amount" => amount
@@ -11,7 +11,7 @@ module AGCOD
11
11
 
12
12
  def initialize(action, params)
13
13
  @action = action
14
- @params = params
14
+ @params = sanitized_params(params)
15
15
 
16
16
  @response = Response.new(HTTParty.post(uri, body: body, headers: signed_headers, timeout: AGCOD.config.timeout).body)
17
17
  end
@@ -42,5 +42,19 @@ module AGCOD
42
42
  "partnerId" => AGCOD.config.partner_id
43
43
  ).to_json
44
44
  end
45
+
46
+ def sanitized_params(params)
47
+ # Prefix partner_id when it's not given as part of request_id for creationRequestId
48
+ if params["creationRequestId"] && !(params["creationRequestId"] =~ /#{AGCOD.config.partner_id}/)
49
+ params["creationRequestId"] = "#{AGCOD.config.partner_id}#{params["creationRequestId"]}"
50
+ end
51
+
52
+ # Remove partner_id when it's prefixed in requestId
53
+ if params["requestId"] && !!(params["requestId"] =~ /^#{AGCOD.config.partner_id}/)
54
+ params["requestId"].sub!(/^#{AGCOD.config.partner_id}/, "")
55
+ end
56
+
57
+ params
58
+ end
45
59
  end
46
60
  end
@@ -1,3 +1,3 @@
1
1
  module AGCOD
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws_agcod
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xenor Chang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-06 00:00:00.000000000 Z
11
+ date: 2015-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty