verifalia / verifalia-ruby-sdk Goto Github PK
View Code? Open in Web Editor NEWVerifalia Ruby SDK
License: MIT License
Verifalia Ruby SDK
License: MIT License
This causes a mess in issues and PRs.
@verifalia can you disable it?
validador_verifalia.rb
is raising an undefined method code for nil:NilClass
error when RestClient raise a RestClient::RequestTimeout
I'm already working on the fix.
RSpec is not running the email_validations specs. The file has the wrong file name.
it is:
email_validations.spec.rb
should be:
email_validations_spec.rb
I will fix this and send a PR.
I have following code update suggestions to keep code DRY. Working on following updates.
In EmailValidations#initialize
@resource = RestClient::Resource.new "#{config[:host]}/#{config[:api_version]}/email-validations", account_sid, account_token
Update above code to build @resource
, with following
api_url = "#{config[:host]}/#{config[:api_version]}/email-validations"
opts = {
user: account_sid,
password: account_token,
headers: { content_type: :json }
}
@resource = RestClient::Resource.new api_url, opts
I see following advantage,
content_type: :json
for each call like :get, :post, :deleteAfter this update we can call @resource.post
, @resource.get
without content_type
.
Off course, We need to test code thoroughly, I have started working on it,
What you think @RobertoSchneiders ?, any thoughts?
It would be nice to have a automated build (CircleCI) for this repository. Also, would be very nice to have Gemnasium, Coveralls, Code Climate, inch-ci running on this project.
All this tools are free for open source software like this. I can configure them for you if you give me write access to the repository.
@verifalia
With reference to to my previous issue #4,
Need to fix EmailValidations#query method as well
Lets take a scenario, I start a job and get following response
unique_id = @client.email_validations.verify(emails)
@client.email_validations.query
{
"uniqueID":"74169d7e-e8be-4ebb-aa5b-xxxxxxxx",
"engineVersion":"1.2;2015-10-08",
"submittedOn":"2015-10-20T12:27:40.023",
"progress":{
"noOfTotalEntries":3,
"noOfCompletedEntries":2
}
}
If I want to query again on same object @client.email_validations
which has@unique_id
and
@response
have above value, If after some time I call @client.email_validations.query
to see the latest status of same job with @unique_id
Following condition(unless) will never be false
, as @response
has non nil
value after first call and will not query API again for latest status.
def query
....
unless @response
#this part will not get executed
end
....
end
Note: This works if I have previous unique_id, What if I want to query on existing object without any arguments to @client.email_validations
it should query using exiting @unique_id
which exists with current object. May be we need to change the completed?
and query
method. So user can easily call query
again on same object after some time using completed?
method, keeping same support for @client.email_validations(unique_id: unique_id).query
(with argument)
Will send PR, after fixing this.
Currently the code uses version 1.4, but there's already version 2 of the api.
While using this sdk, found bug in EmailValidations#completed? method as following
After creating validation job using
unique_id = @client.email_validations.verify(emails)
response = @client.email_validations.query
Got response as
{
"uniqueID":"74169d7e-e8be-4ebb-aa5b-xxxxxxxx",
"engineVersion":"1.2;2015-10-08",
"submittedOn":"2015-10-20T12:27:40.023",
"progress":{
"noOfTotalEntries":3,
"noOfCompletedEntries":2
}
}
If we notice this job is in progress , I checked status using
@client.email_validations.completed?
And got true
which is incorrect.
completed? method should be like
def completed?
query["progress"]["noOfTotalEntries"] == query["progress"]["noOfCompletedEntries"]
end
@verifalia Waiting for your confirmation on this, So I can fix this and send PR.
The EmailValidations class incorrectly marks a validation job as completed if the noOfCompletedEntries is equal to noOfTotalEntries:
https://github.com/verifalia/verifalia-ruby-sdk/blob/master/lib/rest/email_validations.rb#L88
This behavior is wrong, as the API returns the completion status for a validation job in a RESTful fashion: in particular, the HTTP 202 (Accepted) status code means the API consumer should reissue the request later (see http://verifalia.com/developers/email-validations#getting-status). Apart from compliance to the API specification, this behavior can cause issues if the API consumer expects to actually find its validation results whenever the SDK marks a validation job as completed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.