Base CRM Rails Gem legacy search? - ruby-on-rails

It looks like Base CRM has upgraded their API and replaced all of their endpoints/parameters.
Previously I was able to retrieve "Won" deals using this call:
session = BaseCrm::Session.new("<LEGACY_ACCESS_TOKEN>")
session.deals.all(stage: :won, sort_by: :last_activity, sort_order: :desc, page: 1)
This query recently started ignoring my parameters, yet it continued to respond with unfiltered data (that was fun when I realized that was happening).
The new syntax is:
client = BaseCRM::Client.new(access_token: "<YOUR_PERSONAL_ACCESS_TOKEN>")
client.deals.where(organization_id: google.id, hot: true)
yet this does not work:
client.deals.where(stage_name: :won)
client.deals.where(stage_name: "Won")
client.deals.where(stage_id: 8) # specified ID found in Base Docs for "Won"
etc.
I've looked into the most recent updates to the Base CRM Gem as well as the Base CRM API Docs but have not found a solution to searching by specific deal stage.
Has anyone had any luck with the new API and this kind of query?
Is there a way to use the legacy API?
I've left message with Base but I really need to fix this, you know, yesterday.
Thanks for your help!
ADDITIONAL INFO
The legacy API/gem responded with JSON where the v2 API/gem responds with a BaseCRM::Deal object:
$ session.deals.find(123456)
# <BaseCRM::Deal
dropbox_email="dropbox#67890.deals.futuresimple.com",
name="Cool Deal Name",
owner_id=54321,
creator_id=65432,
value=2500,
estimated_close_date=nil,
last_activity_at="2016-04-21T02:29:43Z",
tags=[],
stage_id=84588,
contact_id=098765432,
custom_fields={:"Event Location"=>"New York, NY", :Source=>"Friend"},
last_stage_change_at="2016-04-21T02:08:20Z",
last_stage_change_by_id=559951,
created_at="2016-04-18T22:16:35Z",
id=123456,
updated_at="2016-04-21T02:08:20Z",
organization_id=nil,
hot=false,
currency="USD",
source_id=1466480,
loss_reason_id=nil
>
Checkout stage_id. Is this a bug? According to the Docs stage_id should return an integer between 1 and 10.

Related

Problem finding metrics in the new Google My Business APIs

I am having some issues migrating my Google MY Business API python code.
My original code looks like:
Get my accounts:
service, flags = sample_tools.init(argv, "mybusiness", "v4", __doc__, __file__,
scope="https://www.googleapis.com/auth/business.manage",
discovery_filename=cfg.discovery_doc_old)
output = service.accounts().list().execute()
accounts = output["accounts"]
Get my locations name per account with the following call:
self.service.accounts().locations().list(parent=account['name']).execute()
For each location I get my insights report with the following call:
service.accounts().locations().reportInsights(name=self.account, body=body).execute()
Now since these calls are going to be deprecated, I need to update this code to the new Business APis. So far I managed to reproduce step 1 & 2 of my old code:
Get my accounts (using the my business account management api):
service, flags = sample_tools.init(argv, "mybusinessaccountmanagement", "v1", __doc__, __file__,
scope="https://www.googleapis.com/auth/business.manage",
discovery_filename=cfg.discovery_doc_new)
output = self.service.accounts().list().execute()
accounts = output["accounts"]
Get my location (using my business business information api):
service, flags = sample_tools.init(argv, "mybusinessbusinessinformation", "v1", __doc__, __file__,
scope="https://www.googleapis.com/auth/business.manage",
discovery_filename=cfg.discovery_doc_gmb_info)
output = service.accounts().locations().list(parent=self.accounts[0]['name'],
readMask='name',
).execute()
locations = output['locations']
Now I am missing the equivalent to the old
reportInsights(name=self.account, body=body).execute()
I haven't found anywhere some similar. I thought maybe I need to add it as the readmask, but also could find any documentation. I basically want to get the values of these metrics for each location using one of the new APIs:
https://developers.google.com/my-business/reference/rest/v4/Metric
I already went through this tutorial, even though I prefer using the client libraries:
https://developers.google.com/my-business/content/basic-setup
but it doesn't tell me where to find these metrics.
I have also tried the same structure as in the old API but I get the error message:
AttributeError: 'Resource' object has no attribute 'reportInsights'
Can someone help me with this? I am quite new to the Google APIs and maybe there is something obvious I missing out :/
Thanks a lot,
Rafael
As #devinthemaking has stated correctly, the reportInsights method is not deprecated and does not have a successor method yet.
The list of deprecated methods can be found here: Deprecation schedule

