Class: Snov::GetUserLists
- Inherits:
-
Object
- Object
- Snov::GetUserLists
- Includes:
- Enumerable
- Defined in:
- lib/snov/get_user_lists.rb
Defined Under Namespace
Classes: UserList
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #all ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(client: Snov.client) ⇒ GetUserLists
constructor
A new instance of GetUserLists.
- #raw_result ⇒ Object
Constructor Details
#initialize(client: Snov.client) ⇒ GetUserLists
Returns a new instance of GetUserLists.
9 10 11 |
# File 'lib/snov/get_user_lists.rb', line 9 def initialize(client: Snov.client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/snov/get_user_lists.rb', line 7 def client @client end |
Instance Method Details
#all ⇒ Object
17 18 19 |
# File 'lib/snov/get_user_lists.rb', line 17 def all @all ||= raw_result.map { |result| UserList.new(result) } end |
#each(&block) ⇒ Object
13 14 15 |
# File 'lib/snov/get_user_lists.rb', line 13 def each(&block) all.each(&block) end |
#raw_result ⇒ Object
21 22 23 24 25 |
# File 'lib/snov/get_user_lists.rb', line 21 def raw_result @raw_result ||= client.get("/v1/get-user-lists").map do |val| val.deep_transform_keys! { |key| key.underscore } end end |