lib/globalsms/report.rb in globalsms-0.2.0 vs lib/globalsms/report.rb in globalsms-0.3.0
- old
+ new
@@ -29,10 +29,20 @@
uri = "#{@api_base_url}/sms/report/sent?limit=#{argv}&key=#{@api_key}&secret=#{@api_secret}"
c = HTTPClient.new
return JSON.parse(c.get(uri).body)
end
- def report_between()
+ def report_between(argv)
+ argv = {
+ start_time: "00:00:00",
+ end_time: "23:59:59"
+ }.merge(argv)
+
+ uri_with_whitespace = "#{@api_base_url}/sms/report/sent?between_start=#{argv[:start_date]} #{argv[:start_time]}&between_end=#{argv[:end_date]} #{argv[:end_time]}&key=#{@api_key}&secret=#{@api_secret}"
+ uri = URI.parse(URI.encode(uri_with_whitespace.strip))
+
+ c = HTTPClient.new
+ return JSON.parse(c.get(uri).body)
end
def originator_list
uri = "#{@api_base_url}/originator/list?key=#{@api_key}&secret=#{@api_secret}"
c = HTTPClient.new
\ No newline at end of file