RubyGem 'steam-condenser' - .fetch method only time and fetch_games undefined method `[]'

I am trying to get some basic information from the Steam Community via the steam-condenser gem and so far the Steam.new seems to work just fine with all the players information.
however when I do this (example)
player = SteamId.new("tiger")
stats = player.fetch_games
I get the following error message
Traceback (most recent call last):
1: from lib/assets/ruby/test.rb:15:in `<main>'
/home/zigs/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/steam-condenser-1.3.11/lib/steam/community/steam_id.rb:326:in `fetch_games': undefined method `[]' for nil:NilClass (NoMethodError)
A lot of the information I need seems to be connected to the fetch_games (for example the method total_playtime(id))
Not sure why this is not working. I am lost. Any help or ideas are highly appreciated! Thank you!
TLDR; it looks like this gem no longer works.
the particular module that you're having trouble with is:
def fetch_games
games_data = parse "#{base_url}/games?xml=1"
#games = {}
#recent_playtimes = {}
#total_playtimes = {}
games_data['games']['game'].each do |game_data|
app_id = game_data['appID'].to_i
#games[app_id] = SteamGame.new app_id, game_data
recent = game_data['hoursLast2Weeks'].to_f
total = (game_data['hoursOnRecord'] || '').delete(',').to_f
#recent_playtimes[app_id] = (recent * 60).to_i
#total_playtimes[app_id] = (total * 60).to_i
end
true
end
with the particular problem statement being games_data['games']['game'].each
If we were looking to get information for a particular user, it downloads an XML document about the user from a URL looking like:
http://steamcommunity.com/id/demomenz?xml=1
and this file does not seem to contain any games objects in it.
Having looked at the codebase for the steam-condenser gem; it hasn't really been updated in about 6 years. I can only assume that the XML format has been modified since this time and that the gem will no longer work.
Valve has added more privacy options to Steam Community profiles which are not reflected in the old XML APIs.
Apparently, the profile in question (tiger) has it‘s game details set to “Friends Only” or ”Private” as games are also unavailable in the browser.
The code from the released 1.x versions is no longer guaranteed to work when it comes to Steam Community. Valve deprecated the old XML APIs several years ago. Sadly, the modern Web API hasn‘t gotten much attention from Valve‘s side either. So development of Steam Condenser has mostly come to halt, too.
You might have more luck using the code from the master branch of the GitHub repository which uses Web API for most of the Community features.
You will have to register for a Steam Web API key, though: https://steamcommunity.com/dev/apikey

https://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.xchange where pair in ("ARSARS")&env=store://datatables.org/alltableswithkeys

