aws_agcod 0.0.9 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c62905715b36e6f50edf5a79a5f55027940effc6
4
- data.tar.gz: c7406bab523f76258c16bd98f04e076e9a9da1ea
3
+ metadata.gz: 807eb1c4a24481156c9184eb9a3a76dd6ad836c1
4
+ data.tar.gz: 33bc6fd77e33c5ebeecd956b466e8b458b1599e5
5
5
  SHA512:
6
- metadata.gz: 069a1abb237039f17a2fef84de221671bad676b3705a8740207224d2bdd8f860124faa16c6532f8d58b64333abe421de5aa4a7c0a680425c0f57951360d4b6ed
7
- data.tar.gz: 532311192f70cbde08458aec5b67730f7c54473869f7ce19d5767a5b291a57abe7ec288d692399583343aef6de0b8f83b6eb43e0570a0b401b293ac483864b13
6
+ metadata.gz: 5fcb7939da17c11895a955edf0d1e555888780ac1ccbb88dbe0f8aa8cbc1095ecb34c32a97afff33374dbcf6999dbc00c608d66a6a69b25a1cef5bad3125b41e
7
+ data.tar.gz: 2eb47f9a1879fccb205fc56bcd492c855e33ec292cb5a8ee5cada3e2364ba1895df40811dc03d3792c6ee952d61eb61e1b1762e9dfbc8d21779459488adc297a
@@ -6,7 +6,7 @@ module AGCOD
6
6
  class CreateGiftCard
7
7
  extend Forwardable
8
8
 
9
- CURRENCIES = %w(USD EUR JPY CNY CAD)
9
+ CURRENCIES = %w(USD EUR JPY CNY CAD GBP).freeze
10
10
 
11
11
  def_delegators :@response, :status, :success?, :error_message
12
12
 
@@ -5,7 +5,8 @@ require "yaml"
5
5
 
6
6
  module AGCOD
7
7
  class Request
8
- TIME_FORMAT = "%Y%m%dT%H%M%SZ"
8
+ TIME_FORMAT = "%Y%m%dT%H%M%SZ".freeze
9
+ MOCK_REQUEST_IDS = %w(F0000 F2005).freeze
9
10
 
10
11
  attr_reader :response
11
12
 
@@ -39,22 +40,29 @@ module AGCOD
39
40
 
40
41
  def body
41
42
  @body ||= @params.merge(
42
- "partnerId" => AGCOD.config.partner_id
43
+ "partnerId" => partner_id
43
44
  ).to_json
44
45
  end
45
46
 
46
47
  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"]}"
48
+ # Prefix partner_id in creationRequestId when it's not given as part of request_id, and it's not a mocked request_id.
49
+ if params["creationRequestId"] &&
50
+ !(params["creationRequestId"] =~ /#{partner_id}/) &&
51
+ !(MOCK_REQUEST_IDS.member?(params["creationRequestId"]))
52
+
53
+ params["creationRequestId"] = "#{partner_id}#{params["creationRequestId"]}"
50
54
  end
51
55
 
52
56
  # 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}/, "")
57
+ if params["requestId"] && !!(params["requestId"] =~ /^#{partner_id}/)
58
+ params["requestId"].sub!(/^#{partner_id}/, "")
55
59
  end
56
60
 
57
61
  params
58
62
  end
63
+
64
+ def partner_id
65
+ @partner_id ||= AGCOD.config.partner_id
66
+ end
59
67
  end
60
68
  end
@@ -1,3 +1,3 @@
1
1
  module AGCOD
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
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.9
4
+ version: 0.1.0
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-04-16 00:00:00.000000000 Z
11
+ date: 2018-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty