Class: Line::Bot::Response::User::Profile

Inherits:
Object
  • Object
show all
Defined in:
lib/line/bot/response/user/profile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Profile

Returns a new instance of Profile.



11
12
13
14
15
16
17
18
19
# File 'lib/line/bot/response/user/profile.rb', line 11

def initialize(response)
  json = JSON.parse(response.body)

  @start = json['start']
  @count = json['count']
  @total = json['total']
  @contacts = create_contacts(json['contacts']) || []
  @display = json['display']
end

Instance Attribute Details

#contactsObject (readonly)

Returns the value of attribute contacts.



9
10
11
# File 'lib/line/bot/response/user/profile.rb', line 9

def contacts
  @contacts
end

#countObject (readonly)

Returns the value of attribute count.



9
10
11
# File 'lib/line/bot/response/user/profile.rb', line 9

def count
  @count
end

#displayObject (readonly)

Returns the value of attribute display.



9
10
11
# File 'lib/line/bot/response/user/profile.rb', line 9

def display
  @display
end

#startObject (readonly)

Returns the value of attribute start.



9
10
11
# File 'lib/line/bot/response/user/profile.rb', line 9

def start
  @start
end

#totalObject (readonly)

Returns the value of attribute total.



9
10
11
# File 'lib/line/bot/response/user/profile.rb', line 9

def total
  @total
end

Instance Method Details

#create_contacts(contacts) ⇒ Object



21
22
23
24
25
# File 'lib/line/bot/response/user/profile.rb', line 21

def create_contacts(contacts)
  contacts.map { |c|
    Contact.new(c)
  }
end