clubhouse2 1.0.8 → 1.0.10

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: 40998417601b817ffb0e23d294fd1f5262e35d01
4
- data.tar.gz: 0e111ccac222e17e6364e0aa0469a3c21f8c90d9
3
+ metadata.gz: dd670ee7b3ffc956dd48aa6c646e2dbe905b72c0
4
+ data.tar.gz: 6f795a61c79142106135e72cd978228d91fb1278
5
5
  SHA512:
6
- metadata.gz: 34c1371201ef1e8bcec2fc2e8877d95b13436ef9916906ff161834f35e0835882f6670472ee9c251b8ca5dd3840d891543b17837dd927932040fd838186d2832
7
- data.tar.gz: f6b0bdd08e9d6b18b1de74f6b5488f3d9064b15a02af6468b0d9579833227d226d326aadb92d6af91653455dc30d1efb764455e6544922e969f6d0883cee22a4
6
+ metadata.gz: 278a0f5d415e63413657dbe6518724ddcc2edc86061ebce1a0732b79875beecd15121f0a08eca41cbe89eb6d54552e815536d76b94e5d507ce8bb65dc688200a
7
+ data.tar.gz: 9862293188fff7c1b7b7001dd92ececcf94d025f6c4ad39707c907fd7a0a34c049d3d617530333e26ffe348e5c87a97c4639558b1b8d357a7aaabc3aaf2fc869
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.8
1
+ 1.0.10
data/lib/clubhouse2.rb CHANGED
@@ -18,6 +18,9 @@ require 'clubhouse2/team.rb'
18
18
  require 'clubhouse2/file.rb'
19
19
  require 'clubhouse2/task.rb'
20
20
  require 'clubhouse2/epic.rb'
21
+ require 'clubhouse2/branch.rb'
22
+ require 'clubhouse2/pull_request.rb'
23
+ require 'clubhouse2/commit.rb'
21
24
 
22
25
  module Clubhouse
23
- end
26
+ end
@@ -0,0 +1,7 @@
1
+ module Clubhouse
2
+ class Branch < ClubhouseResource
3
+ def self.properties
4
+ [ :created_at, :deleted, :entity_type, :merged_branch_ids, :id, :name, :persistent, :pull_requests, :repository_id, :updated_at, :url ]
5
+ end
6
+ end
7
+ end
@@ -3,7 +3,7 @@ require 'uri'
3
3
  require 'json'
4
4
 
5
5
  module Clubhouse
6
- class Client
6
+ class Client
7
7
  def initialize(api_key:, base_url: 'https://api.clubhouse.io/api/v2/')
8
8
  @api_key = api_key
9
9
  @base_url = base_url
@@ -52,7 +52,7 @@ module Clubhouse
52
52
  new_params = args.compact.reject { |k, v| this_class.property_filter_create.include? k.to_sym }
53
53
  response = api_request(:post, url(this_class.api_url), :json => new_params)
54
54
  JSON.parse(response.to_s)
55
- end
55
+ end
56
56
 
57
57
  def get_objects(resource_class, args = {})
58
58
  this_class = Clubhouse::ClubhouseResource.subclass(resource_class)
@@ -97,7 +97,7 @@ module Clubhouse
97
97
  def create_member(**args); create_object(:member, args); end
98
98
  def members(**args); get_objects(:member, args); end
99
99
  def member(**args); get_object(:member, args); end
100
-
100
+
101
101
  def create_team(**args); create_object(:team, args); end
102
102
  def teams(**args); get_objects(:team, args); end
103
103
  def team(**args); get_object(:team, args); end
@@ -58,7 +58,7 @@ module Clubhouse
58
58
  end
59
59
 
60
60
  def value_format(key, value)
61
- Date.iso8601(value) rescue value
61
+ DateTime.strptime(value+'+0000', '%Y-%m-%dT%H:%M:%SZ%z') rescue value
62
62
  end
63
63
 
64
64
  # Empties resource cache
@@ -82,4 +82,4 @@ module Clubhouse
82
82
  Hash[ (self.class.properties - self.class.property_filter_create).map { |name| [ name, instance_variable_get('@' + name.to_s) ] } ].compact
83
83
  end
84
84
  end
