lib/portatext/command/api/campaigns.rb in portatext-1.4.2 vs lib/portatext/command/api/campaigns.rb in portatext-1.4.3
- old
+ new
@@ -68,23 +68,26 @@
settings.delete :file
settings = settings.to_json
settings = URI.encode_www_form('settings' => settings)
return "campaigns?#{settings}"
end
- return 'campaigns' if @args[:id].nil?
- id = @args[:id]
- contacts = @args[:contacts]
- @args.delete :type
- @args.delete :id
- @args.delete :contacts
qs = {}
unless @args[:page].nil?
qs['page'] = @args[:page]
@args.delete :page
end
qs = URI.encode_www_form qs
- return "campaigns/#{id}/contacts?#{qs}" if contacts
- "campaigns/#{id}"
+ unless @args[:id].nil?
+ id = @args[:id]
+ contacts = @args[:contacts]
+ @args.delete :type
+ @args.delete :id
+ @args.delete :contacts
+ return "campaigns/#{id}/contacts?#{qs}" if contacts
+ return "campaigns/#{id}"
+ end
+ return "campaigns?#{qs}" unless qs.empty?
+ 'campaigns'
end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength
end
end