Class: HbExporter::User
- Inherits:
-
Object
- Object
- HbExporter::User
- Includes:
- Helper::RecursivelyFetch
- Defined in:
- lib/hb_exporter/user.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #boards ⇒ Object
- #export_all_boards ⇒ Object
-
#initialize(name) ⇒ User
constructor
A new instance of User.
- #list_boards ⇒ Object
Methods included from Helper::RecursivelyFetch
Constructor Details
#initialize(name) ⇒ User
Returns a new instance of User.
11 12 13 |
# File 'lib/hb_exporter/user.rb', line 11 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/hb_exporter/user.rb', line 9 def name @name end |
Instance Method Details
#boards ⇒ Object
39 40 41 42 43 |
# File 'lib/hb_exporter/user.rb', line 39 def boards @boards ||= fetch_boards.map do |data| Board.new(data['board_id'], title: data['title'], desc: data['description'], pins_count: data['pin_count']) end end |
#export_all_boards ⇒ Object
34 35 36 |
# File 'lib/hb_exporter/user.rb', line 34 def export_all_boards end |
#list_boards ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/hb_exporter/user.rb', line 16 def list_boards return if boards.empty? id_max_len = [2, boards.map(&:id).max.to_s.size].max count_max_len = [5, boards.map(&:pins_count).max.to_s.size].max puts [ "id".rjust(id_max_len), "count".ljust(count_max_len), "title" ].join(" ") boards.each do |b| puts "#{b.id.to_s.rjust(id_max_len).cyan} #{b.pins_count.to_s.ljust(count_max_len).cyan} #{b.title.to_s.bold} - #{b.desc}" end end |