Class: GetResponse::LinksProxy

Inherits:
Object
  • Object
show all
Includes:
Conditions
Defined in:
lib/get_response/links_proxy.rb

Overview

Proxy class for all links related actions.

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ LinksProxy

Returns a new instance of LinksProxy.



7
8
9
# File 'lib/get_response/links_proxy.rb', line 7

def initialize(connection)
  @connection = connection
end

Instance Method Details

#all(conditions = {}) ⇒ Array

Fetch all links, optionally you can pass a hash with conditions.

Example:

@proxy.all("messages" => ["my_message_id", "my_second_message_id"])

Returns:

  • (Array)

    collection of links



19
20
21
22
23
24
25
# File 'lib/get_response/links_proxy.rb', line 19

def all(conditions = {})
  conditions = parse_conditions(conditions)

  @connection.send_request("get_links", conditions)["result"].map do |link_id, link_attrs|
    Link.new(link_attrs.merge("id" => link_id), @connection)
  end
end