api_pattern 0.0.3 → 0.0.4

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
  SHA256:
3
- metadata.gz: 247c97a2884ca5e72a787e2d53e3dac38b72ea010146f2784039d012cf1c86a7
4
- data.tar.gz: 1a4bef352470b85aef4fe9ab2fb74001f46a81adedfd253001c13df4f20ee814
3
+ metadata.gz: c596b7bd3e7bec64345aef96a9d1729bc22e89a5c806c2daf6f4f3685159989c
4
+ data.tar.gz: 4dee1326d8627733e3aa9af1a0dc0a369c161dfa9f02055e819c9b3fbdbb8138
5
5
  SHA512:
6
- metadata.gz: 46e7b6e3a75e087cd6e313dfa0858034e5ad910687a7f19252aefa041943421056233d49e464a0cd0983bc5dc82bbea6cb4b5e61c1286a04fb050a763077a032
7
- data.tar.gz: 40982eae5e02ede1efea95db5aed6acf9f5a782f06c4bb8773de3d267d1954eb151505d835effb20158b00b23c185ef9314d86d18e770ca53b70ced8e4c28d06
6
+ metadata.gz: 0eb1877242657c5b1d33b2ed9d0181599943dad63405b0ea9ebeabf32a8f7376459f28618b79ce8b4670ef199c4240cda4ade31d33d9f3462ae881e412860c2f
7
+ data.tar.gz: 04f5d4c41950447974d16138851c3b40b012b647c59dce9ebdfeb163b0ac674dee3eef6c31965fc4880d44c3496173bdb8a2b7e08185bd9632743a1a5e9d53f5
@@ -117,13 +117,16 @@ module ApiPattern
117
117
  end
118
118
 
119
119
  def construct_base_path(path, params, custom_url: nil)
120
- if custom_url
120
+ return custom_url if custom_url.present? && path.blank? && params.blank?
121
+ return base_path if path.blank? && params.blank?
122
+
123
+ if custom_url.present?
121
124
  constructed_path = "#{custom_url}/#{path}"
122
125
  else
123
126
  constructed_path = "#{base_path}/#{path}"
124
127
  end
125
128
 
126
- if params == {}
129
+ if params.blank?
127
130
  constructed_path
128
131
  else
129
132
  "#{constructed_path}?#{process_params(params)}"
@@ -131,7 +134,7 @@ module ApiPattern
131
134
  end
132
135
 
133
136
  def process_payload(payload)
134
- return nil if payload.nil? || payload == {} || payload == ""
137
+ return nil if payload.blank?
135
138
 
136
139
  if @content_type.to_s.downcase.include?("json")
137
140
  payload.to_json
@@ -1,3 +1,3 @@
1
1
  module ApiPattern
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_pattern
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - trex22