Class: Workarea::Listrak::EmailApi::Lists
- Inherits:
-
Object
- Object
- Workarea::Listrak::EmailApi::Lists
- Defined in:
- app/services/workarea/listrak/email_api/lists.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#all ⇒ Array<Workarea::Listrak::Models::List>
Get all lists in Listrak.
-
#initialize(client) ⇒ Lists
constructor
A new instance of Lists.
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
#client ⇒ Object (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
#all ⇒ Array<Workarea::Listrak::Models::List>
Get all lists in Listrak
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 |