professionali 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +41 -0
- data/Rakefile +1 -0
- data/lib/professionali.rb +17 -0
- data/lib/professionali/api/enterprises.rb +17 -0
- data/lib/professionali/api/groups.rb +90 -0
- data/lib/professionali/api/invites.rb +61 -0
- data/lib/professionali/api/messages.rb +45 -0
- data/lib/professionali/api/notify.rb +13 -0
- data/lib/professionali/api/push_notify.rb +21 -0
- data/lib/professionali/api/search.rb +9 -0
- data/lib/professionali/api/storage.rb +13 -0
- data/lib/professionali/api/tape.rb +17 -0
- data/lib/professionali/api/users.rb +37 -0
- data/lib/professionali/api_core.rb +62 -0
- data/lib/professionali/client.rb +64 -0
- data/lib/professionali/config.rb +6 -0
- data/lib/professionali/errors.rb +17 -0
- data/lib/professionali/mash.rb +16 -0
- data/lib/professionali/version.rb +3 -0
- data/professionali.gemspec +26 -0
- metadata +137 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c99fe38ce231713dd528d9866bbc13c4b9c14664
|
4
|
+
data.tar.gz: 288b3741bc31d3bc8af42785e480858e0ac36122
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 447ee907a9df07bc5c1d24ea09dfa9f0c220c270f23be9b1443e65a82dd5829c3c4da6c5ea0075a92eed0e4dc6c0e65654e88f019ab19f478f36d3cdabddb4cf
|
7
|
+
data.tar.gz: 5c36faa9f9c62a386c5bf67491b726f4f7a71e7d754e01ee935b6df109d597383174af2590fe903c9d488dd712fd5c35e1cee63b800844a81ccb44e74a8a4d00
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Sergey Efremov
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Professionali
|
2
|
+
|
3
|
+
It's ruby wrapper for [Professionali](http://dev.professionali.ru)'s API.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'professionali'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install professionali
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Create a client by providing access token:
|
22
|
+
|
23
|
+
client = Professionali::Client.new token
|
24
|
+
|
25
|
+
Then just use same bindings as in API documentation. Examples:
|
26
|
+
|
27
|
+
client.users.get("me", "id,firstname,lastname,name,birthday,gender,avatar_big,link,languages")
|
28
|
+
client.users.schools("me")
|
29
|
+
client.search.get('Ruby')
|
30
|
+
|
31
|
+
Responce retunred as Hashie::Mash.
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
## Contributing
|
36
|
+
|
37
|
+
1. Fork it
|
38
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
39
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
40
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
41
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Professionali
|
2
|
+
|
3
|
+
class << self
|
4
|
+
attr_accessor :token
|
5
|
+
|
6
|
+
def configure
|
7
|
+
yield self
|
8
|
+
true
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
autoload :Config, "professionali/config"
|
13
|
+
autoload :Version, "professionali/version"
|
14
|
+
autoload :Mash, "professionali/mash"
|
15
|
+
autoload :Errors, "professionali/errors"
|
16
|
+
autoload :Client, "professionali/client"
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Professionali
|
2
|
+
module Api
|
3
|
+
class Enterprises < Professionali::ApiCore
|
4
|
+
def get(id, fields = "id, name")
|
5
|
+
api_call 'enterprises/get.json', 'get', {id: id, fields: fields}
|
6
|
+
end
|
7
|
+
|
8
|
+
def positions(id = "me")
|
9
|
+
api_call 'enterprises/positions.json', 'get', {id: id}
|
10
|
+
end
|
11
|
+
|
12
|
+
def staff(id, filter = "all")
|
13
|
+
api_call 'enterprises/staff.json', 'get', {id: id, filter: filter}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
module Professionali
|
2
|
+
module Api
|
3
|
+
class Groups < Professionali::ApiCore
|
4
|
+
def get_random
|
5
|
+
api_call 'groups/getRandom.json', 'get'
|
6
|
+
end
|
7
|
+
|
8
|
+
def get(ids = "me", fields = "id,title,summary")
|
9
|
+
api_call 'groups/get.json', 'get'
|
10
|
+
end
|
11
|
+
|
12
|
+
def get_my_groups
|
13
|
+
api_call 'groups/getMyGroups.json', 'get'
|
14
|
+
end
|
15
|
+
|
16
|
+
def get_groups_catalog(fields = "id,title,summary", options = {})
|
17
|
+
api_call 'groups/getGroupsCatalog.json', 'get', options.merge(fields: fields)
|
18
|
+
end
|
19
|
+
|
20
|
+
def get_group_admins(id)
|
21
|
+
api_call 'groups/getGroupAdmins.json', 'get', {id: id}
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_group_topics(options)
|
25
|
+
api_call 'groups/getGroupTopics.json', 'get', options
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_topic(id, fields)
|
29
|
+
api_call 'groups/getTopic.json', 'get', {id: id, fields: fields}
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_new_topics(options)
|
33
|
+
api_call 'groups/getNewTopics.json', 'get', options
|
34
|
+
end
|
35
|
+
|
36
|
+
def get_top_100_topics(options)
|
37
|
+
api_call 'groups/getTop100Topics.json', 'get', options
|
38
|
+
end
|
39
|
+
|
40
|
+
def get_comments(options)
|
41
|
+
api_call 'groups/getComments.json', 'get', options
|
42
|
+
end
|
43
|
+
|
44
|
+
def get_topic_likers(options)
|
45
|
+
api_call 'groups/getTopicLikers.json', 'get', options
|
46
|
+
end
|
47
|
+
|
48
|
+
def fave(id, fave = "1")
|
49
|
+
api_call 'groups/fave.json', 'get', {id: id, fave: fave}
|
50
|
+
end
|
51
|
+
|
52
|
+
def group_apply(id)
|
53
|
+
api_call 'groups/groupApply.json', 'get', {group_id: id}
|
54
|
+
end
|
55
|
+
|
56
|
+
def group_leave(id)
|
57
|
+
api_call 'groups/groupLeave.json', 'get', {group_id: id}
|
58
|
+
end
|
59
|
+
|
60
|
+
def group_invite(options)
|
61
|
+
api_call 'groups/groupInvite.json', 'get', options
|
62
|
+
end
|
63
|
+
|
64
|
+
def add_comment(options)
|
65
|
+
api_call 'groups/addComment.json', 'get', options
|
66
|
+
end
|
67
|
+
|
68
|
+
def topic_subscribe(options)
|
69
|
+
api_call 'groups/topicSubscribe.json', 'get', options
|
70
|
+
end
|
71
|
+
|
72
|
+
def get_faved_topics(options)
|
73
|
+
api_call 'groups/getFavedTopics.json', 'get', options
|
74
|
+
end
|
75
|
+
|
76
|
+
def get_rights(options)
|
77
|
+
api_call 'groups/getRights.json', 'get', options
|
78
|
+
end
|
79
|
+
|
80
|
+
def like_topic(options)
|
81
|
+
api_call 'groups/likeTopic.json', 'get', options
|
82
|
+
end
|
83
|
+
|
84
|
+
def add_topic_view(id)
|
85
|
+
api_call 'groups/addTopicView.json', 'get', {topic_id: id}
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Professionali
|
2
|
+
module Api
|
3
|
+
class Invites < Professionali::ApiCore
|
4
|
+
def accept(id)
|
5
|
+
api_call 'invites/accept.json', 'post', id: id
|
6
|
+
end
|
7
|
+
|
8
|
+
def count(options = {})
|
9
|
+
api_call 'invites/count.json', 'post', options
|
10
|
+
end
|
11
|
+
|
12
|
+
def delete(ids)
|
13
|
+
api_call 'invites/delete.json', 'post', ids: ids
|
14
|
+
end
|
15
|
+
|
16
|
+
def deny(ids)
|
17
|
+
api_call 'invites/deny.json', 'post', ids: ids
|
18
|
+
end
|
19
|
+
|
20
|
+
def faved(ids)
|
21
|
+
api_call 'invites/faved.json', 'post', ids: ids
|
22
|
+
end
|
23
|
+
|
24
|
+
def get(options = {})
|
25
|
+
api_call 'invites/get.json', 'post', options
|
26
|
+
end
|
27
|
+
|
28
|
+
def new(options)
|
29
|
+
api_call 'invites/new.json', 'post', options
|
30
|
+
end
|
31
|
+
|
32
|
+
def read(ids)
|
33
|
+
api_call 'invites/read.json', 'post', ids: ids
|
34
|
+
end
|
35
|
+
|
36
|
+
def trash(ids)
|
37
|
+
api_call 'invites/trash.json', 'post', ids: ids
|
38
|
+
end
|
39
|
+
|
40
|
+
def unfaved(ids)
|
41
|
+
api_call 'invites/unfaved.json', 'post', ids: ids
|
42
|
+
end
|
43
|
+
|
44
|
+
def unread(ids)
|
45
|
+
api_call 'invites/unread.json', 'post', ids: ids
|
46
|
+
end
|
47
|
+
|
48
|
+
def untrash(ids)
|
49
|
+
api_call 'invites/untrash.json', 'post', ids: ids
|
50
|
+
end
|
51
|
+
|
52
|
+
def get_can_contact_invite(ids)
|
53
|
+
api_call 'invites/getCanContactInvite.json', 'get', ids: ids
|
54
|
+
end
|
55
|
+
|
56
|
+
def get_can_app_invite(ids)
|
57
|
+
api_call 'invites/GetCanAppInvite.json', 'get', ids: ids
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Professionali
|
2
|
+
module Api
|
3
|
+
class Messages < Professionali::ApiCore
|
4
|
+
def count(options = {})
|
5
|
+
api_call 'messages/count.json', 'get', options
|
6
|
+
end
|
7
|
+
|
8
|
+
def delete(ids)
|
9
|
+
api_call 'messages/delete.json', 'post', ids: ids
|
10
|
+
end
|
11
|
+
|
12
|
+
def faved(ids)
|
13
|
+
api_call 'messages/faved.json', 'post', ids: ids
|
14
|
+
end
|
15
|
+
|
16
|
+
def get(options = {})
|
17
|
+
api_call 'messages/get.json', 'get', options
|
18
|
+
end
|
19
|
+
|
20
|
+
def new(options = {})
|
21
|
+
api_call 'messages/new.json', 'post', options
|
22
|
+
end
|
23
|
+
|
24
|
+
def read(ids)
|
25
|
+
api_call 'messages/read.json', 'post', ids: ids
|
26
|
+
end
|
27
|
+
|
28
|
+
def trash(ids)
|
29
|
+
api_call 'messages/trash.json', 'post', ids: ids
|
30
|
+
end
|
31
|
+
|
32
|
+
def unfaved(ids)
|
33
|
+
api_call 'messages/unfaved.json', 'post', ids: ids
|
34
|
+
end
|
35
|
+
|
36
|
+
def unread(ids)
|
37
|
+
api_call 'messages/unread.json', 'post', ids: ids
|
38
|
+
end
|
39
|
+
|
40
|
+
def untrash(ids)
|
41
|
+
api_call 'messages/untrash.json', 'post', ids: ids
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Professionali
|
2
|
+
module Api
|
3
|
+
class PushNotify < Professionali::ApiCore
|
4
|
+
def subscribe(id, type)
|
5
|
+
api_call 'push-notify/subscribe.json', 'post', {id: id, type: type}
|
6
|
+
end
|
7
|
+
|
8
|
+
def unsubscribe(id, type)
|
9
|
+
api_call 'push-notify/unsubscribe.json', 'post', {id: id, type: type}
|
10
|
+
end
|
11
|
+
|
12
|
+
def is_subscribe(id, type)
|
13
|
+
api_call 'push-notify/isSubscribe.json', 'get', {id: id, type: type}
|
14
|
+
end
|
15
|
+
|
16
|
+
def is_subscribe(message, id, type)
|
17
|
+
api_call 'push-notify/test.json', 'post', {id: id, type: type, message: message}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Professionali
|
2
|
+
module Api
|
3
|
+
class Tape < Professionali::ApiCore
|
4
|
+
def get(options)
|
5
|
+
api_call 'tape/get.json', 'get', options
|
6
|
+
end
|
7
|
+
|
8
|
+
def notify_myself(options)
|
9
|
+
api_call 'tape/notifyMyself.json', 'post', options
|
10
|
+
end
|
11
|
+
|
12
|
+
def notify_watchers(options)
|
13
|
+
api_call 'tape/notifyWatchers.json', 'post', options
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Professionali
|
2
|
+
module Api
|
3
|
+
class Users < Professionali::ApiCore
|
4
|
+
def get(ids = "me", options = { fields: "name,avatar_medium,birthday" })
|
5
|
+
api_call 'users/get.json', 'get', options.merge("ids[]" => ids)
|
6
|
+
end
|
7
|
+
|
8
|
+
def activities(id = "me", options = {})
|
9
|
+
api_call 'users/activity.json', 'get', options.merge(id: id)
|
10
|
+
end
|
11
|
+
|
12
|
+
def schools(id = "me")
|
13
|
+
api_call 'users/schools.json', 'get', {id: id}
|
14
|
+
end
|
15
|
+
|
16
|
+
def contacts(id = "me")
|
17
|
+
api_call 'users/сontacts.json', 'get', {id: id}
|
18
|
+
end
|
19
|
+
|
20
|
+
def visitors(id = "me")
|
21
|
+
api_call 'users/visitors.json', 'get', {id: id}
|
22
|
+
end
|
23
|
+
|
24
|
+
def set_action(message)
|
25
|
+
api_call 'users/setAction.json', 'post', {message: message}
|
26
|
+
end
|
27
|
+
|
28
|
+
def is_connected(id)
|
29
|
+
api_call 'users/isConnected.json', 'get', {id: id}
|
30
|
+
end
|
31
|
+
|
32
|
+
def view_user_page(id)
|
33
|
+
api_call 'users/viewUserPage.json', 'get', {id: id}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Professionali
|
2
|
+
class ApiCore
|
3
|
+
attr_accessor :token
|
4
|
+
|
5
|
+
def initialize token
|
6
|
+
@token = token
|
7
|
+
end
|
8
|
+
|
9
|
+
def api_call path, method = "get", params = {}
|
10
|
+
params = params.merge(access_token: @token)
|
11
|
+
begin
|
12
|
+
case method
|
13
|
+
when "get"
|
14
|
+
response = RestClient.get api_url(path), params: params
|
15
|
+
when "put"
|
16
|
+
response = RestClient.put api_url(path), params: params, accept: :json
|
17
|
+
when "post"
|
18
|
+
response = RestClient.post api_url(path), params: params, accept: :json
|
19
|
+
else
|
20
|
+
response = RestClient.send method, api_url(path), params: params
|
21
|
+
end
|
22
|
+
|
23
|
+
rescue => e
|
24
|
+
raise_errors e.response
|
25
|
+
end
|
26
|
+
Professionali::Mash.from_json response.body
|
27
|
+
end
|
28
|
+
|
29
|
+
def raise_errors response
|
30
|
+
case response.code.to_i
|
31
|
+
when 400
|
32
|
+
data = Mash.from_json(response.body)
|
33
|
+
raise Professionali::Errors::GeneralError.new(data), "(#{data.status}): #{data.message}"
|
34
|
+
when 403
|
35
|
+
raise Professionali::Errors::AccessDeniedError, "(#{response.code}): #{response.message}"
|
36
|
+
when 405, 401
|
37
|
+
raise Professionali::Errors::UnauthorizedError, "(#{response.code}): #{response.message}"
|
38
|
+
when 404
|
39
|
+
raise Professionali::Errors::NotFoundError, "(#{response.code}): #{response.message}"
|
40
|
+
when 500
|
41
|
+
raise Professionali::Errors::InformWhitLiError, "Professionali had an internal error. (#{response.code}): #{response.message}"
|
42
|
+
when 502..503
|
43
|
+
raise Professionali::Errors::UnavailableError, "(#{response.code}): #{response.message}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def post
|
48
|
+
:post
|
49
|
+
end
|
50
|
+
|
51
|
+
def get
|
52
|
+
:get
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def api_url(path)
|
58
|
+
[Professionali::Config::API_URL, "v#{Professionali::Config::API_VERSION}",
|
59
|
+
path].join("/")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'rest_client'
|
2
|
+
require 'professionali/api_core'
|
3
|
+
require 'professionali/api/enterprises'
|
4
|
+
require 'professionali/api/groups'
|
5
|
+
require 'professionali/api/invites'
|
6
|
+
require 'professionali/api/messages'
|
7
|
+
require 'professionali/api/notify'
|
8
|
+
require 'professionali/api/push_notify'
|
9
|
+
require 'professionali/api/search'
|
10
|
+
require 'professionali/api/storage'
|
11
|
+
require 'professionali/api/tape'
|
12
|
+
require 'professionali/api/users'
|
13
|
+
|
14
|
+
module Professionali
|
15
|
+
class Client
|
16
|
+
|
17
|
+
attr_accessor :token, :cl_enterprise, :cl_groups, :cl_invites, :cl_messages,
|
18
|
+
:cl_notify, :cl_push_notify, :cl_search, :cl_storage, :cl_tape, :cl_users
|
19
|
+
|
20
|
+
def initialize token
|
21
|
+
@token = token
|
22
|
+
end
|
23
|
+
|
24
|
+
def enterprises
|
25
|
+
@cl_enterprises ||= Professionali::Api::Enterprises.new(@token)
|
26
|
+
end
|
27
|
+
|
28
|
+
def groups
|
29
|
+
@cl_groups ||= Professionali::Api::Groups.new(@token)
|
30
|
+
end
|
31
|
+
|
32
|
+
def invites
|
33
|
+
@cl_invites ||= Professionali::Api::Invites.new(@token)
|
34
|
+
end
|
35
|
+
|
36
|
+
def messages
|
37
|
+
@cl_messages ||= Professionali::Api::Messages.new(@token)
|
38
|
+
end
|
39
|
+
|
40
|
+
def notify
|
41
|
+
@cl_notify ||= Professionali::Api::Notify.new(@token)
|
42
|
+
end
|
43
|
+
|
44
|
+
def push_notify
|
45
|
+
@cl_push_notify ||= Professionali::Api::PushNotify.new(@token)
|
46
|
+
end
|
47
|
+
|
48
|
+
def search
|
49
|
+
@cl_search ||= Professionali::Api::Search.new(@token)
|
50
|
+
end
|
51
|
+
|
52
|
+
def storage
|
53
|
+
@cl_storage ||= Professionali::Api::Storage.new(@token)
|
54
|
+
end
|
55
|
+
|
56
|
+
def tape
|
57
|
+
@cl_tape ||= Professionali::Api::Tape.new(@token)
|
58
|
+
end
|
59
|
+
|
60
|
+
def users
|
61
|
+
@cl_users ||= Professionali::Api::Users.new(@token)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Professionali
|
2
|
+
module Errors
|
3
|
+
class ProfessionaliError < StandardError
|
4
|
+
attr_reader :data
|
5
|
+
def initialize(data)
|
6
|
+
@data = data
|
7
|
+
super
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class UnauthorizedError < ProfessionaliError; end
|
12
|
+
class GeneralError < ProfessionaliError; end
|
13
|
+
class AccessDeniedError < ProfessionaliError; end
|
14
|
+
class UnavailableError < ProfessionaliError; end
|
15
|
+
class NotFoundError < ProfessionaliError; end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'hashie'
|
2
|
+
require 'multi_json'
|
3
|
+
|
4
|
+
module Professionali
|
5
|
+
class Mash < ::Hashie::Mash
|
6
|
+
def self.from_json(json_string)
|
7
|
+
result_hash = ::MultiJson.decode(json_string)
|
8
|
+
puts result_hash
|
9
|
+
if result_hash.is_a?(Array)
|
10
|
+
result_hash.map{ |e| new(e) }
|
11
|
+
else
|
12
|
+
new(result_hash)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'professionali/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "professionali"
|
8
|
+
spec.version = Professionali::VERSION
|
9
|
+
spec.authors = ["Sergey Efremov"]
|
10
|
+
spec.email = ["efremov.sergey@gmail.com"]
|
11
|
+
spec.description = "Ruby wrapper for Professionali's API"
|
12
|
+
spec.summary = "Ruby wrapper for Professionali's API"
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'multi_json'
|
22
|
+
spec.add_dependency 'rest-client'
|
23
|
+
spec.add_dependency 'hashie'
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: professionali
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sergey Efremov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-07-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: multi_json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rest-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: hashie
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Ruby wrapper for Professionali's API
|
84
|
+
email:
|
85
|
+
- efremov.sergey@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- .gitignore
|
91
|
+
- Gemfile
|
92
|
+
- LICENSE.txt
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- lib/professionali.rb
|
96
|
+
- lib/professionali/api/enterprises.rb
|
97
|
+
- lib/professionali/api/groups.rb
|
98
|
+
- lib/professionali/api/invites.rb
|
99
|
+
- lib/professionali/api/messages.rb
|
100
|
+
- lib/professionali/api/notify.rb
|
101
|
+
- lib/professionali/api/push_notify.rb
|
102
|
+
- lib/professionali/api/search.rb
|
103
|
+
- lib/professionali/api/storage.rb
|
104
|
+
- lib/professionali/api/tape.rb
|
105
|
+
- lib/professionali/api/users.rb
|
106
|
+
- lib/professionali/api_core.rb
|
107
|
+
- lib/professionali/client.rb
|
108
|
+
- lib/professionali/config.rb
|
109
|
+
- lib/professionali/errors.rb
|
110
|
+
- lib/professionali/mash.rb
|
111
|
+
- lib/professionali/version.rb
|
112
|
+
- professionali.gemspec
|
113
|
+
homepage: ''
|
114
|
+
licenses:
|
115
|
+
- MIT
|
116
|
+
metadata: {}
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - '>='
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
requirements: []
|
132
|
+
rubyforge_project:
|
133
|
+
rubygems_version: 2.0.3
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: Ruby wrapper for Professionali's API
|
137
|
+
test_files: []
|