Module: Arena::API

Included in:
Client
Defined in:
lib/arena/api.rb

Instance Method Summary collapse

Instance Method Details

#account(options = {}) ⇒ Object

Full representation of the account endpoint



80
81
82
83
84
# File 'lib/arena/api.rb', line 80

def (options={})
  require_authentication!

  object_from_response(Arena::Account, :get, "/accounts", options)
end

#account_channels(options = {}) ⇒ Object

All of the authenticated user’s Channels



87
88
89
90
91
# File 'lib/arena/api.rb', line 87

def (options={})
  require_authentication!

  object_from_response(Arena::ChannelResults, :get, "/accounts/channels", options)
end

#block(id, options = {}) ⇒ Object

Returns a full Block representation



60
61
62
# File 'lib/arena/api.rb', line 60

def block(id, options={})
  object_from_response(Arena::Block, :get, "/blocks/#{id}", options)
end

#block_comments(id, options = {}) ⇒ Object

Returns Block comments



65
66
67
# File 'lib/arena/api.rb', line 65

def block_comments(id, options={})
  collection_from_response(Arena::Comment, :get, "/blocks/#{id}/comments", "comments", options)
end

#channel(id, options = {}) ⇒ Object

Returns a full Channel representation



20
21
22
# File 'lib/arena/api.rb', line 20

def channel(id, options={})
  object_from_response(Arena::Channel, :get, "/channels/#{id}", options)
end

#channel_add_block(id, options = {}) ⇒ Object

Posts a block to a channel



25
26
27
# File 'lib/arena/api.rb', line 25

def channel_add_block(id, options={})
  object_from_response(Arena::Block, :post, "/channels/#{id}/blocks", options)
end

#channel_channels(id, options = {}) ⇒ Object

Returns a paginated list of all Channels connected to the given Channel



45
46
47
# File 'lib/arena/api.rb', line 45

def channel_channels(id, options={})
  object_from_response(Arena::ChannelResults, :get, "/channels/#{id}/channels", options)
end

#channel_feed(id, options = {}) ⇒ Object

Returns a paginated feed for a given Channel



50
51
52
# File 'lib/arena/api.rb', line 50

def channel_feed(id, options={})
  object_from_response(Arena::ChannelFeed, :get, "/channel/#{id}/feed", options)
end

#channel_remove_block(channel_id, id, options = {}) ⇒ Object

Remove a block from channel (destroy connection)



30
31
32
# File 'lib/arena/api.rb', line 30

def channel_remove_block(channel_id, id, options={})
  send(:delete, "/channels/#{channel_id}/blocks/#{id}", options)
end

#channel_thumb(id, options = {}) ⇒ Object

Returns thumbnail representation (first 9 Blocks) for the given Channel



40
41
42
# File 'lib/arena/api.rb', line 40

def channel_thumb(id, options={})
  object_from_response(Arena::Channel, :get, "/channels/#{id}/thumb", options)
end

#channel_toggle_block_selection(id, options = {}) ⇒ Object

Select a block within the context of a channel



35
36
37
# File 'lib/arena/api.rb', line 35

def channel_toggle_block_selection(id, options={})
  send(:put, "/connections/#{id}/selection", options)
end

#channels(options = {}) ⇒ Object

Returns paginated global list of Channels



15
16
17
# File 'lib/arena/api.rb', line 15

def channels(options={})
  object_from_response(Arena::ChannelResults, :get, "/channels", options)
end

#feed(options = {}) ⇒ Object

Returns a Feed object with an arry of Stories



108
109
110
111
112
# File 'lib/arena/api.rb', line 108

def feed(options={})
  require_authentication!

  object_from_response(Arena::Feed, :get, "/feed", options)
end

#search(query, options = {}) ⇒ Object

Returns a Search object with an Array for Channels, Blocks and Users



101
102
103
104
105
# File 'lib/arena/api.rb', line 101

def search(query, options={})
  path = options[:kind].nil? ? "/search/?q=#{query}" : "/search/#{options[:kind]}/?q=#{query}"

  object_from_response(Arena::SearchResults, :get, path, options)
end

#settings(options = {}) ⇒ Object

Returns the authenticated user’s settings



94
95
96
97
98
# File 'lib/arena/api.rb', line 94

def settings(options={})
  require_authentication!

  object_from_response(Arena::User, :get, "/accounts/settings", options)
end

#user(id, options = {}) ⇒ Object

Returns a User representation



70
71
72
# File 'lib/arena/api.rb', line 70

def user(id, options={})
  object_from_response(Arena::User, :get, "/users/#{id}", options)
end

#user_channels(id, options = {}) ⇒ Object

Returns a paginated list of all public Channels a User has access to



75
76
77
# File 'lib/arena/api.rb', line 75

def user_channels(id, options={})
  object_from_response(Arena::ChannelResults, :get, "/users/#{id}/channels", options)
end

#user_feed(id, options = {}) ⇒ Object

Returns a paginated feed for a given User



55
56
57
# File 'lib/arena/api.rb', line 55

def user_feed(id, options={})
  object_from_response(Arena::UserFeed, :get, "/user/#{id}/feed", options)
end