fountain 0.0.7 → 0.0.8

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: a99befaad758ca023d25977f69894c365f0ef0df
4
- data.tar.gz: 65affa8bb6929cd6ed9cb239a2ab84abb1231a5e
3
+ metadata.gz: 5e67324d155f205a33d8212314c60bb6827b3834
4
+ data.tar.gz: e722b569b49ba330f50303f5e2b5d3e23d842490
5
5
  SHA512:
6
- metadata.gz: 737b8f67303d80b8343649b926e034b058a50ae1c590c6ed26cebfa6b871aa86c7f01a2813e39dd9ec71318796adfeec26b2c1088a9a59e4cfc29fe86e2f7de1
7
- data.tar.gz: 28677cf2804ec759ea3b9f14713c235081df80c01a6ace4d6c9e36e9d124fe1f28b7bd92b4c3fbf1e79e1f24c73497c40d352aa47b6618adc9a7d365f59918f9
6
+ metadata.gz: aa7d73513652eb15a2d6034894bb2bf4ba3375979eebadf59fe8fc14ef1232e8d0bdb76b5c11c90d4bdb1f263b080e78ffec5b5b9dd4ba33b45dcb978d6ee67c
7
+ data.tar.gz: ae8df6e25988b2a363bc51e352ca0089f89dd6822ca41c0ba3fa175a53cbc0693989da6817c98d9af7c74c1c5cc71d9184e38dbdd423bc0b6186fd724af8da3b
@@ -23,10 +23,13 @@ require 'fountain/booked_slot'
23
23
  require 'fountain/document_signature'
24
24
  require 'fountain/funnel'
25
25
  require 'fountain/label'
26
+ require 'fountain/note'
26
27
  require 'fountain/secure_document'
27
28
  require 'fountain/stage'
28
29
  require 'fountain/transition'
30
+ require 'fountain/user'
29
31
 
30
32
  require 'fountain/api/request_helper'
31
33
  require 'fountain/api/applicants'
32
34
  require 'fountain/api/labels'
35
+ require 'fountain/api/notes'
@@ -1,4 +1,5 @@
1
1
  require 'date'
2
+ require 'cgi'
2
3
 
3
4
  module Fountain
4
5
  module Api
@@ -31,7 +32,7 @@ module Fountain
31
32
  filtered_options[:completed_at] = filtered_options[:completed_at].strftime('%F')
32
33
  end
33
34
  response = request_json(
34
- "/v2/applicants/#{applicant_id}/labels/#{URI.encode(title)}",
35
+ "/v2/applicants/#{applicant_id}/labels/#{CGI.escape(title)}",
35
36
  method: :put,
36
37
  body: filtered_options
37
38
  )
@@ -0,0 +1,62 @@
1
+ module Fountain
2
+ module Api
3
+ #
4
+ # Fountain Note Management API
5
+ #
6
+ class Notes
7
+ extend RequestHelper
8
+
9
+ #
10
+ # List Notes for an Applicant
11
+ # @param [String] applicant_id ID of the Fountain applicant
12
+ # @return [[Fountain::Note]]
13
+ def self.list(applicant_id)
14
+ response = request_json("/v2/applicants/#{applicant_id}/notes")
15
+ response['notes'].map { |hash| Fountain::Note.new hash }
16
+ end
17
+
18
+ #
19
+ # Create a Note for an Applicant
20
+ # @param [String] applicant_id ID of the Fountain applicant
21
+ # @param [String] content Content for the note
22
+ # @return [Fountain::Note]
23
+ def self.create(applicant_id, content)
24
+ response = request_json(
25
+ "/v2/applicants/#{applicant_id}/notes",
26
+ method: :post,
27
+ body: { content: content }
28
+ )
29
+ Fountain::Note.new response
30
+ end
31
+
32
+ #
33
+ # Delete Applicant Note
34
+ # @param [String] applicant_id ID of the Fountain applicant
35
+ # @param [String] note_id ID of the Fountain note
36
+ # @return [Boolean]
37
+ def self.delete(applicant_id, note_id)
38
+ response = request(
39
+ "/v2/applicants/#{applicant_id}/notes/#{note_id}",
40
+ method: :delete
41
+ )
42
+ check_response response
43
+ true
44
+ end
45
+
46
+ #
47
+ # Update Applicant Note
48
+ # @param [String] applicant_id ID of the Fountain applicant
49
+ # @param [String] note_id ID of the Fountain note
50
+ # @param [String] content Content for the note
51
+ # @return [Fountain::Note]
52
+ def self.update(applicant_id, note_id, content)
53
+ response = request_json(
54
+ "/v2/applicants/#{applicant_id}/notes/#{note_id}",
55
+ method: :put,
56
+ body: { content: content }
57
+ )
58
+ Fountain::Note.new response
59
+ end
60
+ end
61
+ end
62
+ end
@@ -1,3 +1,3 @@
1
1
  module Fountain
