Using Google service discovery API's with Pharo Smalltalk by Richard J. Prinz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Using Google service discovery API's with Pharo Smalltalk by Richard J. Prinz

Sven Van Caekenberghe-2
I hadn't seen this posted on the mailing list, but this is really cool stuff.

Using Google service discovery API's with Pharo Smalltalk by Richard J. Prinz

>   http://www.min.at/prinz/?x=entry:entry150318-104537 <http://www.min.at/prinz/?x=entry:entry150318-104537;comments:1#comments>
Nice work, Richard !

Sven
Reply | Threaded
Open this post in threaded view
|

Re: Using Google service discovery API's with Pharo Smalltalk by Richard J. Prinz

Andy Burnett
Sven wrote
<<<
I hadn't seen this posted on the mailing list, but this is really cool stuff.

Using Google service discovery API's with Pharo Smalltalk by Richard J. Prinz

http://www.min.at/prinz/?x=entry:entry150318-104537 <http://www.min.at/prinz/?x=entry:entry150318-104537;comments:1#comments>

>>>

I totally agree with this.  I have played with the code, and started writing some code which manipulates the Google services. It is really powerful.

Also, Richard has developed a slick way of dealing with OAuth when running a client app.  This is great!
Reply | Threaded
Open this post in threaded view
|

Re: Using Google service discovery API's with Pharo Smalltalk by Richard J. Prinz

stepharo
In reply to this post by Sven Van Caekenberghe-2
+ 1
and it is on pharo weekly :)


Le 23/3/15 22:17, Sven Van Caekenberghe a écrit :
> I hadn't seen this posted on the mailing list, but this is really cool stuff.
>
> Using Google service discovery API's with Pharo Smalltalk by Richard J. Prinz
>
>>    http://www.min.at/prinz/?x=entry:entry150318-104537 <http://www.min.at/prinz/?x=entry:entry150318-104537;comments:1#comments>
> Nice work, Richard !
>
> Sven
>


Reply | Threaded
Open this post in threaded view
|

Re: Using Google service discovery API's with Pharo Smalltalk by Richard J. Prinz

Sean P. DeNigris
Administrator
In reply to this post by Andy Burnett
Andy Burnett wrote
Using Google service discovery API's with Pharo Smalltalk by Richard J.
Prinz
Cool! I noticed a small bug. GoogleGmailApiUsersMessages>>#send: does not accept an argument for the actual message. Maybe it has to do with that requirement is defined in the Message definition?
    "Message": {
    ...
        "raw": {
    ...
          "required": [
          "gmail.users.drafts.create",
          "gmail.users.drafts.update",
          "gmail.users.messages.insert",
          "gmail.users.messages.send"
          ]
        }
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Using Google service discovery API's with Pharo Smalltalk by Richard J. Prinz

Sean P. DeNigris
Administrator
Sean P. DeNigris wrote
Andy Burnett wrote
Using Google service discovery API's with Pharo Smalltalk by Richard J. Prinz
Cool! I noticed a small bug
I created a new repo at https://github.com/seandenigris/St-Google-API since the original repo is self-hosted, I don't know what the contribution policy is, and I need the fix to continue my work. I'll keep the MC meta info so that my changes can be merged back if desired.

Fun fact. I was able to send a multipart text & html email after a few gotchas. Here is the script in case someone wants to do the same:
        | api message raw |
        api := GoogleGmailApiUsersMessages new.
        api authenticate.
        message := MailMessage
                from: '"Mr. Sender" <me@myurl.com>'
                to: { '"Mrs. Receiver" <me@anotherurl.com>'. }
                about: 'Thank you!'
                asFollows: ''.
        message
                addAlternativePart: self plainTextString contentType: 'text/plain';
                addAlternativePart: self htmlString
                        contentType: 'text/html'.
        raw := message asSendableText base64Encoded.
        "Web-safe base64 from https://stackoverflow.com/questions/26663529/invalid-value-for-bytestring-error-when-calling-gmail-send-api-with-base64-encod"
        raw := raw copyReplaceAll: '+' with: '-'.
        raw := raw copyReplaceAll: '/' with: '_'.
        api send: 'me@myurl.com' api options: (Dictionary with: 'raw' -> raw)

where #send:options: is just the generated #send: with an argument passed through (instead of nil) as the last argument to:
        ...
        ^ self makeRequestTo: path usingMethod: action with: optionsDict.
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Using Google service discovery API's with Pharo Smalltalk by Richard J. Prinz

stepharo
Hi sean

I did not get the time to look at the code but do you think that there
are meta operations such as compiling code
I was planning to have a look if I can use it as an example for a
reflection lecture.

Stef

Le 7/11/15 18:16, Sean P. DeNigris a écrit :

> Sean P. DeNigris wrote
>> Andy Burnett wrote
>>> Using Google service discovery API's with Pharo Smalltalk by Richard J.
>>> Prinz
>> Cool! I noticed a small bug
> I created a new repo at https://github.com/seandenigris/St-Google-API since
> the original repo is self-hosted, I don't know what the contribution policy
> is, and I need the fix to continue my work. I'll keep the MC meta info so
> that my changes can be merged back if desired.
>
> Fun fact. I was able to send a multipart text & html email after a few
> gotchas. Here is the script in case someone wants to do the same:
> | api message raw |
> api := GoogleGmailApiUsersMessages new.
> api authenticate.
> message := MailMessage
> from: '"Mr. Sender" <[hidden email]>'
> to: { '"Mrs. Receiver" <[hidden email]>'. }
> about: 'Thank you!'
> asFollows: ''.
> message
> addAlternativePart: self plainTextString contentType: 'text/plain';
> addAlternativePart: self htmlString
> contentType: 'text/html'.
> raw := message asSendableText base64Encoded.
> "Web-safe base64 from
> https://stackoverflow.com/questions/26663529/invalid-value-for-bytestring-error-when-calling-gmail-send-api-with-base64-encod"
> raw := raw copyReplaceAll: '+' with: '-'.
> raw := raw copyReplaceAll: '/' with: '_'.
> api send: '[hidden email]' api options: (Dictionary with: 'raw' -> raw)
>
> where #send:options: is just the generated #send: with an argument passed
> through (instead of nil) as the last argument to:
> ...
> ^ self makeRequestTo: path usingMethod: action with: optionsDict.
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/Using-Google-service-discovery-API-s-with-Pharo-Smalltalk-by-Richard-J-Prinz-tp4814538p4859733.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Using Google service discovery API's with Pharo Smalltalk by Richard J. Prinz

Sean P. DeNigris
Administrator
stepharo wrote
do you think that there
are meta operations such as compiling code
The library reads the discovery API and compiles corresponding Pharo classes to wrap the REST API operations.
Cheers,
Sean