active_pivot 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ddfd8ecabf7eb02b0c27dbe9dee4379f809abba9
4
- data.tar.gz: 87c5999311a37760f3aa71905151831b1233f02f
3
+ metadata.gz: 91900b963062514c2b7bde44ce7ad8603a3fcec6
4
+ data.tar.gz: 418925417ea5c8482ea7d5dd8a0ebbb75e3dacd1
5
5
  SHA512:
6
- metadata.gz: 1245ceaa173eca33e982179b910c063ed179016aa99bdc5244979090bebba3362c1a1715fdb1dbbbf93c2d5a4ff5bc03ecfe08db1ffc4c1b13d2c58ac0213a01
7
- data.tar.gz: 367fb78a74ff099c4a9d5e507e533634ad55f0b2eba1f7adfcb90c2262f2eca99bcc4987fe0a10f091be7fa6037da636101f67697c2993e43133d3c6930a2130
6
+ metadata.gz: c1e230b197c717e72e6ba82400b4e4756a193ea11f7ebce077618332a810e53c5466f37b1e96cb079beabf42501179dbf1521e83a31f92518c779dea86c77c36
7
+ data.tar.gz: c81ff145b3fa7c5de7bf920038d600b31e56cd9089dfbb38998c3cb005fda38be27a797bb84863e942b4a6e0e6d4b296a8ba981eff4bc5ee7931c96d8c4b7af1
data/README.md CHANGED
@@ -68,11 +68,22 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
68
68
 
69
69
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
70
70
 
71
+ ## License
72
+
73
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
74
+
71
75
  ## Contributing
72
76
 
73
- Bug reports and pull requests are welcome on GitHub at https://github.com/foraker/active_pivot.
77
+ 1. Fork it
78
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
79
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
80
+ 4. Push to the branch (`git push origin my-new-feature`)
81
+ 5. Create new Pull Request
74
82
 
83
+ ## About Foraker Labs
75
84
 
76
- ## License
85
+ <img src="http://assets.foraker.com/foraker_logo.png" width="400" height="62">
77
86
 
78
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
87
+ This project is maintained by Foraker Labs. The names and logos of Foraker Labs are fully owned and copyright Foraker Design, LLC.
88
+
89
+ Foraker Labs is a Boulder-based Ruby on Rails and iOS development shop. Please reach out if we can [help build your product](http://www.foraker.com).
data/active_pivot.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = %q{Import all of your Pivotal projects and stories easily}
13
13
  #spec.description = %q{TODO: Write a longer description or delete this line.}
14
- spec.homepage = "http://www.foraker.com"
14
+ spec.homepage = "https://github.com/foraker/active_pivot"
15
15
  spec.license = "MIT"
16
16
 
17
17
  # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
@@ -28,7 +28,7 @@ module ActivePivot
28
28
 
29
29
  (2..total_pages).map do |page|
30
30
  offset = limit * (page - 1)
31
- Request.get(endpoint, params.merge(offset: offset))
31
+ send_request(params.merge(offset: offset))
32
32
  end
33
33
  end
34
34
 
@@ -37,8 +37,21 @@ module ActivePivot
37
37
  end
38
38
 
39
39
  def first_page
40
- @first_page ||= Request.get(endpoint, params)
40
+ @first_page ||= send_request(params)
41
+ end
42
+
43
+ def send_request(params = {})
44
+ Request.get(endpoint, params).tap do |response|
45
+ raise_request_error unless response.success?
46
+ end
47
+ end
48
+
49
+ def raise_request_error
50
+ raise InvalidRequestError,
51
+ "Pivotal request failed. Endpoint #{endpoint} invalid with params: #{params}"
41
52
  end
42
53
  end
54
+
55
+ class InvalidRequestError < StandardError; end
43
56
  end
44
57
  end
@@ -1,10 +1,12 @@
1
1
  module ActivePivot
2
2
  module Api
3
3
  class Project < OpenStruct
4
+ COLLECTION_URL = "/services/v5/projects.json?fields=:default,current_velocity,current_volatility"
5
+
4
6
  def self.all
5
- Api::PaginatedCollection.new("/services/v5/projects.json").all.map do |remote_project|
6
- self.new(remote_project) rescue nil
7
- end.compact
7
+ Api::PaginatedCollection.new(COLLECTION_URL).all.map do |remote_project|
8
+ self.new(remote_project)
9
+ end
8
10
  end
9
11
  end
10
12
  end
@@ -5,9 +5,13 @@ module ActivePivot
5
5
  end
6
6
 
7
7
  def run
8
+ puts "Importing Projects"
8
9
  import_projects
10
+ puts "Importing Epics"
9
11
  import_epics
12
+ puts "Importing Stories"
10
13
  import_stories
14
+ puts "Importing Activity - may take up to 10 minutes"
11
15
  import_activities
12
16
  end
13
17
 
@@ -18,8 +22,10 @@ module ActivePivot
18
22
  ActivePivot::Project.where(pivotal_id: remote_project.id)
19
23
  .first_or_initialize
20
24
  .update_attributes!({
21
- name: remote_project.name,
22
- point_scale: remote_project.point_scale
25
+ name: remote_project.name,
26
+ point_scale: remote_project.point_scale,
27
+ current_velocity: remote_project.current_velocity,
28
+ current_volatility: remote_project.current_volatility
23
29
  })
24
30
  end
25
31
  end
@@ -1,3 +1,3 @@
1
1
  module ActivePivot
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -2,7 +2,7 @@ module ActivePivot
2
2
  module Generators
3
3
  class MigrationsGenerator < ::Rails::Generators::Base
4
4
  def create_all
5
- generate "migration", "create_pivotal_projects pivotal_id:integer name:text point_scale:text updated_at:datetime created_at:datetime"
5
+ generate "migration", "create_pivotal_projects pivotal_id:integer name:text point_scale:text current_velocity:integer current_volatility:integer updated_at:datetime created_at:datetime"
6
6
  generate "migration", "create_pivotal_epics project_id:integer:index pivotal_id:integer label_id:integer name:string url:string updated_at:datetime created_at:datetime"
7
7
  generate "migration", "create_pivotal_stories pivotal_id:integer project_id:integer:index started_at:datetime accepted_at:datetime url:string estimate:integer name:text description:text kind:string story_type:string labels:text current_state:string tags:text[] updated_at:datetime created_at:datetime"
8
8
  generate "migration", "create_pivotal_epic_stories story_id:integer:index epic_id:integer:index updated_at:datetime created_at:datetime"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_pivot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Allan McLelland
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2015-08-13 00:00:00.000000000 Z
12
+ date: 2015-08-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -122,7 +122,7 @@ files:
122
122
  - lib/active_pivot/version.rb
123
123
  - lib/generators/active_pivot/migrations_generator.rb
124
124
  - lib/tasks/import.rake
125
- homepage: http://www.foraker.com
125
+ homepage: https://github.com/foraker/active_pivot
126
126
  licenses:
127
127
  - MIT
128
128
  metadata: