namba 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/README.md +6 -3
- data/lib/namba/client.rb +2 -2
- data/lib/namba/config.rb +1 -1
- data/lib/namba/railtie.rb +5 -3
- data/lib/namba/version.rb +1 -1
- data/lib/namba.rb +4 -12
- data/spec/namba/action_view_extension_spec.rb +6 -4
- data/spec/namba/namba_spec.rb +5 -5
- metadata +12 -14
- data/lib/namba/engine.rb +0 -4
- data/lib/namba/hooks.rb +0 -9
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
## The Namba Ruby gem
|
2
2
|
|
3
3
|
[](http://travis-ci.org/ZeroOneStudio/namba)
|
4
|
+
[](https://codeclimate.com/github/ZeroOneStudio/namba)
|
4
5
|
|
5
6
|
A Ruby wrapper for the Namba API. The full API description is available [here][].
|
6
7
|
|
@@ -26,9 +27,9 @@ Or put to your `Gemfile`
|
|
26
27
|
|
27
28
|
n = Namba.new()
|
28
29
|
|
29
|
-
Use `:
|
30
|
+
Use `:net` locale if you want to access [namba.net][] API. Default value is `:kg`
|
30
31
|
|
31
|
-
[namba.
|
32
|
+
[namba.net]: http://www.namba.net
|
32
33
|
|
33
34
|
## Methods spread on all Namba API
|
34
35
|
|
@@ -78,5 +79,7 @@ About `component_name` and `component_id` read more at [Namba Comments docs][]
|
|
78
79
|
|
79
80
|
## Licence
|
80
81
|
|
81
|
-
MIT License Copyright (c) 2012 ZERO.ONE
|
82
|
+
MIT License Copyright (c) 2012 [ZERO.ONE][]
|
83
|
+
|
84
|
+
[ZERO.ONE]: http://www.zeroone.st
|
82
85
|
|
data/lib/namba/client.rb
CHANGED
@@ -7,8 +7,8 @@ module Namba
|
|
7
7
|
include APIMethods
|
8
8
|
attr_accessor *Config::VALID_KEYS
|
9
9
|
|
10
|
-
def initialize
|
11
|
-
opts = Namba::Config.options
|
10
|
+
def initialize
|
11
|
+
opts = Namba::Config.options
|
12
12
|
Config::VALID_KEYS.each do |key|
|
13
13
|
instance_variable_set("@#{key}".to_sym, opts[key])
|
14
14
|
end
|
data/lib/namba/config.rb
CHANGED
@@ -22,7 +22,7 @@ module Namba
|
|
22
22
|
s.password = "" if s.password.nil?
|
23
23
|
s.locale = :kg if s.locale.nil?
|
24
24
|
end
|
25
|
-
raise ConfigurationError, "Available locales are only 'kg' and '
|
25
|
+
raise ConfigurationError, "Available locales are only 'kg' and 'net'" unless [:kg, :net].include?(self.locale)
|
26
26
|
end
|
27
27
|
|
28
28
|
def options
|
data/lib/namba/railtie.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
require 'namba/helpers/action_view_extension'
|
2
|
+
|
1
3
|
module Namba
|
2
|
-
class Railtie <
|
3
|
-
initializer
|
4
|
-
|
4
|
+
class Railtie < Rails::Railtie
|
5
|
+
initializer "namba.action_view_extension" do
|
6
|
+
ActionView::Base.send :include, ActionViewExtension
|
5
7
|
end
|
6
8
|
end
|
7
9
|
end
|
data/lib/namba/version.rb
CHANGED
data/lib/namba.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "namba/version"
|
2
2
|
require 'namba/client'
|
3
3
|
require 'namba/config'
|
4
|
+
require 'namba/railtie' if defined? Rails
|
4
5
|
|
5
6
|
module Namba
|
6
7
|
extend Config
|
@@ -8,8 +9,8 @@ module Namba
|
|
8
9
|
class << self
|
9
10
|
|
10
11
|
# Alias for Namba::Client.new()
|
11
|
-
def new
|
12
|
-
Namba::Client.new
|
12
|
+
def new
|
13
|
+
Namba::Client.new
|
13
14
|
end
|
14
15
|
|
15
16
|
# Alias for Namba::Config.configure
|
@@ -18,13 +19,4 @@ module Namba
|
|
18
19
|
end
|
19
20
|
|
20
21
|
end
|
21
|
-
end
|
22
|
-
|
23
|
-
require 'namba/helpers/action_view_extension'
|
24
|
-
require 'namba/hooks'
|
25
|
-
|
26
|
-
# if not using Railtie, call `Namba::Hooks.init` directly
|
27
|
-
if defined? Rails
|
28
|
-
require 'namba/railtie'
|
29
|
-
require 'namba/engine'
|
30
|
-
end
|
22
|
+
end
|
@@ -1,11 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
|
2
|
+
require 'namba/helpers/action_view_extension'
|
3
3
|
|
4
4
|
describe Namba::ActionViewExtension do
|
5
5
|
|
6
|
-
it "should have :namba_comments
|
7
|
-
|
8
|
-
instance_methods.should == [:namba_comments, :namba_share]
|
6
|
+
it "should have :namba_comments method" do
|
7
|
+
Namba::ActionViewExtension.method_defined?(:namba_comments).should == true
|
9
8
|
end
|
10
9
|
|
10
|
+
it "should have :namba_share method" do
|
11
|
+
Namba::ActionViewExtension.method_defined?(:namba_share).should == true
|
12
|
+
end
|
11
13
|
end
|
data/spec/namba/namba_spec.rb
CHANGED
@@ -14,14 +14,14 @@ describe Namba do
|
|
14
14
|
Namba.configure do |config|
|
15
15
|
config.username = "name"
|
16
16
|
config.password = "secret"
|
17
|
-
config.locale = :
|
17
|
+
config.locale = :net
|
18
18
|
end
|
19
19
|
|
20
20
|
n = Namba.new()
|
21
21
|
|
22
22
|
n.username.should == "name"
|
23
23
|
n.password.should == "secret"
|
24
|
-
n.locale.should == :
|
24
|
+
n.locale.should == :net
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should set defaults when it is not set in configuration block" do
|
@@ -40,20 +40,20 @@ describe Namba do
|
|
40
40
|
Namba.configure do |config|
|
41
41
|
config.locale = :ru
|
42
42
|
end
|
43
|
-
}.
|
43
|
+
}.to raise_error(Namba::ConfigurationError, "Available locales are only 'kg' and 'net'")
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should raise Invalid Response Error when status code is not 200" do
|
47
47
|
Namba.configure do |config|
|
48
48
|
config.username = "name"
|
49
49
|
config.password = "secret"
|
50
|
-
config.locale = :
|
50
|
+
config.locale = :net
|
51
51
|
end
|
52
52
|
|
53
53
|
n = Namba.new()
|
54
54
|
|
55
55
|
expect {
|
56
56
|
n.send(:get_response_from, "http://api.namba.#{n.locale}/404")
|
57
|
-
}.
|
57
|
+
}.to raise_error(Namba::InvalidResponseError, "Invalid response from service")
|
58
58
|
end
|
59
59
|
end
|
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.
|
4
|
+
version: 1.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-02-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multi_json
|
17
|
-
requirement: &
|
17
|
+
requirement: &84853350 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *84853350
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: rspec
|
28
|
-
requirement: &
|
28
|
+
requirement: &84853100 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 2.7.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *84853100
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: rake
|
39
|
-
requirement: &
|
39
|
+
requirement: &84852890 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *84852890
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: webmock
|
50
|
-
requirement: &
|
50
|
+
requirement: &84852660 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *84852660
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: rack-test
|
61
|
-
requirement: &
|
61
|
+
requirement: &84852450 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
version: '0'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *84852450
|
70
70
|
description: Ruby wrapper for Namba API
|
71
71
|
email:
|
72
72
|
- sergey.kishenin@gmail.com
|
@@ -88,10 +88,8 @@ files:
|
|
88
88
|
- lib/namba/api_methods.rb
|
89
89
|
- lib/namba/client.rb
|
90
90
|
- lib/namba/config.rb
|
91
|
-
- lib/namba/engine.rb
|
92
91
|
- lib/namba/error.rb
|
93
92
|
- lib/namba/helpers/action_view_extension.rb
|
94
|
-
- lib/namba/hooks.rb
|
95
93
|
- lib/namba/railtie.rb
|
96
94
|
- lib/namba/version.rb
|
97
95
|
- namba.gemspec
|
data/lib/namba/engine.rb
DELETED