lib/agx/sync/client.rb in agx-0.2.2 vs lib/agx/sync/client.rb in agx-0.2.3
- old
+ new
@@ -48,10 +48,26 @@
rescue => e
handle_error(e)
end
end
+ def get_nt(resource, start_time = nil)
+ validate_nt_sync_attributes
+
+ url = "#{@api_url}#{resource}"
+ if !start_time.nil?
+ url = "#{@api_url}#{resource}?startTime=#{start_time}"
+ end
+
+ begin
+ response = current_token.get(url, :headers => @headers)
+ parse_response(response.body)
+ rescue => e
+ handle_error(e)
+ end
+ end
+
def start_transaction
validate_credentials
if !@transaction_id.nil?
end_transaction
@@ -98,9 +114,18 @@
def validate_sync_attributes
validate_credentials
unless @sync_id && @transaction_id
+ error = Agx::Error.new("agX Sync Transaction Attributes Not Set", {title: "AGX_SYNC_ATTRIBUTES_ERROR"})
+ raise error
+ end
+ end
+
+ def validate_nt_sync_attributes
+ validate_credentials
+
+ unless @sync_id
error = Agx::Error.new("agX Sync Transaction Attributes Not Set", {title: "AGX_SYNC_ATTRIBUTES_ERROR"})
raise error
end
end