namba 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.DS_Store ADDED
Binary file
data/Gemfile CHANGED
@@ -10,4 +10,5 @@ group :development, :test do
10
10
  gem 'guard-rspec'
11
11
  gem 'guard-bundler'
12
12
  gem 'libnotify'
13
+ gem 'growl'
13
14
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- namba (1.0.0.1)
4
+ namba (1.0.1)
5
5
  multi_json
6
6
 
7
7
  GEM
@@ -11,6 +11,7 @@ GEM
11
11
  crack (0.3.1)
12
12
  diff-lcs (1.1.3)
13
13
  ffi (1.0.11)
14
+ growl (1.0.3)
14
15
  guard (1.1.1)
15
16
  listen (>= 0.4.2)
16
17
  thor (>= 0.14.6)
@@ -52,6 +53,7 @@ PLATFORMS
52
53
  ruby
53
54
 
54
55
  DEPENDENCIES
56
+ growl
55
57
  guard
56
58
  guard-bundler
57
59
  guard-rspec
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Build Status](https://secure.travis-ci.org/ZeroOneStudio/namba.png)](http://travis-ci.org/ZeroOneStudio/namba)
4
4
 
5
- A Ruby wrapper for the Namba API. The full API description is available [here][]
5
+ A Ruby wrapper for the Namba API. The full API description is available [here][].
6
6
 
7
7
  [here]: http://dev.namba.kg/api_description.php
8
8
 
@@ -28,6 +28,8 @@ Or put to your `Gemfile`
28
28
 
29
29
  Use `:kz` locale if you want to access [namba.kz][] API. Default value is `:kg`
30
30
 
31
+ [namba.kz]: http://www.namba.kz
32
+
31
33
  ## Methods spread on all Namba API
32
34
 
33
35
  n.get_user_info(name) # returns specific user information
@@ -50,7 +52,14 @@ Leave `name` parameter blank to get information about configured user. Eg.:
50
52
  n.get_new_mail_count # returns count of unread messages
51
53
  n.get_last_mail # returns list of inbox messages ordered by creation date. 20 messages is maximum
52
54
 
53
- [namba.kz]: http://www.namba.kz
55
+ ## [Namba Comments][] Rails helper
56
+
57
+ If you use namba gem with Rails you can easily create a comment widget. For example, in your *.erb template:
58
+
59
+ <%= namba_comments("tamasha", 4850) %> # where "tamasha" -- component_name, "4850" -- component_id (read more in Namba API docs)
60
+
61
+ [Namba Comments]: http://dev.namba.kg/api_comments.php
62
+
54
63
  ## Licence
55
64
 
56
65
  MIT License Copyright (c) 2012 ZERO.ONE
data/lib/.DS_Store ADDED
Binary file
data/lib/namba.rb CHANGED
@@ -19,3 +19,12 @@ module Namba
19
19
 
20
20
  end
21
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
Binary file
data/lib/namba/client.rb CHANGED
@@ -11,7 +11,7 @@ module Namba
11
11
  opts = Namba::Config.options.merge(opts)
12
12
  Config::VALID_KEYS.each do |key|
13
13
  instance_variable_set("@#{key}".to_sym, opts[key])
14
- end
14
+ end
15
15
  end
16
16
  end
17
17
  end
@@ -0,0 +1,4 @@
1
+ module Namba
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,14 @@
1
+ module Namba
2
+ module ActionViewExtension
3
+
4
+ def namba_comments(component_name, component_id)
5
+ html = []
6
+ html << content_tag(:div, "", :id => "namba-comments")
7
+ # html << javascript_include_tag("http://api.namba.#{Namba::Config.options[:locale]}/nb.js.php")
8
+ html << javascript_include_tag("http://api.namba.kg/nb.js.php")
9
+ html << javascript_tag("NB.insert(\"comments\", \"namba-comments\", {component: \"#{component_name}\", componentId: #{component_id}});")
10
+ html.join("\n").html_safe
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,9 @@
1
+ module Namba
2
+ class Hooks
3
+ def self.init
4
+ ActiveSupport.on_load(:action_view) do
5
+ ::ActionView::Base.send :include, Namba::ActionViewExtension
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module Namba
2
+ class Railtie < ::Rails::Railtie #:nodoc:
3
+ initializer 'namba' do |_app|
4
+ Namba::Hooks.init
5
+ end
6
+ end
7
+ end
data/lib/namba/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Namba
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  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.0.1
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-06-16 00:00:00.000000000 Z
13
+ date: 2012-06-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json
@@ -100,6 +100,7 @@ executables: []
100
100
  extensions: []
101
101
  extra_rdoc_files: []
102
102
  files:
103
+ - .DS_Store
103
104
  - .gitignore
104
105
  - .rspec
105
106
  - .travis.yml
@@ -109,11 +110,17 @@ files:
109
110
  - LICENSE
110
111
  - README.md
111
112
  - Rakefile
113
+ - lib/.DS_Store
112
114
  - lib/namba.rb
115
+ - lib/namba/.DS_Store
113
116
  - lib/namba/api_methods.rb
114
117
  - lib/namba/client.rb
115
118
  - lib/namba/config.rb
119
+ - lib/namba/engine.rb
116
120
  - lib/namba/error.rb
121
+ - lib/namba/helpers/action_view_extension.rb
122
+ - lib/namba/hooks.rb
123
+ - lib/namba/railtie.rb
117
124
  - lib/namba/version.rb
118
125
  - namba.gemspec
119
126
  - spec/namba/namba_spec.rb