Class: Workarea::Listrak::EmailApi::Lists

Inherits:
Object
  • Object
show all
Defined in:
app/services/workarea/listrak/email_api/lists.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Lists

Returns a new instance of Lists.



6
7
8
# File 'app/services/workarea/listrak/email_api/lists.rb', line 6

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



4
5
6
# File 'app/services/workarea/listrak/email_api/lists.rb', line 4

def client
  @client
end

Instance Method Details

#allArray<Workarea::Listrak::Models::List>

Get all lists in Listrak

Returns:



13
14
15
16
17
18
# File 'app/services/workarea/listrak/email_api/lists.rb', line 13

def all
  request = Net::HTTP::Get.new("/email/v1/List")
  response = client.request request
  body = JSON.parse(response.body)
  body["data"].map { |list| Listrak::Models::List.new list }
end