mirror of
https://github.com/samsonjs/instapaper.git
synced 2026-04-26 14:47:42 +00:00
add some examples
This commit is contained in:
parent
327b6f4120
commit
b2c0d13f01
3 changed files with 34 additions and 0 deletions
12
examples/obtain_a_list_of_folders.rb
Normal file
12
examples/obtain_a_list_of_folders.rb
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
require 'instapaper'
|
||||||
|
|
||||||
|
credentials = {
|
||||||
|
consumer_key: 'CONSUMER_KEY',
|
||||||
|
consumer_secret: 'CONSUMER_SECRET',
|
||||||
|
oauth_token: 'OAUTH_TOKEN',
|
||||||
|
oauth_token_secret: 'OAUTH_TOKEN_SECRET',
|
||||||
|
}
|
||||||
|
|
||||||
|
client = Instapaper::Client.new(credentials)
|
||||||
|
client.folders
|
||||||
|
# => [#<Instapaper::Folder title="Design" display_title="Design" sync_to_mobile=true folder_id=1234567 position="1" type="folder" slug="design">]
|
||||||
10
examples/obtain_an_access_token.rb
Normal file
10
examples/obtain_an_access_token.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
require 'instapaper'
|
||||||
|
|
||||||
|
credentials = {
|
||||||
|
consumer_key: 'CONSUMER_KEY',
|
||||||
|
consumer_secret: 'CONSUMER_SECRET',
|
||||||
|
}
|
||||||
|
|
||||||
|
client = Instapaper::Client.new(credentials)
|
||||||
|
client.access_token('username', 'password')
|
||||||
|
# => #<Instapaper::Credentials oauth_token="710c838347ae178b4a92c6912e7e72e16c7e42f2" oauth_token_secret="XSXuU7TxBCzbKLjHH4R5iv8wfESLjeY9DI9sAdRBmCnui1E64m">
|
||||||
12
examples/verify_oauth_credentials.rb
Normal file
12
examples/verify_oauth_credentials.rb
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
require 'instapaper'
|
||||||
|
|
||||||
|
credentials = {
|
||||||
|
consumer_key: 'CONSUMER_KEY',
|
||||||
|
consumer_secret: 'CONSUMER_SECRET',
|
||||||
|
oauth_token: 'OAUTH_TOKEN',
|
||||||
|
oauth_token_secret: 'OAUTH_TOKEN_SECRET',
|
||||||
|
}
|
||||||
|
|
||||||
|
client = Instapaper::Client.new(credentials)
|
||||||
|
client.verify_credentials
|
||||||
|
# => #<Instapaper::User username="username" user_id=123456 type="user" subscription_is_active=false>
|
||||||
Loading…
Reference in a new issue