fountain 0.0.8 → 0.0.9

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: 5e67324d155f205a33d8212314c60bb6827b3834
4
- data.tar.gz: e722b569b49ba330f50303f5e2b5d3e23d842490
3
+ metadata.gz: bf198332a6ca56e05d48ce30225fdf951b026e34
4
+ data.tar.gz: 629943449a033d8add4f2b2fc96391d6baa4c796
5
5
  SHA512:
6
- metadata.gz: aa7d73513652eb15a2d6034894bb2bf4ba3375979eebadf59fe8fc14ef1232e8d0bdb76b5c11c90d4bdb1f263b080e78ffec5b5b9dd4ba33b45dcb978d6ee67c
7
- data.tar.gz: ae8df6e25988b2a363bc51e352ca0089f89dd6822ca41c0ba3fa175a53cbc0693989da6817c98d9af7c74c1c5cc71d9184e38dbdd423bc0b6186fd724af8da3b
6
+ metadata.gz: 1a50953c3662441f109eb03a3041beeb690434a1e2ea855ee5c7314a63c2858d0f1003ac7b31815825b5b9c136daadc6ab06bfb738f275256dccfab70df525cc
7
+ data.tar.gz: 7758d4a5042ac0c043e99fef643975ce57b5c4db2b26fbabdab5e5ccd7ace15b1375ddd0517a584553644d4c14ffd9969efced6fa57261777731c4d8c5999336
@@ -19,17 +19,19 @@ end
19
19
  require 'fountain/applicant'
20
20
  require 'fountain/applicants'
21
21
  require 'fountain/background_check'
22
- require 'fountain/booked_slot'
23
22
  require 'fountain/document_signature'
24
23
  require 'fountain/funnel'
25
24
  require 'fountain/label'
26
25
  require 'fountain/note'
27
26
  require 'fountain/secure_document'
27
+ require 'fountain/slot'
28
+ require 'fountain/slots'
28
29
  require 'fountain/stage'
29
30
  require 'fountain/transition'
30
31
  require 'fountain/user'
31
32
 
32
33
  require 'fountain/api/request_helper'
33
34
  require 'fountain/api/applicants'
35
+ require 'fountain/api/available_slots'
34
36
  require 'fountain/api/labels'
35
37
  require 'fountain/api/notes'
@@ -137,10 +137,10 @@ module Fountain
137
137
  #
138
138
  # Get Interview Sessions
139
139
  # @param [String] applicant_id ID of the Fountain applicant
140
- # @return [[Fountain::BookedSlot]]
140
+ # @return [[Fountain::Slot]]
141
141
  def self.get_interview_sessions(applicant_id)
142
142
  response = request_json("/v2/applicants/#{applicant_id}/booked_slots")
143
- response['booked_slots'].map { |hash| Fountain::BookedSlot.new hash }
143
+ response['booked_slots'].map { |hash| Fountain::Slot.new hash }
144
144
  end
145
145
 
146
146
  #
@@ -0,0 +1,50 @@
1
+ module Fountain
2
+ module Api
3
+ #
4
+ # Fountain Slot Management API
5
+ #
6
+ class AvailableSlots
7
+ extend RequestHelper
8
+
9
+ #
10
+ # Confirm an available slot
11
+ # @param [String] available_slot_id ID of the Fountain slot
12
+ # @param [String] applicant_id ID of the Fountain applicant
13
+ # @return [Fountain::Slot]
14
+ def self.confirm(available_slot_id, applicant_id)
15
+ response = request_json(
16
+ "/v2/available_slots/#{available_slot_id}/confirm",
17
+ method: :post,
18
+ body: { applicant_id: applicant_id }
19
+ )
20
+ Fountain::Slot.new response
21
+ end
22
+
23
+ #
24
+ # List Available Slots
25
+ # @param [String] stage_id ID of the Fountain stage
26
+ # @return [[Fountain::Slots]]
27
+ def self.list(stage_id, list_options = {})
28
+ page_query = list_options[:page] ? "?page=#{list_options[:page]}" : ''
29
+ response = request_json(
30
+ "/v2/stages/#{stage_id}/available_slots#{page_query}"
31
+ )
32
+ Fountain::Slots.new response
33
+ end
34
+
35
+ #
36
+ # Cancel a booked session
37
+ # @param [String] booked_slot_id ID of the Fountain slot
38
+ # @param [String] applicant_id ID of the Fountain applicant
39
+ # @return [Fountain::Slot]
40
+ def self.cancel(booked_slot_id)
41
+ response = request(
42
+ "/v2/booked_slots/#{booked_slot_id}/cancel",
43
+ method: :post
44
+ )
45
+ check_response response
46
+ true
47
+ end
48
+ end
49
+ end
50
+ end
@@ -1,3 +1,3 @@
1
1
  module Fountain
