Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/rc#32 teamwork integration #41

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
476456c
feature/RC#32-teamwork-integration Add Task remote api
rachidcalazans Feb 23, 2018
4702c1d
Update TaskApi
rachidcalazans Feb 23, 2018
d42d875
feature/RC#32-teamwork-integration Add Repo Injection on App module
rachidcalazans Mar 5, 2018
3cdf413
feature/RC#32-teamwork-integration Update TaskApi for Teamwork
rachidcalazans Mar 5, 2018
34850a7
feature/RC#32-teamwork-integration Add Domain module with entity
rachidcalazans Mar 5, 2018
346fd6a
feature/RC#32 Add EntityBase on domain
rachidcalazans Mar 9, 2018
ec48a7f
feature/RC#32 Add ApiBase on infrastructure
rachidcalazans Mar 9, 2018
c5d314d
feature/RC#32 Add http gem
rachidcalazans Mar 9, 2018
67cb841
feature/RC#32 Update Task Entity attributes
rachidcalazans Mar 9, 2018
4c4a531
feature/RC#32 Update TaskResponse dto
rachidcalazans Mar 9, 2018
e5f5500
feature/RC#32 Refactor TaskApi for Teamwork
rachidcalazans Mar 9, 2018
97d0663
feature/RC#32 Refactor InjectionsRepositories
rachidcalazans Mar 9, 2018
68e3cd2
feature/RC#32 Add Project Entity
rachidcalazans Mar 9, 2018
80d3177
feature/RC#32 Add ProjectApi and Response
rachidcalazans Mar 9, 2018
d7ea3fb
feature/RC#32 Add new provide for Project repository
rachidcalazans Mar 9, 2018
f03dcba
feature/RC#32 Add List Entity
rachidcalazans Mar 9, 2018
0b5112b
feature/RC#32 Add ListApi and ListResponse
rachidcalazans Mar 9, 2018
3290eb6
feature/RC#32 Add new provide for Listt repository
rachidcalazans Mar 9, 2018
6775390
feature/RC#32 Update Injection Repositories
rachidcalazans Mar 9, 2018
1fe43be
feature/RC#32 Add method on TaskApi
rachidcalazans Mar 9, 2018
806c2c0
feature/RC#32 Update Gemfile.lock
rachidcalazans Mar 9, 2018
8c97b3e
feature/RC#32 Update REAMD with new Rails version
rachidcalazans Mar 9, 2018
3a2aea4
feature/RC#32-teamwork-integration Update ruby version on Travis config
rachidcalazans Mar 11, 2018
dc86f41
Merge branch 'feature/RC#32-teamwork-integration' of github.com:rachi…
rachidcalazans Mar 11, 2018
9769a48
feature/RC#32-teamwork-integration Update travis config
rachidcalazans Mar 11, 2018
959ee0c
feature/RC#32-teamwork-integration Update travis config
rachidcalazans Mar 11, 2018
0e9c46f
feature/RC#32-teamwork-integration Update rails version on Gemfile.lock
rachidcalazans Mar 16, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: ruby
rvm:
- 2.4.2
- 2.5.0
env:
- DB =pgsql
services:
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'http'
144 changes: 81 additions & 63 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,57 +1,59 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.1.4)
actionpack (= 5.1.4)
actioncable (5.1.5)
actionpack (= 5.1.5)
nio4r (~> 2.0)
websocket-driver (~> 0.6.1)
actionmailer (5.1.4)
actionpack (= 5.1.4)
actionview (= 5.1.4)
activejob (= 5.1.4)
actionmailer (5.1.5)
actionpack (= 5.1.5)
actionview (= 5.1.5)
activejob (= 5.1.5)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.1.4)
actionview (= 5.1.4)
activesupport (= 5.1.4)
actionpack (5.1.5)
actionview (= 5.1.5)
activesupport (= 5.1.5)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.1.4)
activesupport (= 5.1.4)
actionview (5.1.5)
activesupport (= 5.1.5)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.1.4)
activesupport (= 5.1.4)
activejob (5.1.5)
activesupport (= 5.1.5)
globalid (>= 0.3.6)
activemodel (5.1.4)
activesupport (= 5.1.4)
activerecord (5.1.4)
activemodel (= 5.1.4)
activesupport (= 5.1.4)
activemodel (5.1.5)
activesupport (= 5.1.5)
activerecord (5.1.5)
activemodel (= 5.1.5)
activesupport (= 5.1.5)
arel (~> 8.0)
activesupport (5.1.4)
activesupport (5.1.5)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
annotate (2.7.2)
activerecord (>= 3.2, < 6.0)
rake (>= 10.4, < 13.0)
arel (8.0.0)
autoprefixer-rails (7.1.6)
autoprefixer-rails (8.1.0.1)
execjs
bcrypt (3.1.11)
bindex (0.5.0)
bootstrap (4.0.0.beta2.1)
bootstrap (4.0.0)
autoprefixer-rails (>= 6.0.3)
popper_js (>= 1.12.3, < 2)
popper_js (>= 1.12.9, < 2)
sass (>= 3.5.2)
builder (3.2.3)
byebug (9.1.0)
byebug (10.0.0)
coderay (1.1.2)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
Expand All @@ -61,7 +63,7 @@ GEM
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
crass (1.0.2)
crass (1.0.3)
database_cleaner (1.6.2)
devise (4.4.1)
bcrypt (~> 3.0)
Expand All @@ -70,21 +72,32 @@ GEM
responders
warden (~> 1.2.3)
diff-lcs (1.3)
domain_name (0.5.20170404)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.2.1)
dotenv-rails (2.2.1)
dotenv (= 2.2.1)
railties (>= 3.2, < 5.2)
erubi (1.7.0)
erubi (1.7.1)
execjs (2.7.0)
factory_bot (4.8.2)
activesupport (>= 3.0.0)
factory_bot_rails (4.8.2)
factory_bot (~> 4.8.2)
railties (>= 3.0.0)
ffi (1.9.18)
ffi (1.9.23)
globalid (0.4.1)
activesupport (>= 4.2.0)
i18n (0.9.1)
http (3.0.0)
addressable (~> 2.3)
http-cookie (~> 1.0)
http-form_data (>= 2.0.0.pre.pre2, < 3)
http_parser.rb (~> 0.6.0)
http-cookie (1.0.3)
domain_name (~> 0.5)
http-form_data (2.1.0)
http_parser.rb (0.6.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jbuilder (2.7.0)
activesupport (>= 4.2.0)
Expand All @@ -96,44 +109,45 @@ GEM
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
loofah (2.1.1)
loofah (2.2.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.0)
mini_mime (>= 0.1.1)
method_source (0.9.0)
mini_mime (1.0.0)
mini_portile2 (2.3.0)
minitest (5.10.3)
multi_json (1.12.2)
nio4r (2.1.0)
nokogiri (1.8.1)
minitest (5.11.3)
multi_json (1.13.1)
nio4r (2.2.0)
nokogiri (1.8.2)
mini_portile2 (~> 2.3.0)
orm_adapter (0.5.0)
pg (0.21.0)
popper_js (1.12.5)
pry (0.11.2)
pg (1.0.0)
popper_js (1.12.9)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-rails (0.3.6)
pry (>= 0.10.4)
puma (3.10.0)
public_suffix (3.0.2)
puma (3.11.3)
pundit (1.1.0)
activesupport (>= 3.0.0)
rack (2.0.3)
rack-test (0.7.0)
rack (2.0.4)
rack-test (0.8.3)
rack (>= 1.0, < 3)
rails (5.1.4)
actioncable (= 5.1.4)
actionmailer (= 5.1.4)
actionpack (= 5.1.4)
actionview (= 5.1.4)
activejob (= 5.1.4)
activemodel (= 5.1.4)
activerecord (= 5.1.4)
activesupport (= 5.1.4)
rails (5.1.5)
actioncable (= 5.1.5)
actionmailer (= 5.1.5)
actionpack (= 5.1.5)
actionview (= 5.1.5)
activejob (= 5.1.5)
activemodel (= 5.1.5)
activerecord (= 5.1.5)
activesupport (= 5.1.5)
bundler (>= 1.3.0)
railties (= 5.1.4)
railties (= 5.1.5)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.2)
actionpack (~> 5.x, >= 5.0.1)
Expand All @@ -144,43 +158,43 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (5.1.4)
actionpack (= 5.1.4)
activesupport (= 5.1.4)
railties (5.1.5)
actionpack (= 5.1.5)
activesupport (= 5.1.5)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (12.2.1)
rb-fsevent (0.10.2)
rake (12.3.0)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
redis (3.3.3)
responders (2.4.0)
actionpack (>= 4.2.0, < 5.3)
railties (>= 4.2.0, < 5.3)
rspec-core (3.7.0)
rspec-core (3.7.1)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-mocks (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-rails (3.7.1)
rspec-rails (3.7.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.0)
sass (3.5.3)
rspec-support (3.7.1)
sass (3.5.5)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.0.6)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
Expand All @@ -201,13 +215,16 @@ GEM
thor (0.20.0)
thread_safe (0.3.6)
tilt (2.0.8)
turbolinks (5.0.1)
turbolinks-source (~> 5)
turbolinks-source (5.0.3)
tzinfo (1.2.4)
turbolinks (5.1.0)
turbolinks-source (~> 5.1)
turbolinks-source (5.1.0)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (3.2.0)
uglifier (4.1.6)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
warden (1.2.7)
rack (>= 1.0)
waterfall (1.2.0)
Expand All @@ -233,6 +250,7 @@ DEPENDENCIES
dotenv-rails
factory_bot
factory_bot_rails
http
jbuilder (~> 2.5)
jquery-rails
listen (~> 3.0.5)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## Dependencies