85
- end
85
+ end
@@ -0,0 +1,7 @@
1
+ module Clubhouse
2
+ class Commit < ClubhouseResource
3
+ def self.properties
4
+ [ :author_email, :author_id, :author_identity, :created_at, :entity_type, :hash, :id, :merged_branch_ids, :message, :repository_id, :timestamp, :updated_at, :url ]
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module Clubhouse
2
+ class PullRequest < ClubhouseResource
3
+ def self.properties
4
+ [ :branch_id, :closed, :entity_type, :created_at, :id, :num_added, :num_commits, :num_modified, :num_removed, :number, :target_branch_id, :title, :updated_at, :url ]
5
+ end
6
+ end
7
+ end
@@ -2,7 +2,7 @@ module Clubhouse
2
2
  class Story < ClubhouseResource
3
3
  def self.properties
4
4
  [
5
- :archived, :blocker, :blocker, :comment_ids, :completed, :completed_at, :completed_at_override, :created_at,
5
+ :archived, :blocker, :blocked, :comment_ids, :completed, :completed_at, :completed_at_override, :created_at,
6
6
  :deadline, :entity_type, :epic_id, :estimate, :external_id, :file_ids, :follower_ids, :id,
7
7
  :linked_file_ids, :moved_at, :name, :owner_ids, :position, :project_id, :requested_by_id, :started,
8
8
  :started_at, :started_at_override, :story_type, :task_ids, :updated_at, :workflow_state_id,
@@ -14,10 +14,10 @@ module Clubhouse
14
14
  end
15
15
 
16
16
  def validate(**args)
17
- raise NoSuchEpic.new(args[:epic_id]) unless @client.epic(id: args[:epic_id]) if args[:epic_id]
18
- raise NoSuchProject.new(args[:project_id]) unless @client.project(id: args[:project_id]) if args[:project_id]
19
- raise NoSuchMember.new(args[:requested_by_id]) unless @client.member(id: args[:requested_by_id]) if args[:requested_by_id]
20
-
17
+ raise NoSuchEpic.new(args[:epic_id]) unless @client.epic(id: args[:epic_id]) if args[:epic_id]
18
+ raise NoSuchProject.new(args[:project_id]) unless @client.project(id: args[:project_id]) if args[:project_id]
19
+ raise NoSuchMember.new(args[:requested_by_id]) unless @client.member(id: args[:requested_by_id]) if args[:requested_by_id]
20
+
21
21
  (args[:follower_ids] || []).each do |this_member|
22
22
  raise NoSuchMember.new(this_member) unless @client.member(id: this_member)
23
23
  end
@@ -102,9 +102,33 @@ module Clubhouse
102
102
  files: [ *files ].collect(&:to_h),
103
103
  story_links: [ *story_links ].collect(&:to_h),
104
104
  labels: [ *labels ].collect(&:to_h),
105
+ branches: [ *branches ].collect(&:to_h),
106
+ commits: [ *commits ].collect(&:to_h),
105
107
  })
106
108
  end
107
109
 
110
+ def full_story(**args)
111
+ @full_story ||= begin
112
+ JSON.parse(@client.api_request(:get, @client.url("#{Story.api_url}/#{id}")))
113
+ end
114
+ end
115
+
116
+ def commits(**args)
117
+ @commits ||= begin
118
+ full_story['commits'].collect do |commit_data|
119
+ Commit.new(client: @client, object: commit_data)
120
+ end
121
+ end
122
+ end
123
+
124
+ def branches(**args)
125
+ @branches ||= begin
126
+ full_story['branches'].collect do |branch_data|
127
+ Branch.new(client: @client, object: branch_data)
128
+ end
129
+ end
130
+ end
131
+
108
132
  def create_comment(**args)
109
133
  Task.validate(**args)
110
134
  @comments = nil
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clubhouse2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Denness
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-20 00:00:00.000000000 Z
11
+ date: 2018-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -64,9 +64,11 @@ files:
64
64
  - VERSION
65
65
  - clubhouse2.gemspec
66
66
  - lib/clubhouse2.rb
67
+ - lib/clubhouse2/branch.rb
67
68
  - lib/clubhouse2/category.rb
68
69
  - lib/clubhouse2/client.rb
69
70
  - lib/clubhouse2/clubhouse_resource.rb
71
+ - lib/clubhouse2/commit.rb
70
72
  - lib/clubhouse2/epic.rb
71
73
  - lib/clubhouse2/epic_comment.rb
72
74
  - lib/clubhouse2/exceptions.rb
@@ -77,6 +79,7 @@ files:
77
79
  - lib/clubhouse2/milestone.rb
78
80
  - lib/clubhouse2/profile.rb
79
81
  - lib/clubhouse2/project.rb
82
+ - lib/clubhouse2/pull_request.rb
80
83
  - lib/clubhouse2/repository.rb
81
84
  - lib/clubhouse2/state.rb
82
85
  - lib/clubhouse2/story.rb