Sell specifying the "total" instead of the "amount" parameter - coinbase-api

According to the "Place sell order" documentation, you can either use amount as parameter, or total:
amount string Required Sell amount
total string Optional Sell amount with fees (alternative to amount)
Using the Ruby client, I made a call
client.sell(account.id,{
"total" => some_value,
"currency" => "ETH",
"payment_method" => fiat_payment_method_id
});
to sell some ETH back to USD. I got the following error message
.../lib/coinbase/wallet/api_client.rb:402:in `block in sell': Missing parameter: amount (Coinbase::Wallet::APIError)
Am I misreading the documentation ? Do I need to specify both account and total, and will the server use the total and ignore the amount ?
Or is the documentation just wrong ?

Didn't realise the error was throwing by the Ruby code and not by the Coinbase server.
Looks like the code enforced the presence of the amount parameter.
Submitted a pull request to get this fixed. Testing with my own local modified version of their gem indicates that the server works just fine with using "total" instead of "amount".

Related

QBO SDK PHP getting all deposits customer

I would like to know how to get all deposits of a target customer with the following SDK (https://github.com/intuit/QuickBooks-V3-PHP-SDK).
Is there an easier way than getting all deposits, then looping to extract the wanted customer's deposits?
Official QBO answer:
You can get complete deposit list by querying the “Query a deposit”
API end point. If we use filter in query, then it may return incorrect
results. Better you can iterate the response and add filter logic in
your code and get specified

Get Display Name for License SKU in Microsoft Graph

I am trying to use Microsoft Graph to capture the products which we have licenses for.
While I can get the skupartname, that name is not exactly display-friendly.
I have come across DisplayName as a datapoint in almost all the API calls that give out an object with an id.
I was wondering if there was a DisplayName for the skus, and where I could go to get them via the graph.
For reference, the call I made was on the https://graph.microsoft.com/v1.0/subscribedSkus endpoint following the doc https://learn.microsoft.com/en-us/graph/api/subscribedsku-list?view=graph-rest-1.0
The following is what's returned (after filtering out things I don't need), and as mentioned before, while I have a unique identifier which I can use via the skuPartNumber, that is not exactly PRESENTABLE.
You might notice for some of the skus, it difficult to figure out what it is referring to based on the names in the image of the Licenses page posted after the output
[
{
"capabilityStatus": "Enabled",
"consumedUnits": 0,
"id": "aca06701-ea7e-42b5-81e7-6ecaee2811ad_2b9c8e7c-319c-43a2-a2a0-48c5c6161de7",
"skuId": "2b9c8e7c-319c-43a2-a2a0-48c5c6161de7",
"skuPartNumber": "AAD_BASIC"
},
{
"capabilityStatus": "Enabled",
"consumedUnits": 0,
"id": "aca06701-ea7e-42b5-81e7-6ecaee2811ad_df845ce7-05f9-4894-b5f2-11bbfbcfd2b6",
"skuId": "df845ce7-05f9-4894-b5f2-11bbfbcfd2b6",
"skuPartNumber": "ADALLOM_STANDALONE"
},
{
"capabilityStatus": "Enabled",
"consumedUnits": 96,
"id": "aca06701-ea7e-42b5-81e7-6ecaee2811ad_0c266dff-15dd-4b49-8397-2bb16070ed52",
"skuId": "0c266dff-15dd-4b49-8397-2bb16070ed52",
"skuPartNumber": "MCOMEETADV"
}
]
Edit:
I am aware that I can get "friendly names" of SKUs in the following link
https://learn.microsoft.com/en-us/azure/active-directory/users-groups-roles/licensing-service-plan-reference
The problem is that it contains ONLY the 70ish most COMMON SKUs (in the last financial quarter), NOT ALL.
My organization alone has 5 SKUs not present on that page, and some of our clients for who we are an MSP for, also have a few. In that context, the link really does not solve the problem, since it is not reliable, nor updated fast enough for new SKUs
You can see a match list from Product names and service plan identifiers for licensing.
Please note that:
the table lists the most commonly used Microsoft online service
products and provides their various ID values. These tables are for
reference purposes and are accurate only as of the date when this
article was last updated. Microsoft does not plan to update them for
newly added services periodically.
Here is an extra list which may be helpful.
There is a CSV download available of the data on the "Product names and service plan identifiers for licensing" page now.
For example, the current CSV (as of the time of posting this answer) is located at https://download.microsoft.com/download/e/3/e/e3e9faf2-f28b-490a-9ada-c6089a1fc5b0/Product%20names%20and%20service%20plan%20identifiers%20for%20licensing%20v9_22_2021.csv. This can be downloaded, cached and parsed in your application to resolve the product display name.
This is just a CSV format of the same table that is displayed on the webpage, which is not comprehensive, but it should have many of the products listed. If you find one that is missing, you can use the "Submit feedback for this page" button on the bottom of the page to create a GitHub issue. The documentation team usually responds in a few weeks.
Microsoft may provide an API for this data in the future, but it's only in their backlog. (source)

Microsoft Graph - Filtering users by X500 proxyAddress

Is it possible to query for users, filtered by an X500 proxy address?
Using the following query which filters by an SMTP address, I can return all of my proxy addresses:
/v1.0/users/?$filter=proxyAddresses/any(x:x eq 'smtp:me#here.com')&$select=proxyAddresses
However, if I take one of the X500 addresses that was returned in the above query and try and filter by that:
/v1.0/users/?$filter=proxyAddresses/any(x:x eq 'x500:/o=ExchangeLabs/ou=Exchange Administrative Group (blahblah)/cn=Recipients/cn=trimmed')&$select=proxyAddresses
then I get a 400:
{
"error": {
"code": "Request_UnsupportedQuery",
"message": "Unsupported or invalid query filter clause specified for property 'proxyAddresses' of resource 'User'.",
"innerError": {
"request-id": "adcdefg",
"date": "2019-01-01T01:01:01"
}
}
}
I've tried URL encoding the address, and also tried with and without the "X500:" scheme.
Is filtering by X500 address supported?
I am able to use X500 addresses as filters without any modification to the address from a clone of GraphExplorer. The following queries both return the correct user record
https://graph.microsoft.com/v1.0/users/?$filter=proxyAddresses/any(x:x eq 'x500:/o=Company Exchange/ou=First Administrative Group/cn=Recipients/cn=UIDHere')&$select=proxyAddresses
and
https://graph.microsoft.com/v1.0/users/?$filter=proxyAddresses/any(x:x eq 'X500:/o=Company Exchange/ou=External (FYDIBOHF25SPDLT)/cn=Recipients/cn=z804261192zc46c4az4f6032z322540z')&$select=proxyAddresses
Like Lisa - this is not about parenthesis. I have Any lambda queries on proxyAddresses using X500 addresses containing parentheses that working just fine in Graph Explorer.
I suspect that the issue is actually size of the search string. I repro the error if the size of the search string is greater than 120 characters.
I'm following up with the engineering team.
In the meantime Paul, as a workaround (and excuse my lack of X500 knowledge), is there a way to query using the shortest X500 string?
Hope this helps,
As Dan Kershaw answered - this does seem to be a hard coded limit of 120 characters in the email address being filtered on.
A simple workaround is to trim the email address (including the scheme - "x500:" or "smtp:") to 120 characters, and search using a "startswith":
/v1.0/users/?$filter=proxyAddresses/any(x:startswith(x, 'x500:/o=ExchangeLabs/ou=Exchange Administrative Group (blahblah)/cn=Recipients/cn=trimmed'))&$select=proxyAddresses
This may return more than one match, so its then a case of looking through each returned user, and looking at their "proxyAddresses" collection to see which matches the original untrimmed email address that's being searched for.
I can confirm that this is still an issue as of today's date.
I'm actually using the AzureAD PowerShell cmdlets, which leverage the Graph API.
I couldn't figure out why my query was failing until I found this thread, so thanks for that.
I was getting essentially the same error message in PowerShell:
"Unsupported or invalid query filter clause specified for property 'proxyAddresses' of resource 'Group'."
When I took a substring of the first 120 characters and ran a startsWith, it worked fine.
It's a shame that this issue still hasn't been resolved.

rails compact array and NilClass

I have a Client model with a Date field: last_issue
A Client has_many :tickets and a Ticket has a Date field: invoice_date
A Client has_many :adverts and an Advert has a Date field: issue_date
I am trying to use array with compact to find and present the max date from these 3 items in the Client show view, but am getting errors when the Client does not have a Ticket or an Advert.
When I try to display the max date in my view using:
[#client.last_issue, #client.adverts.max.issue_date, #client.tickets.max.invoice_date].compact.max
it fails whenever a Client is missing one of the associated models.
I know that compact will remove nil elements, but I am struck on the cleanest way to deal with the missing values from the Nil associations that lead to errors such as NoMethodError: undefined method 'issue_date' for nil:NilClass
According to your description you only want to show the maximum date from the three types of object client.last_issue, client.adverts and client.tickets. Then save your app ressources and do not instantiate the tickets and adverts.
Instead load the plain maximum dates by using aggregation like:
[
#client.last_issue,
#client.adverts.maximum(:issue_date),
#client.tickets.maximum(:invoice_date)
].compact.max
You certanly want to move that snippet into a decorator.
Besides I'm not sure if actually meant to expect the minimum date (means the oldest), although you asked for maximum.
As a one off thing you could do this.
[#client.try(:last_issue), #client.try(:adverts).try(:max).try(:issue_date), #client.try(:tickets).try(:max).try(:invoice_date)].compact.try(:max)
Have you considered implementing this so that you aren't reaching so deep into the other objects? So that you only have to do 1 message to client for max invoice and issue date?

Grouping in Solr 4 admin interface, where is grouping field?

By the address:
http://myhost.com:8983/solr/#/collection1/query
I can not find the possibility for inputing GROUP queries, like:
group=true&group.field=geohash1_st
Where is fields for that type of query?
That is what I have:
P.S: I have solr 4 version.
P.S2: I can type my query into URL of my browser, but it is not convenient, because the query is long! So the question is to make that using prepared input fields...
The place you'd put those is labelled "Raw Query Parameters" ... but it's not in your screenshot. This probably means that you're not using a new enough version of Solr 4. I can confirm that this is in the admin UI as of version 4.2.1, and it's definitely in the latest version, 4.6.0.
You disappeared from #solr before I could answer there.
I faced same issue.
I have done like this :
We need to send parameter on : Raw Query Parameters
stats.facet=Status&stats.field=ItemPrice&stats=on&wt=json
stats.facet=Status - It means group by Status.
stats.field=ItemPrice - It means Sum,min,max,sd.. macro aggregation will be done on ItemPrice.
stats=on It enable the stats
Result will contain Stats like below :
"stats":{
"stats_fields":{
"ItemPrice":{
"min":1.0,
"max":1399.99,
"count":8,
"missing":0,
"sum":3147.9399999999987,
"sumOfSquares":3063146.2605999997,
"mean":393.49249999999984,
"stddev":510.5257066635194,
"facets":{
"Status":{
"6":{
"min":1.0,
"max":1399.99,
"count":8,
"missing":0,
"sum":3147.9399999999987,
"sumOfSquares":3063146.2605999997,
"mean":393.49249999999984,
"stddev":510.5257066635194}}}}}}}

Resources