to_net_me_api 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/to_net_me_api/api.rb +12 -3
- data/lib/to_net_me_api/version.rb +1 -1
- metadata +1 -1
data/lib/to_net_me_api/api.rb
CHANGED
@@ -1,14 +1,23 @@
|
|
1
|
-
|
1
|
+
require 'httparty'
|
2
2
|
module ToNetMeApi
|
3
3
|
# Модуль обрабатывает запросы к API 2et.me и возвращает HTTParty объект .
|
4
4
|
module API
|
5
5
|
|
6
|
+
|
6
7
|
class << self
|
7
|
-
|
8
|
+
|
9
|
+
def set_api_core
|
10
|
+
unless ToNetMeApi.api_core
|
11
|
+
ToNetMeApi.reset
|
12
|
+
else
|
13
|
+
ToNetMeApi.api_core
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
8
17
|
def call(attrs,options={},auth_key = nil)
|
9
18
|
@auth = {:auth_key => auth_key}
|
10
19
|
options.merge!(@auth)
|
11
|
-
HTTParty.get(
|
20
|
+
HTTParty.get(set_api_core+attrs,:query => options)
|
12
21
|
end
|
13
22
|
|
14
23
|
end
|