arena 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +19 -0
- data/Rakefile +17 -0
- data/arena.gemspec +23 -0
- data/lib/arena/client.rb +41 -0
- data/lib/arena/configurable.rb +8 -0
- data/lib/arena/version.rb +3 -0
- data/lib/arena.rb +11 -0
- data/test/lib/arena/version_test.rb +9 -0
- data/test/test_helper.rb +2 -0
- metadata +107 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Arena
|
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
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
|
4
|
+
desc "Open an irb session preloaded with this library"
|
5
|
+
task :console do
|
6
|
+
sh "irb -rubygems -I lib -r arena.rb"
|
7
|
+
end
|
8
|
+
|
9
|
+
# require 'rake/testtask'
|
10
|
+
|
11
|
+
# Rake::TestTask.new do |t|
|
12
|
+
# t.libs << 'lib/arena'
|
13
|
+
# t.test_files = FileList['test/lib/arena/*_test.rb']
|
14
|
+
# t.verbose = true
|
15
|
+
# end
|
16
|
+
|
17
|
+
task :default => :console
|
data/arena.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/arena/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["dzuc"]
|
6
|
+
gem.email = ["everyone@are.na"]
|
7
|
+
gem.description = "Wrapper for Arena's API"
|
8
|
+
gem.summary = "Wrapper for Arena's API"
|
9
|
+
gem.homepage = "http://are.na/"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "arena"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Arena::VERSION
|
17
|
+
|
18
|
+
gem.add_development_dependency 'rake'
|
19
|
+
|
20
|
+
gem.add_runtime_dependency 'json'
|
21
|
+
gem.add_runtime_dependency 'httparty'
|
22
|
+
|
23
|
+
end
|
data/lib/arena/client.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'arena/configurable'
|
2
|
+
require 'httparty'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Arena
|
6
|
+
|
7
|
+
class Client
|
8
|
+
include HTTParty
|
9
|
+
include Arena::Configurable
|
10
|
+
|
11
|
+
class << self
|
12
|
+
|
13
|
+
def channel(identifier, options={})
|
14
|
+
get_json "/channels/#{identifier}", options
|
15
|
+
end
|
16
|
+
|
17
|
+
def users_channels(id, options={})
|
18
|
+
get_json "/channels?user=#{id}", options
|
19
|
+
end
|
20
|
+
|
21
|
+
def block(id, options={})
|
22
|
+
get_json "/blocks/#{id}", options
|
23
|
+
end
|
24
|
+
|
25
|
+
def blocks(identifier, options={})
|
26
|
+
get_json "/blocks?channel=#{identifier}", options
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
# Perform HTTP GET request and parse the response body
|
32
|
+
def get_json(path, options)
|
33
|
+
JSON.parse(
|
34
|
+
(get "#{Arena::Configurable::BASE_URL}#{path}", options).body
|
35
|
+
)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
data/lib/arena.rb
ADDED
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: arena
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- dzuc
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-07-09 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: json
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: httparty
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: Wrapper for Arena's API
|
63
|
+
email:
|
64
|
+
- everyone@are.na
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- .gitignore
|
70
|
+
- Gemfile
|
71
|
+
- LICENSE
|
72
|
+
- README.md
|
73
|
+
- Rakefile
|
74
|
+
- arena.gemspec
|
75
|
+
- lib/arena.rb
|
76
|
+
- lib/arena/client.rb
|
77
|
+
- lib/arena/configurable.rb
|
78
|
+
- lib/arena/version.rb
|
79
|
+
- test/lib/arena/version_test.rb
|
80
|
+
- test/test_helper.rb
|
81
|
+
homepage: http://are.na/
|
82
|
+
licenses: []
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ! '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
requirements: []
|
100
|
+
rubyforge_project:
|
101
|
+
rubygems_version: 1.8.24
|
102
|
+
signing_key:
|
103
|
+
specification_version: 3
|
104
|
+
summary: Wrapper for Arena's API
|
105
|
+
test_files:
|
106
|
+
- test/lib/arena/version_test.rb
|
107
|
+
- test/test_helper.rb
|