mastercard_api_core 1.2.0 → 1.2.1

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: f5f763aebe0c1c4a9a63b42140714f3855315cb2
4
- data.tar.gz: 5052018374598d3ce2f0e696db496582fb4d7371
3
+ metadata.gz: 5c8630c06a9245987849c8dd7ee177d818255174
4
+ data.tar.gz: 94b4c81402a092e3730b6e2b55aa019e13ebb556
5
5
  SHA512:
6
- metadata.gz: d69f38d00443e4458f114226a422bce782f65949b68babafe2b0488a4bc2b73a3e27ba360d646bbedaacb5e730c35ecc87b3ab6313190902e881f157977b5b56
7
- data.tar.gz: da1d578e23a34fb2083890bc37ef250711f400eec3083fbeb00b33224314957fd6474e58fe86ecff6fa8a228d9924b8f4ef663db60f13461d0b11931912bf9eb
6
+ metadata.gz: a37f3a37d9f27fb80852f3382d2cf60670945f6b14fb09a8ea7504206e666078b831cfa81f2d1facd39054750708579015f4d24952d08a282de28062178b4cbe
7
+ data.tar.gz: 830d89624aaf5ee17dcb7eeb9c8527e3f48dac7fa0468ddb564b62dd7d7cb7d8478a8a9364f6d21c1830f0b5d97d079f42b3b0b616a0406b564468398595aaea
@@ -74,12 +74,17 @@ module MasterCard
74
74
  #Check preconditions for execute
75
75
  preCheck()
76
76
 
77
- #Get the request Object
78
- request = getRequestObject(config,metadata,input)
77
+ resolvedHost = @baseURL
78
+ unless metadata.getHost().nil?
79
+ resolvedHost = metadata.getHost()
80
+ end
79
81
 
80
- uri = URI.parse(request.path)
82
+ uri = URI.parse(resolvedHost)
81
83
  #Get the http object
82
84
  http = getHTTPObject(uri)
85
+
86
+ #Get the request Object
87
+ request = getRequestObject(config,metadata,input)
83
88
 
84
89
  if Config.isDebug
85
90
  puts "---- Request ----"
@@ -231,28 +236,29 @@ module MasterCard
231
236
  #Get the body
232
237
  body = getBody(config.getAction(),input)
233
238
 
239
+ #add url parameters to path
240
+ fullUrl = encode_path_params(fullUrl,pathParams)
241
+
242
+ uri = URI(fullUrl)
234
243
 
235
244
  #Retuns the request object based on action
236
245
  case config.getAction().upcase
237
246
  when ACTION_LIST, ACTION_READ, ACTION_QUERY
238
- verb = Net::HTTP::Get
247
+ request = Net::HTTP::Get.new uri
239
248
 
240
249
  when ACTION_CREATE
241
- verb = Net::HTTP::Post
250
+ request = Net::HTTP::Post.new uri
242
251
 
243
252
  when ACTION_DELETE
244
- verb = Net::HTTP::Delete
253
+ request = Net::HTTP::Delete.new uri
245
254
 
246
255
  when ACTION_UPDATE
247
- verb = Net::HTTP::Put
256
+ request = Net::HTTP::Put.new uri
248
257
  else
249
258
  raise APIException.new "Invalid action #{config.getAction()}"
250
259
  end
251
260
 
252
- #add url parameters to path
253
- fullUrl = encode_path_params(fullUrl,pathParams)
254
-
255
- request = verb.new(fullUrl)
261
+
256
262
 
257
263
  #Add default headers
258
264
  request.add_field(KEY_ACCEPT,APPLICATION_JSON)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mastercard_api_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - MasterCard Worldwide
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-05 00:00:00.000000000 Z
11
+ date: 2016-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simplecov