Module: Arena::API
- Included in:
- Client
- Defined in:
- lib/arena/api.rb
Instance Method Summary collapse
-
#account(options = {}) ⇒ Object
Full representation of the account endpoint.
-
#account_channels(options = {}) ⇒ Object
All of the authenticated user’s Channels.
-
#block(id, options = {}) ⇒ Object
Returns a full Block representation.
-
#block_comments(id, options = {}) ⇒ Object
Returns Block comments.
-
#channel(id, options = {}) ⇒ Object
Returns a full Channel representation.
-
#channel_add_block(id, options = {}) ⇒ Object
Posts a block to a channel.
-
#channel_channels(id, options = {}) ⇒ Object
Returns a paginated list of all Channels connected to the given Channel.
-
#channel_feed(id, options = {}) ⇒ Object
Returns a paginated feed for a given Channel.
-
#channel_remove_block(channel_id, id, options = {}) ⇒ Object
Remove a block from channel (destroy connection).
-
#channel_thumb(id, options = {}) ⇒ Object
Returns thumbnail representation (first 9 Blocks) for the given Channel.
-
#channel_toggle_block_selection(id, options = {}) ⇒ Object
Select a block within the context of a channel.
-
#channels(options = {}) ⇒ Object
Returns paginated global list of Channels.
-
#feed(options = {}) ⇒ Object
Returns a Feed object with an arry of Stories.
-
#search(query, options = {}) ⇒ Object
Returns a Search object with an Array for Channels, Blocks and Users.
-
#settings(options = {}) ⇒ Object
Returns the authenticated user’s settings.
-
#user(id, options = {}) ⇒ Object
Returns a User representation.
-
#user_channels(id, options = {}) ⇒ Object
Returns a paginated list of all public Channels a User has access to.
-
#user_feed(id, options = {}) ⇒ Object
Returns a paginated feed for a given User.
Instance Method Details
#account(options = {}) ⇒ Object
Full representation of the account endpoint
82 83 84 85 86 |
# File 'lib/arena/api.rb', line 82 def account( = {}) require_authentication! object_from_response(Arena::Account, :get, '/accounts', ) end |
#account_channels(options = {}) ⇒ Object
All of the authenticated user’s Channels
89 90 91 92 93 |
# File 'lib/arena/api.rb', line 89 def account_channels( = {}) require_authentication! object_from_response(Arena::ChannelResults, :get, '/accounts/channels', ) end |
#block(id, options = {}) ⇒ Object
Returns a full Block representation
62 63 64 |
# File 'lib/arena/api.rb', line 62 def block(id, = {}) object_from_response(Arena::Block, :get, "/blocks/#{id}", ) end |
#block_comments(id, options = {}) ⇒ Object
Returns Block comments
67 68 69 |
# File 'lib/arena/api.rb', line 67 def block_comments(id, = {}) collection_from_response(Arena::Comment, :get, "/blocks/#{id}/comments", 'comments', ) end |
#channel(id, options = {}) ⇒ Object
Returns a full Channel representation
22 23 24 |
# File 'lib/arena/api.rb', line 22 def channel(id, = {}) object_from_response(Arena::Channel, :get, "/channels/#{id}", ) end |
#channel_add_block(id, options = {}) ⇒ Object
Posts a block to a channel
27 28 29 |
# File 'lib/arena/api.rb', line 27 def channel_add_block(id, = {}) object_from_response(Arena::Block, :post, "/channels/#{id}/blocks", ) end |
#channel_channels(id, options = {}) ⇒ Object
Returns a paginated list of all Channels connected to the given Channel
47 48 49 |
# File 'lib/arena/api.rb', line 47 def channel_channels(id, = {}) object_from_response(Arena::ChannelResults, :get, "/channels/#{id}/channels", ) end |
#channel_feed(id, options = {}) ⇒ Object
Returns a paginated feed for a given Channel
52 53 54 |
# File 'lib/arena/api.rb', line 52 def channel_feed(id, = {}) object_from_response(Arena::ChannelFeed, :get, "/channel/#{id}/feed", ) end |
#channel_remove_block(channel_id, id, options = {}) ⇒ Object
Remove a block from channel (destroy connection)
32 33 34 |
# File 'lib/arena/api.rb', line 32 def channel_remove_block(channel_id, id, = {}) send(:delete, "/channels/#{channel_id}/blocks/#{id}", ) end |
#channel_thumb(id, options = {}) ⇒ Object
Returns thumbnail representation (first 9 Blocks) for the given Channel
42 43 44 |
# File 'lib/arena/api.rb', line 42 def channel_thumb(id, = {}) object_from_response(Arena::Channel, :get, "/channels/#{id}/thumb", ) end |
#channel_toggle_block_selection(id, options = {}) ⇒ Object
Select a block within the context of a channel
37 38 39 |
# File 'lib/arena/api.rb', line 37 def channel_toggle_block_selection(id, = {}) send(:put, "/connections/#{id}/selection", ) end |
#channels(options = {}) ⇒ Object
Returns paginated global list of Channels
17 18 19 |
# File 'lib/arena/api.rb', line 17 def channels( = {}) object_from_response(Arena::ChannelResults, :get, '/channels', ) end |
#feed(options = {}) ⇒ Object
Returns a Feed object with an arry of Stories
110 111 112 113 114 |
# File 'lib/arena/api.rb', line 110 def feed( = {}) require_authentication! object_from_response(Arena::Feed, :get, '/feed', ) end |
#search(query, options = {}) ⇒ Object
Returns a Search object with an Array for Channels, Blocks and Users
103 104 105 106 107 |
# File 'lib/arena/api.rb', line 103 def search(query, = {}) path = [:kind].nil? ? "/search/?q=#{query}" : "/search/#{options[:kind]}/?q=#{query}" object_from_response(Arena::SearchResults, :get, path, ) end |
#settings(options = {}) ⇒ Object
Returns the authenticated user’s settings
96 97 98 99 100 |
# File 'lib/arena/api.rb', line 96 def settings( = {}) require_authentication! object_from_response(Arena::User, :get, '/accounts/settings', ) end |
#user(id, options = {}) ⇒ Object
Returns a User representation
72 73 74 |
# File 'lib/arena/api.rb', line 72 def user(id, = {}) object_from_response(Arena::User, :get, "/users/#{id}", ) end |
#user_channels(id, options = {}) ⇒ Object
Returns a paginated list of all public Channels a User has access to
77 78 79 |
# File 'lib/arena/api.rb', line 77 def user_channels(id, = {}) object_from_response(Arena::ChannelResults, :get, "/users/#{id}/channels", ) end |
#user_feed(id, options = {}) ⇒ Object
Returns a paginated feed for a given User
57 58 59 |
# File 'lib/arena/api.rb', line 57 def user_feed(id, = {}) object_from_response(Arena::UserFeed, :get, "/user/#{id}/feed", ) end |