2
- VERSION = '0.0.8'.freeze
2
+ VERSION = '0.0.9'.freeze
3
3
  end
@@ -1,19 +1,19 @@
1
1
  module Fountain
2
2
  #
3
- # Fountain Booked Slot
3
+ # Fountain Slot
4
4
  #
5
- class BookedSlot
6
- # Raw booked slot data
5
+ class Slot
6
+ # Raw slot data
7
7
  attr_reader :raw_data
8
8
 
9
9
  #
10
- # @param [Hash] data Raw booked slot data
10
+ # @param [Hash] data Raw slot data
11
11
  #
12
12
  def initialize(data)
13
13
  @raw_data = Util.stringify_hash_keys data
14
14
  end
15
15
 
16
- # Booked slot ID
16
+ # Slot ID
17
17
  def id
18
18
  raw_data['id']
19
19
  end
@@ -0,0 +1,41 @@
1
+ module Fountain
2
+ #
3
+ # Fountain Slot collection
4
+ #
5
+ class Slots
6
+ extend Forwardable
7
+
8
+ # Collection current page
9
+ attr_reader :current_page
10
+
11
+ # Collection last page
12
+ attr_reader :last_page
13
+
14
+ # Slot collection
15
+ attr_reader :slots
16
+
17
+ def_delegators :slots, :each, :map, :count, :size, :[]
18
+
19
+ #
20
+ # @param [Hash] data Raw slot data
21
+ #
22
+ def initialize(data)
23
+ raw_data = Util.stringify_hash_keys data
24
+ pagination = raw_data['pagination']
25
+ if pagination.is_a? Hash
26
+ @current_page = pagination['current']
27
+ @last_page = pagination['last']
28
+ end
29
+ @slots = raw_data['slots'].map { |attr| Slot.new attr }
30
+ end
31
+
32
+ def inspect
33
+ format(
34
+ '#<%<class_name>s:0x%<object_id>p @count="%<count>s">',
35
+ class_name: self.class.name,
36
+ object_id: object_id,
37
+ count: count
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.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - abrom
@@ -113,13 +113,13 @@ files:
113
113
  - fountain.gemspec
114
114
  - lib/fountain.rb
115
115
  - lib/fountain/api/applicants.rb
116
+ - lib/fountain/api/available_slots.rb
116
117
  - lib/fountain/api/labels.rb
117
118
  - lib/fountain/api/notes.rb
118
119
  - lib/fountain/api/request_helper.rb
119
120
  - lib/fountain/applicant.rb
120
121
  - lib/fountain/applicants.rb
121
122
  - lib/fountain/background_check.rb
122
- - lib/fountain/booked_slot.rb
123
123
  - lib/fountain/configuration.rb
124
124
  - lib/fountain/document_signature.rb
125
125
  - lib/fountain/funnel.rb
@@ -127,6 +127,8 @@ files:
127
127
  - lib/fountain/label.rb
128
128
  - lib/fountain/note.rb
129
129
  - lib/fountain/secure_document.rb
130
+ - lib/fountain/slot.rb
131
+ - lib/fountain/slots.rb
130
132
  - lib/fountain/stage.rb
131
133
  - lib/fountain/transition.rb
132
134
  - lib/fountain/user.rb