taiga 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: '009845e6e1f7913fa26499174e9d27f32892ef202924abfa01162b8cb393773d'
4
+ data.tar.gz: 6ab42f67ac9ad3d1d999c297897d0465163933042b46351037b09ec7ca6ee978
5
+ SHA512:
6
+ metadata.gz: 0524b5a378b99e87f79f0859564d82f14b5a8d78ac32429aa14a27a96f9f0a6f1511586e0826317cc8c5ae9f88dc702f223e56e7ec57fd2899815008ae44b46b
7
+ data.tar.gz: 30f188cebd91adf0c806ce18e35dbc516ad3e92c91290ed29ad5494d27502431572388f94f43fcc254c0ac36ac468a4938016dad940c1dfe84a0c5528e746748
data/.rubocop.yml ADDED
@@ -0,0 +1,37 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+ Exclude:
4
+ - 'vendor/**/*'
5
+ NewCops: enable
6
+
7
+ Metrics/AbcSize:
8
+ Max: 20
9
+
10
+ Metrics/MethodLength:
11
+ Max: 20
12
+
13
+ Layout/LineLength:
14
+ Enabled: false
15
+
16
+ Style/Documentation:
17
+ Enabled: false
18
+
19
+ Style/FrozenStringLiteralComment:
20
+ Enabled: false
21
+
22
+ Style/NumericLiterals:
23
+ Enabled: false
24
+
25
+ Style/TrailingCommaInArrayLiteral:
26
+ EnforcedStyleForMultiline: comma
27
+
28
+ Style/TrailingCommaInHashLiteral:
29
+ EnforcedStyleForMultiline: comma
30
+
31
+ Layout/HashAlignment:
32
+ EnforcedHashRocketStyle: table
33
+
34
+ Metrics/BlockLength:
35
+ Exclude:
36
+ - '*.gemspec'
37
+ - 'spec/**/*_spec.rb'
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in taiga.gemspec
6
+ gemspec
7
+
8
+ gem 'rake', '~> 13.0'
9
+
10
+ gem 'rubocop', '~> 1.21'
data/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # Taiga API client
2
+
3
+ This gem provides an API client for [Taiga](https://www.taiga.io/), an agile project manager.
4
+
5
+ This API client is built using [Flexirest](https://github.com/flexirest/flexirest), so it can easily been integrated into _Rails_.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'taiga'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install taiga
22
+
23
+ ## Usage
24
+
25
+ ```ruby
26
+ require 'taiga'
27
+
28
+ Taiga.api_url = 'https://api.taiga.io'
29
+
30
+ Taiga.authenticate(username: 'demo', password: 'secret')
31
+
32
+ projects = Taiga::Project.all
33
+ project = projects.first
34
+ pp projects.milestones.to_hash
35
+ ```
36
+
37
+ ## Development
38
+
39
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
40
+
41
+ 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
42
+
43
+ ## Contributing
44
+
45
+ Bug reports and pull requests are welcome on GitHub at https://github.com/opus-codium/taiga.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rubocop/rake_task'
5
+
6
+ RuboCop::RakeTask.new
7
+
8
+ task default: :rubocop
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Taiga
4
+ VERSION = '0.1.0'
5
+ end
data/lib/taiga.rb ADDED
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'taiga/version'
4
+
5
+ require 'flexirest'
6
+
7
+ module Taiga
8
+ class FlexiBase < Flexirest::Base
9
+ def self.base_url
10
+ Taiga.api_url
11
+ end
12
+
13
+ before_request :set_bearer
14
+ def set_bearer(_name, request)
15
+ request.headers['Authorization'] = "Bearer #{Taiga.auth_token}"
16
+ end
17
+
18
+ before_request :disable_pagination
19
+ def disable_pagination(name, request)
20
+ request.headers['x-disable-pagination'] = 'True' if name == :all
21
+ end
22
+ end
23
+
24
+ class Project < FlexiBase
25
+ get :all, '/projects'
26
+
27
+ def milestones
28
+ Taiga::Milestone.all(project: id)
29
+ end
30
+ end
31
+
32
+ class Milestone < FlexiBase
33
+ get :all, '/milestones'
34
+ get :find, '/milestones/:id'
35
+
36
+ def tasks
37
+ Taiga::Task.all(milestone: id, project: project)
38
+ end
39
+ end
40
+
41
+ class UserStory < FlexiBase
42
+ get :find, '/userstories/:id'
43
+ end
44
+
45
+ class Task < FlexiBase
46
+ get :all, '/tasks'
47
+ end
48
+
49
+ class Auth < Flexirest::Base
50
+ def self.base_url
51
+ Taiga.api_url
52
+ end
53
+
54
+ post :login, '/auth', requires: %i[username password type]
55
+ end
56
+
57
+ class << self
58
+ attr_accessor :api_url, :auth_token
59
+
60
+ def authenticate(username:, password:)
61
+ user_auth_detail = Taiga::Auth.login username: username, password: password, type: 'normal'
62
+ self.auth_token = user_auth_detail.auth_token
63
+
64
+ user_auth_detail
65
+ end
66
+ end
67
+ end
data/sig/taiga.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Taiga
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
data/taiga.gemspec ADDED
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/taiga/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'taiga'
7
+ spec.version = Taiga::VERSION
8
+ spec.authors = ['Romuald Conty']
9
+ spec.email = ['romuald@opus-codium.fr']
10
+
11
+ spec.summary = 'Taiga API client'
12
+ spec.description = 'Taiga API client'
13
+ spec.homepage = 'https://github.com/opus-codium/ruby-taiga'
14
+ spec.required_ruby_version = '>= 2.6.0'
15
+
16
+ spec.metadata['homepage_uri'] = spec.homepage
17
+ spec.metadata['source_code_uri'] = spec.homepage
18
+ spec.metadata['changelog_uri'] = "#{spec.homepage}/CHANGELOG.md"
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
+ `git ls-files -z`.split("\x0").reject do |f|
24
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
25
+ end
26
+ end
27
+ spec.bindir = 'exe'
28
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ['lib']
30
+
31
+ spec.add_dependency 'flexirest'
32
+
33
+ spec.add_development_dependency 'byebug'
34
+ spec.metadata['rubygems_mfa_required'] = 'true'
35
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: taiga
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Romuald Conty
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-09-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: flexirest
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: byebug
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Taiga API client
42
+ email:
43
+ - romuald@opus-codium.fr
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".rubocop.yml"
49
+ - Gemfile
50
+ - README.md
51
+ - Rakefile
52
+ - lib/taiga.rb
53
+ - lib/taiga/version.rb
54
+ - sig/taiga.rbs
55
+ - taiga.gemspec
56
+ homepage: https://github.com/opus-codium/ruby-taiga
57
+ licenses: []
58
+ metadata:
59
+ homepage_uri: https://github.com/opus-codium/ruby-taiga
60
+ source_code_uri: https://github.com/opus-codium/ruby-taiga
61
+ changelog_uri: https://github.com/opus-codium/ruby-taiga/CHANGELOG.md
62
+ rubygems_mfa_required: 'true'
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: 2.6.0
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubygems_version: 3.1.2
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: Taiga API client
82
+ test_files: []