to_net_me_api 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +4 -0
- data/README.md +12 -1
- data/lib/to_net_me_api/api.rb +9 -11
- data/lib/to_net_me_api/client.rb +4 -10
- data/lib/to_net_me_api/configuration.rb +10 -11
- data/lib/to_net_me_api/method.rb +0 -2
- data/lib/to_net_me_api/namespace.rb +0 -6
- data/lib/to_net_me_api/resolver.rb +0 -1
- data/lib/to_net_me_api/version.rb +1 -1
- data/lib/to_net_me_api.rb +0 -2
- metadata +8 -13
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fd730f66ada69ddbd416ca29cc66b19633006970
|
4
|
+
data.tar.gz: 6b928259bf196e6461c86c5bc7c559f525c4f60e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8137e91e55ece85c4d08b497a0ff260b6242434c512f84a0269a468572618d874da1c1c56a333dcb0be30376fdf81d4dff33e766db8ae618c9168d5eadbcd243
|
7
|
+
data.tar.gz: 227e5b435a7f9ea8bd59ae67ff30ea1800eb3a0587e3f094d4ab026a4f2acf16f04a28446dba622925a5ee18e2f3cd75da132de45fde567165b0382319056a6f
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -60,8 +60,19 @@ groups.parsed_response #=> {"message"=>{"vk"=>[7389, {"gid"=>52734067, "name"=>"
|
|
60
60
|
|
61
61
|
# если API 2net.me ожидает получить параметр в виде списка,
|
62
62
|
# разделенного запятыми, то его можно передать массивом
|
63
|
-
@to_net_me.search.groups_by_id(:gids=>'2net_me,37856556,38019449
|
63
|
+
@to_net_me.search.groups_by_id(:gids=>['2net_me',37856556,38019449],:soc=>'vk')
|
64
64
|
```
|
65
|
+
|
66
|
+
### Конфигурация
|
67
|
+
``` ruby
|
68
|
+
# для смены адреса запроса api например на sandbox.api
|
69
|
+
# создайте файл конфигурации to_net_me_api.rb в папке config/initializers
|
70
|
+
# и укажите там следующее
|
71
|
+
ToNetMeApi.configure do |config|
|
72
|
+
config.api_core='http://sandbox.api.2net.me/'
|
73
|
+
end
|
74
|
+
```
|
75
|
+
|
65
76
|
### Документация
|
66
77
|
|
67
78
|
Документация к методам api находится [по адресу](http://api.2net.me/index/info).
|
data/lib/to_net_me_api/api.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
require 'httparty'
|
2
1
|
module ToNetMeApi
|
3
|
-
# Модуль обрабатывает запросы к API 2et.me и возвращает HTTParty
|
2
|
+
# Модуль обрабатывает запросы к API 2et.me и возвращает HTTParty объект.
|
4
3
|
module API
|
5
4
|
|
6
|
-
|
7
5
|
class << self
|
8
|
-
|
9
|
-
|
6
|
+
|
7
|
+
def set_api_core
|
10
8
|
unless ToNetMeApi.api_core
|
11
9
|
ToNetMeApi.reset
|
12
10
|
else
|
@@ -14,12 +12,12 @@ module ToNetMeApi
|
|
14
12
|
end
|
15
13
|
end
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
15
|
+
def call(attrs,options={},auth_key = nil)
|
16
|
+
@auth = {:auth_key => auth_key}
|
17
|
+
options.merge!(@auth)
|
18
|
+
HTTParty.get(set_api_core+attrs,:query => options)
|
19
|
+
end
|
20
|
+
|
23
21
|
end
|
24
22
|
end
|
25
23
|
|
data/lib/to_net_me_api/client.rb
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
# require '~/rubystack/projects/users_part/lib/to_net_me_api/namespace'
|
2
|
-
# require '~/rubystack/projects/users_part/lib/to_net_me_api/resolvable'
|
3
|
-
# require '~/rubystack/projects/users_part/lib/to_net_me_api/resolver'
|
4
|
-
# require '~/rubystack/projects/users_part/lib/to_net_me_api/method'
|
5
1
|
module ToNetMeApi
|
6
2
|
# Класс, представляющий соединение с api.2net.me.
|
7
3
|
class Client
|
@@ -32,9 +28,9 @@ module ToNetMeApi
|
|
32
28
|
def initialize(auth_key = nil)
|
33
29
|
if auth_key.respond_to?(:auth_key) && auth_key.respond_to?(:params)
|
34
30
|
# auth_key is an OAuth2::Accessauth_key
|
35
|
-
@auth_key
|
36
|
-
@user_id
|
37
|
-
@expires_at
|
31
|
+
@auth_key = auth_key.auth_key
|
32
|
+
@user_id = auth_key.params['user_id']
|
33
|
+
@expires_at = Time.at(auth_key.expires_at) unless auth_key.expires_at.nil?
|
38
34
|
else
|
39
35
|
# если auth_key нет или пришла строка (string)
|
40
36
|
@auth_key = auth_key
|
@@ -55,11 +51,9 @@ module ToNetMeApi
|
|
55
51
|
# Права доступа для auth_key.
|
56
52
|
# @return Symbol
|
57
53
|
def scope
|
58
|
-
|
59
54
|
SCOPE.reject do |access_scope, mask|
|
60
|
-
|
55
|
+
SCOPE.invert[settings]
|
61
56
|
end
|
62
|
-
|
63
57
|
end
|
64
58
|
|
65
59
|
# Если вызываемы метод содержется в namespace, создается новый `VkontakteApi::Namespace` инстанс.
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module ToNetMeApi
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
# Генерация модуля конфигураци
|
3
|
+
#
|
4
|
+
# ToNetMeApi::Configuration
|
5
|
+
module Configuration
|
6
|
+
#доступные опции для конфигурации
|
7
7
|
OPTION_NAMES = [
|
8
|
-
|
8
|
+
:api_core,
|
9
9
|
]
|
10
10
|
|
11
11
|
attr_accessor *OPTION_NAMES
|
@@ -15,15 +15,14 @@ module ToNetMeApi
|
|
15
15
|
|
16
16
|
# Можно задавать конфигурацию для гема так:
|
17
17
|
# ToNetMeApi.configure {|config| config.api_core='http://sandbox.api.2net.me/'}
|
18
|
-
|
19
18
|
def configure
|
20
|
-
|
21
|
-
|
19
|
+
yield self if block_given?
|
20
|
+
self
|
22
21
|
end
|
23
22
|
|
24
23
|
#установка всех конфигураций в дефолтное значение
|
25
24
|
def reset
|
26
|
-
|
25
|
+
@api_core = DAFAULT_API_ADDRESS
|
27
26
|
end
|
28
|
-
|
27
|
+
end
|
29
28
|
end
|
data/lib/to_net_me_api/method.rb
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
require '~/rubystack/projects/users_part/lib/to_net_me_api/resolvable'
|
2
|
-
require '~/rubystack/projects/users_part/lib/to_net_me_api/resolver'
|
3
|
-
require 'yaml'
|
4
|
-
|
5
1
|
module ToNetMeApi
|
6
2
|
# API метод namespace (такие как `users` или `search`).
|
7
3
|
#
|
@@ -14,9 +10,7 @@ module ToNetMeApi
|
|
14
10
|
|
15
11
|
# создает и вызывает `ToNetMeApi::Method` используя `ToNetMeApi::Resolver#call_method`.
|
16
12
|
def method_missing(*args, &block)
|
17
|
-
|
18
13
|
call_method(args, &block)
|
19
|
-
|
20
14
|
end
|
21
15
|
|
22
16
|
class << self
|
data/lib/to_net_me_api.rb
CHANGED
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: to_net_me_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
5
|
-
prerelease:
|
4
|
+
version: '0.4'
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Sergey Chechaev
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-10-25 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: httparty
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: hashie
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -52,6 +47,7 @@ extensions: []
|
|
52
47
|
extra_rdoc_files: []
|
53
48
|
files:
|
54
49
|
- .gitignore
|
50
|
+
- .travis.yml
|
55
51
|
- CHANGELOG.md
|
56
52
|
- README.md
|
57
53
|
- lib/to_net_me_api.rb
|
@@ -70,26 +66,25 @@ files:
|
|
70
66
|
homepage: https://github.com/sergey-chechaev/to_net_me_api
|
71
67
|
licenses:
|
72
68
|
- ''
|
69
|
+
metadata: {}
|
73
70
|
post_install_message:
|
74
71
|
rdoc_options: []
|
75
72
|
require_paths:
|
76
73
|
- lib
|
77
74
|
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
-
none: false
|
79
75
|
requirements:
|
80
|
-
- -
|
76
|
+
- - '>='
|
81
77
|
- !ruby/object:Gem::Version
|
82
78
|
version: 1.9.3
|
83
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
-
none: false
|
85
80
|
requirements:
|
86
|
-
- -
|
81
|
+
- - '>='
|
87
82
|
- !ruby/object:Gem::Version
|
88
83
|
version: '0'
|
89
84
|
requirements: []
|
90
85
|
rubyforge_project:
|
91
|
-
rubygems_version:
|
86
|
+
rubygems_version: 2.0.6
|
92
87
|
signing_key:
|
93
|
-
specification_version:
|
88
|
+
specification_version: 4
|
94
89
|
summary: Ruby wrapper for api.2net.me
|
95
90
|
test_files: []
|