Module: ToNetMeApi::API

Defined in:
lib/to_net_me_api/api.rb

Overview

Модуль обрабатывает запросы к API 2et.me и возвращает HTTParty объект.

Class Method Summary collapse

Class Method Details

.call(attrs, options = {}, auth_key = nil) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/to_net_me_api/api.rb', line 23

def call(attrs,options={},auth_key = nil)
  # установка http глагола по умолчанию
  set_http_verb

  @auth = {:auth_key => auth_key}
  options.merge!(@auth)
  if ToNetMeApi.http_verb == :post 
    HTTParty.post(set_api_core+attrs, :body => options)
  else
    HTTParty.get(set_api_core+attrs,:query => options)
  end
end

.set_api_coreObject



7
8
9
10
11
12
13
# File 'lib/to_net_me_api/api.rb', line 7

def set_api_core
  unless ToNetMeApi.api_core
    ToNetMeApi.set_api_core
  else
    ToNetMeApi.api_core
  end
end

.set_http_verbObject



15
16
17
18
19
20
21
# File 'lib/to_net_me_api/api.rb', line 15

def set_http_verb
  unless ToNetMeApi.http_verb
    ToNetMeApi.set_http_verb
  else
    ToNetMeApi.http_verb
  end
end