yapt 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 23de5c03a7ac130c7f824eb67fb29f3e16f33a52
4
- data.tar.gz: 1cc941043e57e0e3557d506bb2f176d0dddf7d1f
3
+ metadata.gz: 999aeedf176d0b43f77dcc9a399d83201d9775e2
4
+ data.tar.gz: 896a433f93e1c8635ca5921757f642872f5e0939
5
5
  SHA512:
6
- metadata.gz: a700985a6d0e2e93665ffa341acec9b17c01cdc498c2f2e2d0274411f8918ef897f1b9689766d8f64076f5b6923fc4c41e944f540fc57298a01e15f2d89df9fb
7
- data.tar.gz: db5d1a4cfb1d4d4e237838dc490532375ae6dfe1bb64f2ce29718e87220dbd58c6ef772531ac11898b8da0e785a5312ac0896fb67092e53b56b0a2798c3f85a9
6
+ metadata.gz: 7883e0d93da702b62ae4042d1ecea6c8d3c8236e48b0b2128c7f9c3226e2bc7413d8195842f0941effd0e69e19e949f34365bce2821491e792dfe1b561bcc655
7
+ data.tar.gz: a3519a4e0291b310c7c8b1aea95b595199d0205880fd9bf0f33bf4acd303135d6715ae89b6d3a7471af93a2ce5d986d341ba5a6e00f725559b21ff65912c7ddd
@@ -10,6 +10,7 @@ module Yapt
10
10
  autoload :Request, "yapt/request"
11
11
  autoload :Config, "yapt/config"
12
12
  autoload :Move, "yapt/move"
13
+ autoload :Comment, "yapt/comment"
13
14
 
14
15
  def self.config
15
16
  @config ||= Config.new(Dir.pwd)
@@ -0,0 +1,32 @@
1
+ module Yapt
2
+ class Comment
3
+ def self.find(story_id)
4
+ results = Request.new("stories/#{story_id}/comments", {}, :get).result
5
+ results.collect {|r| new(r) }
6
+ end
7
+
8
+ attr_reader :raw
9
+ def initialize(data)
10
+ @raw = data
11
+ end
12
+
13
+ [:person_id, :created_at, :updated_at, :text,
14
+ :story_id, :id].each do |attr|
15
+ define_method attr do
16
+ raw[attr.to_s]
17
+ end
18
+ end
19
+
20
+ def commenter
21
+ @commenter ||= Member.find(person_id)
22
+ end
23
+
24
+ def created_at_display
25
+ time_display(created_at)
26
+ end
27
+
28
+ def time_display(time)
29
+ Time.parse(time).strftime("%a %d %b %I:%M")
30
+ end
31
+ end
32
+ end
@@ -3,7 +3,11 @@ require "yaml"
3
3
  module Yapt
4
4
  class Member
5
5
  def self.find(id)
6
- new all.detect {|u| u["person"]["id"] == id }
6
+ new (all.detect {|u| u["person"]["id"] == id } || inactive_user)
7
+ end
8
+
9
+ def self.inactive_user
10
+ { "person" => { "initials" => '???' } }
7
11
  end
8
12
 
9
13
  attr_reader :membership
@@ -1,4 +1,5 @@
1
1
  require "rest-client"
2
+ require "json"
2
3
 
3
4
  module Yapt
4
5
  class Request
@@ -71,6 +71,10 @@ module Yapt
71
71
  end
72
72
  end
73
73
 
74
+ def comments
75
+ @comments ||= Comment.find(id)
76
+ end
77
+
74
78
  def owner_initials
75
79
  if owned_by_id
76
80
  "Owner: #{Member.find(owned_by_id).initials}"
@@ -2,11 +2,10 @@
2
2
  <%= story.id %> | <%= story.name %>
3
3
  <%= story.description %>
4
4
  <%= '-' * 100 %>
5
+ <% story.comments.each_with_index do |comment, i| -%>
6
+ <%= i+1 %>. <%= comment.commenter.initials %>: <%= comment.text %>
7
+ <% end %>
8
+ <%= '-' * 100 %>
5
9
  <%= story.created_at_display %> | <%= story.updated_at_display %> | <%= story.current_state %> | <%= story.requester_initials %> | <%= story.owner_initials %>
6
10
  <%= '=' * 100 %>
7
11
  <% end %>
8
- <% if false %>
9
- [:url, :story_type, :description, :id,
10
- :current_state, :labels, :owned_by_id, :created_at, :kind,
11
- :project_id, :requested_by_id, :updated_at, :name].each do |attr|
12
- <% end %>
@@ -1,3 +1,3 @@
1
1
  module Yapt
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yapt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Schenkman-Moore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-01 00:00:00.000000000 Z
11
+ date: 2014-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: boson
@@ -109,6 +109,7 @@ files:
109
109
  - Rakefile
110
110
  - bin/yapt
111
111
  - lib/yapt.rb
112
+ - lib/yapt/comment.rb
112
113
  - lib/yapt/config.rb
113
114
  - lib/yapt/filter.rb
114
115
  - lib/yapt/member.rb