Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation needs more examples #39

Open
ghost opened this issue Aug 11, 2017 · 6 comments
Open

Documentation needs more examples #39

ghost opened this issue Aug 11, 2017 · 6 comments

Comments

@ghost
Copy link

ghost commented Aug 11, 2017

Hello

This is not really an issue per say, more of a plea for further documentation examples and some help.

I'm currently trying to understand how I can access all of the data that I am getting back from a response

With,

$mf = new MinFraud($this->id, $this->key);

$request = $mf->withDevice([
    'ip_address' => $data->ip_address,
    'user_agent' => $data->user_agent,
])->withEmail([
    'address' => $data->address,
    'domain'  => $data->address_domain,
])->withBilling([
    'first_name' => $data->first_name,
    'last_name'  => $data->last_name,
]);

$response = $request->insights();

I do not understand why I cannot simply access, say, the latitude of the IP Address with:

$response->ipAddress->location->latitude or $response->ipAddress->location['latitude']

For a simpleton like myself I just need that extra bit of assistance / documentation on how to access and store this information.

Is there a method to get data by key? Is this a free trial account limitation, or.. ?

Cheers!

@oschwald
Copy link
Member

$response->ipAddress->location->latitude should work fine. What error are you getting? Please note that not all IP addresses will have coordinates. The return value would be null in that case.

@ghost
Copy link
Author

ghost commented Aug 11, 2017

Here's the data i'm trying to retrieve from the response:

$fraudDetection->id;
$fraudDetection->riskScore;
$fraudDetection->ipAddress->location->latitude;
$fraudDetection->ipAddress->location->longitude;
$fraudDetection->ipAddress->location->accuracy_radius;
$fraudDetection->ipAddress->continent->code;
$fraudDetection->ipAddress->country->iso_code;
$fraudDetection->ipAddress->country->is_high_risk;
$fraudDetection->ipAddress->city->names->en;
$fraudDetection->ipAddress->city->confidence;
$fraudDetection->ipAddress->traits->domain;
$fraudDetection->ipAddress->traits->isp;
$fraudDetection->ipAddress->traits->user_type;
$fraudDetection->email->isHighRisk;
$fraudDetection->email->isFree;
$fraudDetection->email->firstSeen;

I get unknown attribute on $fraudDetection->ipAddress->location->accuracy_radius of 5 but I can see it in the response object if I dump it.

$fraudDetection->ipAddress->location->longitude works actually.

@oschwald
Copy link
Member

Try:

$fraudDetection->ipAddress->location->accuracyRadius;
$fraudDetection->ipAddress->continent->code;
$fraudDetection->ipAddress->country->isoCode;
$fraudDetection->ipAddress->country->isHighRisk;

See the API docs for the full list of property names.

@wnedoe
Copy link

wnedoe commented Oct 2, 2019

This open issue seems to be the only place where this behaviour is documented.. :-(

Could please anyone explain me the correct syntax for the non working

$fraudDetection->ipAddress->city->names->en;

@oschwald
Copy link
Member

oschwald commented Oct 2, 2019

names is an array. $fraudDetection->ipAddress->city->name will likely do what you want unless you set locales in the options array. If you want to specify the locale explicitly, you could do $fraudDetection->ipAddress->city->names['en'].

@wnedoe
Copy link

wnedoe commented Oct 2, 2019

names is an array. $fraudDetection->ipAddress->city->name will likely do what you want unless you set locales in the options array. If you want to specify the locale explicitly, you could do $fraudDetection->ipAddress->city->names['en'].

Thanks that did the trick. But it would have been nice if this would have been found in the documentation or the example script and not as open issue on github ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants