arena 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +1 -1
- data/arena.gemspec +2 -2
- data/lib/arena.rb +1 -1
- data/lib/arena/api.rb +6 -0
- data/lib/arena/channel_feed.rb +21 -0
- data/lib/arena/client.rb +5 -5
- data/lib/arena/default.rb +1 -1
- data/lib/arena/version.rb +1 -1
- metadata +17 -24
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1ff2ee6a8ae7cbd5e1f5338814b3240249de79e0
|
4
|
+
data.tar.gz: 7a6dad62d2f1e6b4006378e70d2bbb8f663c974d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c24cbb7bf757fe5d5a451ad0ecb00a99d0462a34fff68dd9d0cb38f08999870b6bb99e58caef3d1cea5ca9d714c23be1f2bf888517ecce35424fdf9dc779933e
|
7
|
+
data.tar.gz: 11dabfbd36bd6e1ea49643972dcf28f3431bc2d654187e26b487e7b71f924049f0f41fd7370e13d4605ce578c978021a6ebc4c19f3327d965e3c06d6ff10de70
|
data/README.md
CHANGED
@@ -16,7 +16,7 @@ Or install it yourself as:
|
|
16
16
|
|
17
17
|
## Usage
|
18
18
|
|
19
|
-
Register an application at http://dev.are.na
|
19
|
+
Register an application at [http://dev.are.na](http://dev.are.na).
|
20
20
|
|
21
21
|
### Configure for personal use (optional; be aware this grants access to everything your account has access to)
|
22
22
|
```ruby
|
data/arena.gemspec
CHANGED
@@ -3,10 +3,10 @@ require File.expand_path('../lib/arena/version', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["dzuc"]
|
6
|
-
gem.email = ["everyone@
|
6
|
+
gem.email = ["everyone@aredotna.com"]
|
7
7
|
gem.description = "Wrapper for Arena's API"
|
8
8
|
gem.summary = "Wrapper for Arena's API"
|
9
|
-
gem.homepage = "http://
|
9
|
+
gem.homepage = "http://www.aredotna.com/"
|
10
10
|
|
11
11
|
gem.files = `git ls-files`.split($\)
|
12
12
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/lib/arena.rb
CHANGED
data/lib/arena/api.rb
CHANGED
@@ -6,6 +6,7 @@ require "arena/search_results"
|
|
6
6
|
require "arena/account"
|
7
7
|
require "arena/comment"
|
8
8
|
require "arena/feed"
|
9
|
+
require "arena/channel_feed"
|
9
10
|
|
10
11
|
module Arena
|
11
12
|
module API
|
@@ -44,6 +45,11 @@ module Arena
|
|
44
45
|
object_from_response(Arena::ChannelResults, :get, "/channels/#{id}/channels", options)
|
45
46
|
end
|
46
47
|
|
48
|
+
# Returns a paginated feed for a given Channel
|
49
|
+
def channel_feed(id, options={})
|
50
|
+
object_from_response(Arena::ChannelFeed, :get, "/channel/#{id}/feed", options)
|
51
|
+
end
|
52
|
+
|
47
53
|
# Returns a full Block representation
|
48
54
|
def block(id, options={})
|
49
55
|
object_from_response(Arena::Block, :get, "/blocks/#{id}", options)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "arena/base"
|
2
|
+
require "arena/story"
|
3
|
+
|
4
|
+
module Arena
|
5
|
+
class ChannelFeed < Arena::Base
|
6
|
+
attr_reader :type, :limit, :total, :offset, :range_start, :range_end
|
7
|
+
|
8
|
+
def stories
|
9
|
+
@stories ||= @attrs["items"].collect { |item| Arena::Story.new(item) } if stories?
|
10
|
+
end
|
11
|
+
|
12
|
+
alias items stories
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def stories?
|
17
|
+
!@attrs["items"].nil?
|
18
|
+
end
|
19
|
+
|
20
|
+
end # Feed
|
21
|
+
end # Arena
|
data/lib/arena/client.rb
CHANGED
@@ -17,11 +17,11 @@ module Arena
|
|
17
17
|
end
|
18
18
|
|
19
19
|
# Performs HTTP GET POST PUT and DELETE requests
|
20
|
-
#
|
20
|
+
#
|
21
21
|
%w(get post put delete).each do |method|
|
22
22
|
define_method method do |path, options={}|
|
23
23
|
options = { query: options, headers: set_headers }
|
24
|
-
|
24
|
+
|
25
25
|
request(__method__, path, options)
|
26
26
|
end
|
27
27
|
end
|
@@ -43,7 +43,7 @@ module Arena
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def error_message(response)
|
46
|
-
"#{response['
|
46
|
+
"#{response['code']}: #{response['message']} - #{response['description']}"
|
47
47
|
end
|
48
48
|
|
49
49
|
def request(method, path, options)
|
@@ -51,10 +51,10 @@ module Arena
|
|
51
51
|
parsed = JSON.parse(response.body)
|
52
52
|
|
53
53
|
raise Arena::Error.new(error_message(parsed)) if error?(response)
|
54
|
-
|
54
|
+
|
55
55
|
parsed
|
56
56
|
rescue JSON::ParserError, TypeError
|
57
57
|
nil
|
58
58
|
end
|
59
59
|
end
|
60
|
-
end
|
60
|
+
end
|
data/lib/arena/default.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Arena
|
2
2
|
module Default
|
3
|
-
BASE_DOMAIN = "api.
|
3
|
+
BASE_DOMAIN = "arena-api.herokuapp.com" unless defined? BASE_DOMAIN
|
4
4
|
API_VERSION = "v2" unless defined? API_VERSION
|
5
5
|
USE_CACHING = false unless defined? USE_CACHING
|
6
6
|
EXPIRES_IN = 600 unless defined? EXPIRES_IN # 10 minutes
|
data/lib/arena/version.rb
CHANGED
metadata
CHANGED
@@ -1,72 +1,65 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arena
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- dzuc
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2018-05-29 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: json
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: httparty
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
description: Wrapper for Arena's API
|
63
56
|
email:
|
64
|
-
- everyone@
|
57
|
+
- everyone@aredotna.com
|
65
58
|
executables: []
|
66
59
|
extensions: []
|
67
60
|
extra_rdoc_files: []
|
68
61
|
files:
|
69
|
-
- .gitignore
|
62
|
+
- ".gitignore"
|
70
63
|
- Gemfile
|
71
64
|
- LICENSE
|
72
65
|
- README.md
|
@@ -83,6 +76,7 @@ files:
|
|
83
76
|
- lib/arena/cache/adaptor/padrino.rb
|
84
77
|
- lib/arena/cache/adaptor/rails.rb
|
85
78
|
- lib/arena/channel.rb
|
79
|
+
- lib/arena/channel_feed.rb
|
86
80
|
- lib/arena/client.rb
|
87
81
|
- lib/arena/comment.rb
|
88
82
|
- lib/arena/configurable.rb
|
@@ -111,29 +105,28 @@ files:
|
|
111
105
|
- lib/arena/version.rb
|
112
106
|
- test/lib/arena/version_test.rb
|
113
107
|
- test/test_helper.rb
|
114
|
-
homepage: http://
|
108
|
+
homepage: http://www.aredotna.com/
|
115
109
|
licenses: []
|
110
|
+
metadata: {}
|
116
111
|
post_install_message:
|
117
112
|
rdoc_options: []
|
118
113
|
require_paths:
|
119
114
|
- lib
|
120
115
|
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
116
|
requirements:
|
123
|
-
- -
|
117
|
+
- - ">="
|
124
118
|
- !ruby/object:Gem::Version
|
125
119
|
version: '0'
|
126
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
-
none: false
|
128
121
|
requirements:
|
129
|
-
- -
|
122
|
+
- - ">="
|
130
123
|
- !ruby/object:Gem::Version
|
131
124
|
version: '0'
|
132
125
|
requirements: []
|
133
126
|
rubyforge_project:
|
134
|
-
rubygems_version:
|
127
|
+
rubygems_version: 2.6.8
|
135
128
|
signing_key:
|
136
|
-
specification_version:
|
129
|
+
specification_version: 4
|
137
130
|
summary: Wrapper for Arena's API
|
138
131
|
test_files:
|
139
132
|
- test/lib/arena/version_test.rb
|