I've looked at https://www.rubydoc.info/github/google/google-api-ruby-client/Google/Apis/GmailV1/ModifyThreadRequest and the examples https://developers.google.com/gmail/api/v1/reference/users/labels/update for Python and JS but can't figure out how to format the request properly in ruby.
I'm trying:
service.modify_thread('me',thread_id,{'add_label_ids'=>['UNREAD']})
and various other permutations of the object but can't get anything other than Google::Apis::ClientError: invalidArgument: No label add or removes specified in response.
Any help appreciated
modify_thread expects a Google::Apis::GmailV1::ModifyThreadRequest object as third argument according to the documentation.
In the source of the constructor of ModifyThreadRequest you can see that it looks for a key :add_label_ids in its arguments.
So if modify_thread creates the ModifyThreadRequest object itself then
service.modify_thread('me',thread_id, add_label_ids: ['UNREAD'])
should work.
If that fails I would try
mtr = Google::Apis::GmailV1::ModifyThreadRequest.new(add_label_ids: ['UNREAD'])
service.modify_thread('me', thread_id, mtr)
After having a look at the API in llvm::CallInst , I don't see a
simple way to add any arguments to a function call that has already been generated.
Apart from creating a new function call , is there any other way to add
arguments ?
Thanks!
how to debug built-in js files in v8.(i.e v8natives.js,array.js,string.js)
Please let me know any documentations or insights regarding this.
Thanks
You can call %GlobalPrint("hello");, the argument must be converted to a string before you pass it (So don't call %GlobalPrint(1) but %GlobalPrint("1") and it only takes one argument.
List of the functions you can call is at runtime/runtime.h (with their implementations and possibly some documentation in the runtime .cc files), these are on top of the normal javascript functions you can call like JSON.parse.
For example in the apinatives.js file:
function InstantiateFunction(data, name) {
// We need a reference to kApiFunctionCache in the stack frame
// if we need to bail out from a stack overflow.
%GlobalPrint("Called instantiate function with ");
%DebugPrint(data);
%GlobalPrint("and");
%DebugPrint(name);
...
}
I am trying to build Esper EPL statements in Java.
I use the com.espertech.esper.client.soda lib for this, but I can't find
a tutorial to help me.
The PatternExpressions are the only part that I need as of now.
As an example let's use the EPL:
every a=Event((a).getEventTypeCode()='E00001')
So he should trigger on every Event with the event type code E00001, we get the code by
calling the getEventTypeCode Method.
How do I project this to SOM?
With:
PatternExpr pattern = Patterns.everyFilter("Event","a");
I only get:
every a=Event
(of course)
I know there is a class called "MethodInvocationStream" but I don't know how to use it.
And I cannot find examples for its use.
Thanks to user650839 I found out how to add Methods via SOM.
Here is a simple EPL as an SOM Object: http://imgur.com/SDrTsa7
One source of info is the javadoc.
You could simply do the reverse and compile EPL text to a model object and inspect that. Use "epAdmin.compileEPL", the output is the same object you want to build via API.\
I have reviewed Jasmine's documentation of the toHaveBeenCalledWith matcher in order to understand whether it's possible to pass in a regular expression for an argument, if that argument is expected to be a string. Unfortunately, this is unsupported functionality. There's also an issue open on github requesting this functionality.
I've dug a bit into the codebase, and I see how it might be possible to implement this inside the existing matcher. I think it would be more appropriate to implement it as a separate matcher though, so that the abstraction is captured individually.
In the meantime, what might be a good workaround?
After doing some digging, I've discovered that Jasmine spy objects have a calls property, which in turn has a mostRecent() function. This function also has a child property args, which returns an array of call arguments.
Thus, one may use the following sequence to perform a regexp match on call arguments, when one wants to check that the string arguments match a specific regular expression:
var mySpy = jasmine.createSpy('foo');
mySpy("bar", "baz");
expect(mySpy.calls.mostRecent().args[0]).toMatch(/bar/);
expect(mySpy.calls.mostRecent().args[1]).toMatch(/baz/);
Pretty straightforward.
As of Jasmine 2.2, you can use jasmine.stringMatching:
var mySpy = jasmine.createSpy('foo');
mySpy('bar', 'baz');
expect(mySpy).toHaveBeenCalledWith(
jasmine.stringMatching(/bar/),
jasmine.stringMatching(/baz/)
);
In Jasmine 2.0 the signature changed a bit. Here it would be:
var mySpy = jasmine.createSpy('foo');
mySpy("bar", "baz");
expect(mySpy.calls.mostRecent().args[0]).toMatch(/bar/);
expect(mySpy.calls.mostRecent().args[1]).toMatch(/baz/);
And the Documentation for Jasmine 1.3 has moved.
Alternatively, if you are spying on a method on an object:
spyOn(obj, 'method');
obj.method('bar', 'baz');
expect(obj.method.argsForCall[0][0]).toMatch(/bar/);
expect(obj.method.argsForCall[0][1]).toMatch(/baz/);
Sometimes it is more readable to write it this way:
spyOn(obj, 'method').and.callFake(function(arg1, arg2) {
expect(arg1).toMatch(/bar/);
expect(arg2).toMatch(/baz/);
});
obj.method('bar', 'baz');
expect(obj.method).toHaveBeenCalled();
It give more clear visibility of method arguments (instead of using array)
As jammon mentioned, the Jasmine 2.0 signature has changed. If you are spying on the method of an object in Jasmine 2.0, Nick's solution should be changed to use something like -
spyOn(obj, 'method');
obj.method('bar', 'baz');
expect(obj.method.calls.mostRecent().args[0]).toMatch(/bar/);
expect(obj.method.calls.mostRecent().args[1]).toMatch(/baz/);