class Telegraph::Account

Constants

FIELDS

Public Class Methods

create(short_name:, author_name:, author_url:) click to toggle source
# File lib/telegraph_rb/account.rb, line 18
def create(short_name:, author_name:, author_url:)
  params = {
    short_name: short_name,
    author_name: author_name,
    author_url: author_url
  }
  response = post('createAccount', params)
  new(response)
end
edit(short_name:, author_name:, author_url:) click to toggle source
# File lib/telegraph_rb/account.rb, line 38
def edit(short_name:, author_name:, author_url:)
  params = {
    short_name: short_name,
    author_name: author_name,
    author_url: author_url,
    access_token: client.token
  }
  response = client.post('editAccountInfo', params)
  new(response)
end
get(fields: []) click to toggle source
# File lib/telegraph_rb/account.rb, line 28
def get(fields: [])
  fields = FIELDS unless fields.any?
  params = {
    fields: fields,
    access_token: client.token
  }
  response = client.get('getAccountInfo', params)
  new(response)
end
revoke_token() click to toggle source
# File lib/telegraph_rb/account.rb, line 49
def revoke_token
  response = client.post('getAccountInfo', access_token: client.token)
  new(response)
end

Private Class Methods

client() click to toggle source
# File lib/telegraph_rb/account.rb, line 56
def client
  @client ||= Telegraph.client
end