namba 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -6
- data/.travis.yml +6 -4
- data/Gemfile +4 -0
- data/Gemfile.lock +64 -32
- data/README.md +7 -1
- data/lib/namba/api_methods.rb +15 -9
- data/lib/namba/version.rb +1 -1
- data/namba.gemspec +3 -1
- data/spec/namba/api_methods_spec.rb +101 -0
- data/spec/spec_helper.rb +2 -2
- metadata +28 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
5
|
-
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e545dd9f19bc993ddee7e0bb5657080cb01b421a
|
4
|
+
data.tar.gz: 7eefe5dec6d525cbd1e19fd55439968802e29299
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e4787567dc91db60bd06579cf5fbdf5cba75392f7758ea3e808cdbc884e9cd92b22aacfa66d912427d223ca6ebca9340106ec66f644ecbd78654a20aab009872
|
7
|
+
data.tar.gz: 68d4c4498df6850a4e4c888fe81f946265e393a73bf8075a8a09623a6ee99bbd12f68e9ca71df479401810e62174a3b520c20db3a043b2028ce9a3a0b92dec63
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,54 +1,86 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
namba (1.3.
|
4
|
+
namba (1.3.1)
|
5
5
|
multi_json
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
addressable (2.
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
addressable (2.3.5)
|
11
|
+
coderay (1.0.9)
|
12
|
+
colorize (0.5.8)
|
13
|
+
coveralls (0.6.7)
|
14
|
+
colorize
|
15
|
+
multi_json (~> 1.3)
|
16
|
+
rest-client
|
17
|
+
simplecov (>= 0.7)
|
18
|
+
thor
|
19
|
+
crack (0.4.1)
|
20
|
+
safe_yaml (~> 0.9.0)
|
21
|
+
diff-lcs (1.2.4)
|
22
|
+
ffi (1.9.0)
|
23
|
+
formatador (0.2.4)
|
24
|
+
guard (1.8.2)
|
25
|
+
formatador (>= 0.2.4)
|
26
|
+
listen (>= 1.0.0)
|
27
|
+
lumberjack (>= 1.0.2)
|
28
|
+
pry (>= 0.9.10)
|
16
29
|
thor (>= 0.14.6)
|
17
|
-
guard-rspec (
|
18
|
-
guard (>= 1.
|
19
|
-
|
20
|
-
|
21
|
-
rb-fsevent (
|
22
|
-
rb-inotify (
|
23
|
-
|
24
|
-
|
25
|
-
|
30
|
+
guard-rspec (3.0.2)
|
31
|
+
guard (>= 1.8)
|
32
|
+
rspec (~> 2.13)
|
33
|
+
listen (1.3.0)
|
34
|
+
rb-fsevent (>= 0.9.3)
|
35
|
+
rb-inotify (>= 0.9)
|
36
|
+
rb-kqueue (>= 0.2)
|
37
|
+
lumberjack (1.0.4)
|
38
|
+
method_source (0.8.2)
|
39
|
+
mime-types (1.25)
|
40
|
+
multi_json (1.7.9)
|
41
|
+
pry (0.9.12.2)
|
42
|
+
coderay (~> 1.0.5)
|
43
|
+
method_source (~> 0.8)
|
44
|
+
slop (~> 3.4)
|
45
|
+
rack (1.5.2)
|
46
|
+
rack-test (0.6.2)
|
26
47
|
rack (>= 1.0)
|
27
|
-
|
28
|
-
|
29
|
-
rb-
|
30
|
-
rb-inotify (0.8.8)
|
48
|
+
rake (10.1.0)
|
49
|
+
rb-fsevent (0.9.3)
|
50
|
+
rb-inotify (0.9.1)
|
31
51
|
ffi (>= 0.5.0)
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
rspec
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
52
|
+
rb-kqueue (0.2.0)
|
53
|
+
ffi (>= 0.5.0)
|
54
|
+
rest-client (1.6.7)
|
55
|
+
mime-types (>= 1.16)
|
56
|
+
rspec (2.14.1)
|
57
|
+
rspec-core (~> 2.14.0)
|
58
|
+
rspec-expectations (~> 2.14.0)
|
59
|
+
rspec-mocks (~> 2.14.0)
|
60
|
+
rspec-core (2.14.5)
|
61
|
+
rspec-expectations (2.14.2)
|
62
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
63
|
+
rspec-mocks (2.14.3)
|
64
|
+
safe_yaml (0.9.5)
|
65
|
+
simplecov (0.7.1)
|
66
|
+
multi_json (~> 1.0)
|
67
|
+
simplecov-html (~> 0.7.1)
|
68
|
+
simplecov-html (0.7.1)
|
69
|
+
slop (3.4.6)
|
70
|
+
thor (0.18.1)
|
71
|
+
webmock (1.13.0)
|
42
72
|
addressable (>= 2.2.7)
|
43
|
-
crack (>= 0.
|
73
|
+
crack (>= 0.3.2)
|
44
74
|
|
45
75
|
PLATFORMS
|
46
76
|
ruby
|
47
77
|
|
48
78
|
DEPENDENCIES
|
79
|
+
coveralls
|
49
80
|
guard
|
50
81
|
guard-rspec
|
51
82
|
namba!
|
52
83
|
rack-test
|
53
|
-
|
84
|
+
rake
|
85
|
+
rspec
|
54
86
|
webmock
|
data/README.md
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/namba.png)](http://badge.fury.io/rb/namba)
|
4
4
|
[![Build Status](https://secure.travis-ci.org/ZeroOneStudio/namba.png)](http://travis-ci.org/ZeroOneStudio/namba)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/ZeroOneStudio/namba.png)](https://codeclimate.com/github/ZeroOneStudio/namba)
|
6
|
+
[![Coverage Status](https://coveralls.io/repos/ZeroOneStudio/namba/badge.png)](https://coveralls.io/r/ZeroOneStudio/namba)
|
7
|
+
[![Dependency Status](https://gemnasium.com/ZeroOneStudio/namba.png)](https://gemnasium.com/ZeroOneStudio/namba)
|
6
8
|
|
7
9
|
A Ruby wrapper for the Namba API. The full API description is available [here][].
|
8
10
|
|
@@ -80,7 +82,11 @@ About `component_name` and `component_id` read more at [Namba Comments docs][]
|
|
80
82
|
|
81
83
|
## Licence
|
82
84
|
|
83
|
-
MIT License Copyright (c)
|
85
|
+
MIT License Copyright (c) 2012-2014 [ZERO.ONE][]
|
84
86
|
|
85
87
|
[ZERO.ONE]: http://www.zeroone.st
|
86
88
|
|
89
|
+
|
90
|
+
|
91
|
+
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/ZeroOneStudio/namba/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
92
|
+
|
data/lib/namba/api_methods.rb
CHANGED
@@ -7,12 +7,11 @@ module Namba
|
|
7
7
|
get_response_from "http://api.namba.#{self.locale}/getUserInfo.php?username=" + name
|
8
8
|
end
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
get_response_from "http://api.namba.#{self.locale}/getPhoto.php?username=" + name
|
10
|
+
%w(photo video).map do |key|
|
11
|
+
define_method "get_user_#{key}" do |*args|
|
12
|
+
name = args.first || self.username
|
13
|
+
response = get_response_from "http://api.namba.#{self.locale}/get#{key.capitalize}.php?username=" + name
|
14
|
+
end
|
16
15
|
end
|
17
16
|
|
18
17
|
def get_friends_list name = self.username
|
@@ -39,14 +38,21 @@ private
|
|
39
38
|
|
40
39
|
def get_response_from url
|
41
40
|
response = Net::HTTP.get_response(URI.parse(url))
|
42
|
-
|
43
|
-
MultiJson.decode(response.body)
|
41
|
+
raise_or_return response
|
44
42
|
end
|
45
43
|
|
46
44
|
def post_data_to url, params = { :username => self.username, :password => self.password }
|
47
45
|
response = Net::HTTP.post_form(URI.parse(url), params)
|
46
|
+
raise_or_return response
|
47
|
+
end
|
48
|
+
|
49
|
+
def raise_or_return response
|
48
50
|
raise InvalidResponseError, "Invalid response from service" unless response.code == "200"
|
49
|
-
|
51
|
+
if response.body == "null"
|
52
|
+
return []
|
53
|
+
else
|
54
|
+
MultiJson.decode(response.body)
|
55
|
+
end
|
50
56
|
end
|
51
57
|
end
|
52
58
|
end
|
data/lib/namba/version.rb
CHANGED
data/namba.gemspec
CHANGED
@@ -15,10 +15,12 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.name = "namba"
|
16
16
|
gem.require_paths = ["lib"]
|
17
17
|
gem.version = Namba::VERSION
|
18
|
+
|
19
|
+
gem.license = "MIT"
|
18
20
|
|
19
21
|
gem.add_runtime_dependency "multi_json"
|
20
22
|
|
21
|
-
gem.add_development_dependency "rspec"
|
23
|
+
gem.add_development_dependency "rspec"
|
22
24
|
gem.add_development_dependency "rake"
|
23
25
|
gem.add_development_dependency "guard"
|
24
26
|
gem.add_development_dependency "guard-rspec"
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Namba::APIMethods do
|
4
|
+
before :each do
|
5
|
+
Namba.configure do |config|
|
6
|
+
config.username = "nambagem"
|
7
|
+
config.password = "nambagem"
|
8
|
+
config.locale = :kg
|
9
|
+
end
|
10
|
+
@namba = Namba.new
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "::get_user_info" do
|
14
|
+
before :each do
|
15
|
+
@user_info = @namba.get_user_info
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should be a Hash" do
|
19
|
+
@user_info.class.should == Hash
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should return correct JSON" do
|
23
|
+
@user_info['firstname'].should == "Namba"
|
24
|
+
@user_info['lastname'].should == "Gem"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "::get_user_video" do
|
29
|
+
before :each do
|
30
|
+
@user_video = @namba.get_user_video
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should be an Array" do
|
34
|
+
@user_video.class.should == Array
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "::get_user_photo" do
|
39
|
+
before :each do
|
40
|
+
@user_photo = @namba.get_user_photo
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should be an Array" do
|
44
|
+
@user_photo.class.should == Array
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "::get_friends_list" do
|
49
|
+
before :each do
|
50
|
+
@friends_list = @namba.get_friends_list
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should be an Array" do
|
54
|
+
@friends_list.class.should == Array
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should return correct JSON" do
|
58
|
+
@friends_list.first['username'].should == "kishie"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe "::set_status" do
|
63
|
+
before :each do
|
64
|
+
@status = @namba.set_status("New Status")
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should change user's status" do
|
68
|
+
@namba.get_user_info['status'] == @status
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "::get_events" do
|
73
|
+
before :each do
|
74
|
+
@events = @namba.get_events
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should be an Array" do
|
78
|
+
@events.class.should == Array
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "::get_last_mail" do
|
83
|
+
before :each do
|
84
|
+
@last_mail = @namba.get_last_mail
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should be an Array" do
|
88
|
+
@last_mail.class.should == Array
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe "::get_new_mail_count" do
|
93
|
+
before :each do
|
94
|
+
@new_mail_count = @namba.get_new_mail_count
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should return new mail count" do
|
98
|
+
@new_mail_count['new_messages'].class.should == Fixnum
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: namba
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Kishenin
|
@@ -9,104 +9,104 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-02-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rspec
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: '0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rake
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: guard
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: guard-rspec
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: webmock
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: rack-test
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- -
|
102
|
+
- - ">="
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '0'
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- -
|
109
|
+
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
112
|
description: Ruby wrapper for Namba API
|
@@ -117,9 +117,9 @@ executables: []
|
|
117
117
|
extensions: []
|
118
118
|
extra_rdoc_files: []
|
119
119
|
files:
|
120
|
-
- .gitignore
|
121
|
-
- .rspec
|
122
|
-
- .travis.yml
|
120
|
+
- ".gitignore"
|
121
|
+
- ".rspec"
|
122
|
+
- ".travis.yml"
|
123
123
|
- Gemfile
|
124
124
|
- Gemfile.lock
|
125
125
|
- Guardfile
|
@@ -136,10 +136,12 @@ files:
|
|
136
136
|
- lib/namba/version.rb
|
137
137
|
- namba.gemspec
|
138
138
|
- spec/namba/action_view_extension_spec.rb
|
139
|
+
- spec/namba/api_methods_spec.rb
|
139
140
|
- spec/namba/namba_spec.rb
|
140
141
|
- spec/spec_helper.rb
|
141
142
|
homepage: https://github.com/ZeroOneStudio/namba
|
142
|
-
licenses:
|
143
|
+
licenses:
|
144
|
+
- MIT
|
143
145
|
metadata: {}
|
144
146
|
post_install_message:
|
145
147
|
rdoc_options: []
|
@@ -147,21 +149,22 @@ require_paths:
|
|
147
149
|
- lib
|
148
150
|
required_ruby_version: !ruby/object:Gem::Requirement
|
149
151
|
requirements:
|
150
|
-
- -
|
152
|
+
- - ">="
|
151
153
|
- !ruby/object:Gem::Version
|
152
154
|
version: '0'
|
153
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
156
|
requirements:
|
155
|
-
- -
|
157
|
+
- - ">="
|
156
158
|
- !ruby/object:Gem::Version
|
157
159
|
version: '0'
|
158
160
|
requirements: []
|
159
161
|
rubyforge_project:
|
160
|
-
rubygems_version: 2.
|
162
|
+
rubygems_version: 2.2.2
|
161
163
|
signing_key:
|
162
164
|
specification_version: 4
|
163
165
|
summary: Ruby wrapper for Namba API
|
164
166
|
test_files:
|
165
167
|
- spec/namba/action_view_extension_spec.rb
|
168
|
+
- spec/namba/api_methods_spec.rb
|
166
169
|
- spec/namba/namba_spec.rb
|
167
170
|
- spec/spec_helper.rb
|