2
- VERSION = '0.0.7'.freeze
2
+ VERSION = '0.0.8'.freeze
3
3
  end
@@ -0,0 +1,51 @@
1
+ module Fountain
2
+ #
3
+ # Fountain Note
4
+ #
5
+ class Note
6
+ # Raw note data
7
+ attr_reader :raw_data
8
+
9
+ #
10
+ # @param [Hash] data Raw note data
11
+ #
12
+ def initialize(data)
13
+ @raw_data = Util.stringify_hash_keys data
14
+ end
15
+
16
+ # Note ID
17
+ def id
18
+ raw_data['id']
19
+ end
20
+
21
+ # Content
22
+ def content
23
+ raw_data['content']
24
+ end
25
+
26
+ # Created at
27
+ def created_at
28
+ Time.parse raw_data['created_at']
29
+ end
30
+
31
+ # Updated at
32
+ def updated_at
33
+ Time.parse raw_data['updated_at']
34
+ end
35
+
36
+ # User
37
+ def user
38
+ return unless raw_data['user'].is_a? Hash
39
+ User.new raw_data['user']
40
+ end
41
+
42
+ def inspect
43
+ format(
44
+ '#<%<class_name>s:0x%<object_id>p @id="%<id>s">',
45
+ class_name: self.class.name,
46
+ object_id: object_id,
47
+ id: id
48
+ )
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,41 @@
1
+ module Fountain
2
+ #
3
+ # Fountain User
4
+ #
5
+ class User
6
+ # Raw user data
7
+ attr_reader :raw_data
8
+
9
+ #
10
+ # @param [Hash] data Raw user data
11
+ #
12
+ def initialize(data)
13
+ @raw_data = Util.stringify_hash_keys data
14
+ end
15
+
16
+ # User ID
17
+ def id
18
+ raw_data['id']
19
+ end
20
+
21
+ # Name
22
+ def name
23
+ raw_data['name']
24
+ end
25
+
26
+ # Email
27
+ def email
28
+ raw_data['email']
29
+ end
30
+
31
+ def inspect
32
+ format(
33
+ '#<%<class_name>s:0x%<object_id>p @id="%<id>s" @name="%<name>s">',
34
+ class_name: self.class.name,
35
+ object_id: object_id,
36
+ id: id,
37
+ name: name
38
+ )
39
+ end
40
+ end
41
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fountain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - abrom
@@ -114,6 +114,7 @@ files:
114
114
  - lib/fountain.rb
115
115
  - lib/fountain/api/applicants.rb
116
116
  - lib/fountain/api/labels.rb
117
+ - lib/fountain/api/notes.rb
117
118
  - lib/fountain/api/request_helper.rb
118
119
  - lib/fountain/applicant.rb
119
120
  - lib/fountain/applicants.rb
@@ -124,9 +125,11 @@ files:
124
125
  - lib/fountain/funnel.rb
125
126
  - lib/fountain/gem_version.rb
126
127
  - lib/fountain/label.rb
128
+ - lib/fountain/note.rb
127
129
  - lib/fountain/secure_document.rb
128
130
  - lib/fountain/stage.rb
129
131
  - lib/fountain/transition.rb
132
+ - lib/fountain/user.rb
130
133
  - lib/fountain/util.rb
131
134
  homepage: https://github.com/Studiosity/fountain-ruby
132
135
  licenses: