Class: TelegraphApi::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/telegraph_api_ruby/client.rb

Constant Summary collapse

API_URL =
'https://api.telegra.ph/'.freeze
REQUEST_RESPONSE =
{
  create_account: Types::,
  edit_account_info: Types::,
  get_account_info: Types::,
  revoke_access_token: Types::,
  create_page: Types::Page,
  edit_page: Types::Page,
  get_page: Types::Page,
  get_page_list: Types::PageList,
  get_views: Types::PageViews
}.freeze

Class Method Summary collapse

Class Method Details

.method_missing(method, *args, &block) ⇒ Object



21
22
23
24
# File 'lib/telegraph_api_ruby/client.rb', line 21

def self.method_missing(method, *args, &block)
  path = ActiveSupport::Inflector.camelize(method.to_s, false)
  Request.call(path, *args, REQUEST_RESPONSE[method.to_sym])
end

.respond_to_missing?(method, include_all = false) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/telegraph_api_ruby/client.rb', line 26

def self.respond_to_missing?(method, include_all = false)
  REQUEST_RESPONSE[method.to_sym] || super
end