Class: Lifen::Flows

Inherits:
Base
  • Object
show all
Defined in:
lib/lifen/flows.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user) ⇒ Flows

Returns a new instance of Flows.



4
5
6
7
# File 'lib/lifen/flows.rb', line 4

def initialize(user)
  @user = user
  @collection = []
end

Instance Attribute Details

#collection ⇒ Object (readonly)

Returns the value of attribute collection.



9
10
11
# File 'lib/lifen/flows.rb', line 9

def collection
  @collection
end

#user ⇒ Object (readonly)

Returns the value of attribute user.



9
10
11
# File 'lib/lifen/flows.rb', line 9

def user
  @user
end

Instance Method Details

#all ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/lifen/flows.rb', line 11

def all
  json = client.get("central/api/chats")

  json["_embedded"]["flows"].each do |element|
    flow = Flow.new(element)
    flow.user = user

    @collection << flow
  end

  collection
end