I have been using the following URL for the past 3 years without issue. However, it has stopped returning results.
URL:
https://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.xchange where pair in ("ARSARS")&env=store://datatables.org/alltableswithkeys
Now returns the following:
<?xml version="1.0" encoding="UTF-8"?>
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="0" yahoo:created="2017-11-02T09:33:25Z" yahoo:lang="en-AU">
<results/>
</query><!-- total: 9 -->
Notice how there are no results, it simply has the tag "results".
I have tried on this many different computers and browsers. I have also tried changing the currency combinations, but no luck.
Can anybody spot what I am doing wrong?
Yes, it looks like Yahoo has discontinued their Currency Converter API service.
I found a different site : https://currencylayer.com/
They let you request currency rates (1 USD = 168 other currencies). If you make less than 1000 requests per month, it is free (if you need more, they have different subscriptions : https://currencylayer.com/product).
You just need to sign up and receive your own Access Code. Once you have that, then you simply make the call http://apilayer.net/api/live?access_key= and it will return JSON of the other currency rates.
They also have code examples in PHP, JavaScript, and Java at https://currencylayer.com/documentation
Found it very easy to get started using their API right away.
I think the API is down.
I am similarly receiving "results"=nullfor the query:
http://query.yahooapis.com/v1/public/yql?q=select+%2A+from+yahoo.finance.xchange+where+pair+in+%28%22GBPEUR%22%29&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys
Setting diagnostics=true in the request yields:
`
[execution-start-time] => 7
[execution-stop-time] => 12
[execution-time] => 5
[http-status-code] => 999
[http-status-message] => Request denied
[content] => http://download.finance.yahoo.com/d/quotes.csv?s=GBPEUR=X&f=snl1d1t1ab
`
If anyone knows more than me about what this might imply I'd be glad to hear it!
Yahoo is aware of this issue and their engineers are working on it:
ref: https://forums.yahoo.net/t5/Yahoo-Finance-help/http-download-finance-yahoo-com-d-quotes-csv-s-GOOG-amp-f/td-p/387096
Very sadly and quite outrageously Yahoo decided to stop this service without any warning.
See admin message here
So many services depend on it, it's like Google saying they would suddenly stop their maps API... At this point I am blocking yahoo in our DNS so no one in our company will ever use Yahoo again since they are not a reliable entity.

.NET SDK for JIRA (Atlassian.SDK) wont allow me to add a custom field even though it exists on JIRA

I am using the latest Atlassian.SDK package for .NET to integrate my application with JIRA
I am trying to create an issue as follows
Jira jiraConn = new Jira("<theurl>", "<theuser>", "<thepasswd>");
Issue objIssue = jiraConn.CreateIssue("EF");
objIssue.Type = "Escalation";
objIssue.Priority = "Major";
objIssue.Summary = "Test with custom fields";
objIssue.CustomFields.Add("Field 1", "Anthony Drive");
objIssue.SaveChanges();
However the line 'objIssue.CustomFields.Add' throws an exception stating 'Could not find custom field with name 'Field 1' on the JIRA server. Make sure this field is available when editing this issue. For more information see JRA-6857'
Is there something that i am missing ?
I am using the SDK ver 2.4.0 and JIRA version 6.3
So there is a bug in the API. When ever a custom field is added , the API fetches a random issue and checks if the field is present in it.
You would need to work with the source code to solve this issue yourself.
I had the same problem. If you use constructor Jira(...) so the API uses SOAP. But when you use Jira.CreateRestClient, client will use REST API. With REST API inserting epics works fine.
Jira jiraConn = Jira.CreateRestClient("<theurl>", "<theuser>", "<thepasswd>");

listing other than windows images from amazon using fog

I have been using fog for one of my project,i have used describe_images with filter parameters, but now i am getting only the windows images, so is there any way to get the other AMIs with changing the parameter(platform)?. lets an example 'platform => linux' something like that
spec_images = #conn.describe_images('Owner' => 'amazon','platform' => 'windows')
my_images = spec_images.body["imagesSet"]
# List image ID, architecture and location
for key in 0...my_images.length
print my_images[key]["imageId"], "\t" , my_images[key]["architecture"] , "\t\t" ,
my_images[key]["imageLocation"], "\n";
end
According to the API documentation for the DescribeInstances call...
Use windows if you have Windows based instances; otherwise, leave
blank.
So "windows" is the only valid value for that filter, presently, and according to the AWS developer forums, there isn't currently a way to filter for non-Windows instances:
It appears there is no way currently to filter for linux instances
using ec2-describe-instances. This is expected behavior and no easy
workaround at this time. We will be updating our documentation to
reflect this. I apologize for the inconvenience.

Resources