* Ruby version 2.5.0
* Rails version 5.1
* Rails version ~> 5.1
* Postgres >= 9.5

You must have redis installed and running on the default port:6379 (or configure it in config/redis/cable.yml).
Expand Down
46 changes: 46 additions & 0 deletions app/injections/repositories.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
module Injections
module Repositories

def build_teamwork_adapter(url_base:, token:)
Adapter.new(:teamwork, url_base, token, '')
end

def build_trello_adapter(url_base:, token:, key:)
Adapter.new(:trello, url_base, token, key)
end


def provide_project_repo(adapter:)
PROJECT_REPO[adapter.name].call(adapter)
end

def provide_list_repo(adapter:)
LIST_REPO[adapter.name].call(adapter)
end

def provide_task_repo(adapter:)
TASK_REPO[adapter.name].call(adapter)
end

private
Adapter = Struct.new(:name, :url_base, :token, :key)

RequestApi = Struct.new(:url_base, :headers, :body_params, :user)
REQUESTS = {
teamwork: -> (adapter) { RequestApi.new(adapter.url_base, {}, {}, adapter.token) },
trello: -> (adapter) { RequestApi.new(adapter.url_base, {}, "key=#{adapter.key}&token=#{adapter.token}") }
}

PROJECT_REPO = {
teamwork: -> (adapter) { ::Infrastructure::Remote::Project::Teamwork::ProjectApi.new(request_api: REQUESTS[:teamwork].call(adapter)) }
}

LIST_REPO = {
teamwork: -> (adapter) { ::Infrastructure::Remote::List::Teamwork::ListApi.new(request_api: REQUESTS[:teamwork].call(adapter)) }
}

TASK_REPO = {
teamwork: -> (adapter) { ::Infrastructure::Remote::Task::Teamwork::TaskApi.new(request_api: REQUESTS[:teamwork].call(adapter)) }
}
end
end
19 changes: 19 additions & 0 deletions lib/domain/entity/base.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module Domain
module Entity
module Base

def initialize attributes = {}
check_attrs attributes
end

private
def check_attrs attrs
return if attrs.nil?

attrs.each do |k, v|
instance_variable_set("@#{k}", v) if self.class.method_defined?(k) || self.private_methods.include?(k.to_sym)
end
end
end
end
end
12 changes: 12 additions & 0 deletions lib/domain/entity/list.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Domain
module Entity
class List
include ::Domain::Entity::Base

attr_reader :id, :name, :description

end
end
end


11 changes: 11 additions & 0 deletions lib/domain/entity/project.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Domain
module Entity
class Project
include ::Domain::Entity::Base

attr_reader :id, :name, :description

end
end
end

Loading