Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
213 lines (179 sloc) 3.42 KB

Twitter

Based on: Twitter

postwill = Postwill::Client.new(
                   twitter: {
                     access_token: 'access_token',
                     access_token_secret: 'access_token_secret'
                   }
                 )

postwill.to(:twitter, text: 'text', image: 'image')

Success:

{
  twitter: {
    status: :ok,
    response: {} # Response data
  }
}

Failure:

{
  twitter: {
    status: :error,
    response: '' # String error message
  }
}

Settings:

Postwill::Settings.configure do |config|
  config.providers.twitter = {
    consumer_key: 'your_consumer_key',
    consumer_secret: 'your_consumer_secret'
  }
end

Facebook

Based on: Koala

postwill = Postwill::Client.new(
                   facebook: {
                     access_token: 'access_token'
                   }
                 )

postwill.to(:facebook, text: 'text', image: 'image')

Success:

{
  facebook: {
    status: :ok,
    response: {} # Response data
  }
}

Failure:

{
  facebook: {
    status: :error,
    response: '' # String error message
  }
}

Pinterest

Based on: PinterestApi

postwill = Postwill::Client.new(
                   pinterest: {
                     access_token: 'access_token'
                   }
                 )

# Reqired: [board_id image image_url]
# Optional: [text link]

postwill.to(:pinterest, text: 'text', image: 'image', board_id: 'board_id', link: 'link')
# OR
postwill.to(:pinterest, text: 'text', image_url: 'image_url', board_id: 'board_id', link: 'link')

Success:

{
  pinterest: {
    status: :ok,
    response: {
      'data' => {
        'url' => 'PIN_LINK',
        'note' => 'text',
        'link' => 'LINK',
        'id' => 'PIN_ID'
      }
    }
  }
}

Failure:

{
  pinterest: {
    status: :error,
    response: '' # String error message
  }
}

Tumblr

Based on: TumblrClient

postwill = Postwill::Client.new(
                   tumblr: {
                     access_token: 'access_token',
                     access_token_secret: 'access_token_secret'
                   }
                 )

# Reqired: [user_nickname text image title]

postwill.to(:tumblr, text: 'text', image: 'image', user: 'user_nickname')
# or
postwill.to(:tumblr, text: 'text', title: 'title', user: 'user_nickname')

Success:

{
  tumblr: {
    status: :ok,
    response: {
      {
        'id' => 'POST_ID'
      }
    }
  }
}

Failure:

{
  tumblr: {
    status: :error,
    response: '' # String error message
  }
}

Settings:

Postwill::Settings.configure do |config|
  config.providers.tumblr = {
    consumer_key: 'consumer_key',
    consumer_secret: 'consumer_secret'
  }
end

Instagram

Based on: InstagramUpload

postwill = Postwill::Client.new(
                   instagram: {
                     username: 'username',
                     password: 'password'
                   }
                 )

postwill.to(:instagram, text: 'text', image: 'image')

Success:

{
  instagram: {
    status: :ok,
    response: {} # Response data
  }
}

Failure:

{
  instagram: {
    status: :error,
    response: '' # String error message
  }
}