You bet.

I have created three twitter apps for imby.  The production twitter
app is in the @imby twitter account.  The staging and development
twitter apps are within the @imbyTest twitter account.  That account
is private, so people don't see all the test tweets and whatnot.

Development, Staging, and Production are the three main environments.
(I view the test environment a little differently than most, but a
test app could be created.)  Development exists on my laptop and the
laptops of the other developers.  Stage is here:
http://imby-stage.heroku.com  and then production is the
http://imby.info

You can have a callback URL to your localhost by have a URL that
contains a period, such as dev.local and then update your hosts file
on your machine.

Then, when you have to do anything with twitter, you load the
appropriate app credentials from a config file - in the case of RoR
it's in my twitter.yml file.  Rails (and most other) web apps know
what their current environment is, so that's pretty easy.  There is
nothing in your code to say "if prod, do this", etc.

In my example, /authenticated is handled by the user controller.

Does that answer the question?  Lemme know if not.


On Sat, Apr 24, 2010 at 12:31 AM, Patrick Kennedy <kenned...@gmail.com> wrote:
> My explaination is more language agnostic, and works for an oauth web
> flow.  But I like your RoR idea, and it sounds like there is support
> for "localhost" development to some extent.  I suppose /authenticated
> is the controller. How the terms dev, stage, prod fit into the rails
> design paradigm is less clear.  Can you clarify that or provide a
> simple example?
>
> Thanks for any insights.  Patrick
>
> On Sat, Apr 24, 2010 at 1:25 AM, philip crawford <philipha...@gmail.com> 
> wrote:
>> You can use a callback URL like the following to develop locally.
>>
>> http://dev.local:3000/authenticated
>>
>> Then put your dev, stage, prod callback URLs in a config.  Your app
>> should work the same regardless of the server/environment it is
>> running on.
>>
>> I also have different twitter accounts for dev/stage and prod.  My
>> prod twitter account is http://twitter.com/imby while dev & stage are
>> http://twitter.com/imbyTest  That way the @imby lists and feed does
>> not contain test tweets and whatnot.  Again, this is contained in a
>> config file so that prod => @imby and everything else => @imbyTest
>>
>>
>> On Fri, Apr 23, 2010 at 12:19 PM, Patrick Kennedy <kenned...@gmail.com> 
>> wrote:
>>> Yes, Twitter requires a callback URL. Make a test page to display (or
>>> save to file) your oAuth tokens.  Embed those tokens into your local
>>> test page (and remove that helpful test page on hosted server).
>>> Develop locally, and add if-then blocks, depending if you are local or
>>> remote.  That way, you can develop locally, and upload same file, as
>>> it will work for the remote as well.  When remote, instead of "saved"
>>> tokens, use the "live" tokens from the handshake process.
>>>
>>> ~PK
>>>
>>> On Fri, Apr 23, 2010 at 7:13 AM, kaps <kap...@yahoo.com> wrote:
>>>> Hi,
>>>>
>>>> How do you folks test your Twitter apps before uploading them to your
>>>> hosting servers?
>>>> Doesn't the Twitter callback URL have to be a valid website?  How can
>>>> we test locally?
>>>>
>>>>
>>>> Thanks,
>>>> kaps
>>>>
>>>>
>>>> --
>>>> Subscription settings: 
>>>> http://groups.google.com/group/twitter-development-talk/subscribe?hl=en
>>>>
>>>
>>
>>
>>
>> --
>> imby - in my back yard
>> An Experiment in Local Professional Networking
>> http://madison.imby.info/p/Philip.Crawford
>>
>



-- 
imby - in my back yard
An Experiment in Local Professional Networking
http://madison.imby.info/p/Philip.Crawford

Reply via email to