klaro-client 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +3 -0
  3. data/Rakefile +11 -0
  4. data/VERSION +1 -0
  5. data/lib/klaro/client.rb +41 -0
  6. metadata +117 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fe44df96a08d9b009c290b8d3e50cc31d479762d1d83ec9c6e288ce1f7c3e1eb
4
+ data.tar.gz: '06291eca7e8ff30a8d5e5b88ac0ccf8bb62420eed30e8c75bba8c883d675874e'
5
+ SHA512:
6
+ metadata.gz: 394155c941e99cce11ce9193f8bde47a305d6d8b02b17328a65b0bc106f1c7e014af15f317073da2b5bdd16f983a0add1dcdcbb36af88948a7bae1b9d95ccec0
7
+ data.tar.gz: 8644b0567fe9725216e8a120e99d0e64c77082cc4b00194b4c9bcc80427cfed083913e8c496804fd02fdf07ce2d7db51b98cf15a85e7adc6ef460d93317e243d
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ #
2
+ # Install all tasks found in tasks folder
3
+ #
4
+ # See .rake files there for complete documentation.
5
+ #
6
+ Dir["tasks/*.rake"].each do |taskfile|
7
+ load taskfile
8
+ end
9
+
10
+ # We run tests by default
11
+ task :default => :test
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1
@@ -0,0 +1,41 @@
1
+ require 'http'
2
+ require 'path'
3
+
4
+ module Klaro
5
+ class Client
6
+ attr_reader :request
7
+
8
+ def initialize(base_url)
9
+ @request = RequestHandler.new(base_url)
10
+ end
11
+
12
+ def login(user, password)
13
+ request.authenticate(user, password)
14
+ end
15
+
16
+ def stories(board)
17
+ stories_list = request.get("/api/boards/#{board}/stories/")
18
+ stories_list.map do |s|
19
+ Story.new(request.get("/api/stories/#{s['id']}"))
20
+ end
21
+ end
22
+
23
+ def dimensions(code: nil)
24
+ return request.get('/api/dimensions') unless code
25
+ request.get("/api/dimensions/#{code}")
26
+ end
27
+
28
+ def upload_image(image_path)
29
+ body = {
30
+ form: {
31
+ file: HTTP::FormData::File.new(image_path)
32
+ }
33
+ }
34
+ response = request.post('/s/', body)
35
+ URI(response['location']).request_uri
36
+ end
37
+ end
38
+ end
39
+ require_relative 'client/errors'
40
+ require_relative 'client/request_handler'
41
+ require_relative 'client/resource'
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: klaro-client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - enspirit
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-01-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dotenv
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: http
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '4.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '4.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: path
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.8'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.8'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.7'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.7'
83
+ description:
84
+ email:
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files: []
88
+ files:
89
+ - Gemfile
90
+ - Rakefile
91
+ - VERSION
92
+ - lib/klaro/client.rb
93
+ homepage:
94
+ licenses:
95
+ - MIT
96
+ metadata: {}
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubyforge_project:
113
+ rubygems_version: 2.7.6
114
+ signing_key:
115
+ specification_version: 4
116
+ summary: Klaro Client
117
+ test_files: []