fountain 0.0.9 → 0.0.10

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: bf198332a6ca56e05d48ce30225fdf951b026e34
4
- data.tar.gz: 629943449a033d8add4f2b2fc96391d6baa4c796
3
+ metadata.gz: 9fc1e11abfd2cf824c046f9af4669dc45b1bcc00
4
+ data.tar.gz: a016e5e30e7ad3b9f81759b89a52e966ae405286
5
5
  SHA512:
6
- metadata.gz: 1a50953c3662441f109eb03a3041beeb690434a1e2ea855ee5c7314a63c2858d0f1003ac7b31815825b5b9c136daadc6ab06bfb738f275256dccfab70df525cc
7
- data.tar.gz: 7758d4a5042ac0c043e99fef643975ce57b5c4db2b26fbabdab5e5ccd7ace15b1375ddd0517a584553644d4c14ffd9969efced6fa57261777731c4d8c5999336
6
+ metadata.gz: 42d3ecc3c5253c3365a8ae3daf11c2b9f5a0375397e8b7ffc8b473152fdbcba1ff9de103c1795bea9be1ee52ac5cc461e1c49fd741efd96e3d493c3e5fb8355a
7
+ data.tar.gz: e80c35502a1b70e7b78334f565a2fcb9020d6f79b2610d537a84b69dfe6fa2e33fdb83f2026f157a2ea3440ab333f9a615bafb6da727f8cd05af29573a0e7475
@@ -20,8 +20,11 @@ require 'fountain/applicant'
20
20
  require 'fountain/applicants'
21
21
  require 'fountain/background_check'
22
22
  require 'fountain/document_signature'
23
+ require 'fountain/field'
23
24
  require 'fountain/funnel'
25
+ require 'fountain/funnels'
24
26
  require 'fountain/label'
27
+ require 'fountain/location'
25
28
  require 'fountain/note'
26
29
  require 'fountain/secure_document'
27
30
  require 'fountain/slot'
@@ -33,5 +36,6 @@ require 'fountain/user'
33
36
  require 'fountain/api/request_helper'
34
37
  require 'fountain/api/applicants'
35
38
  require 'fountain/api/available_slots'
39
+ require 'fountain/api/funnels'
36
40
  require 'fountain/api/labels'
37
41
  require 'fountain/api/notes'
@@ -0,0 +1,44 @@
1
+ module Fountain
2
+ module Api
3
+ #
4
+ # Fountain Funnel Management API
5
+ #
6
+ class Funnels
7
+ extend RequestHelper
8
+
9
+ #
10
+ # List all Funnels
11
+ # @param [Hash] list_options A hash of options when listing funnels
12
+ # @return [Fountain::Funnels]
13
+ def self.list(list_options = {})
14
+ page_query = list_options[:page] ? "?page=#{list_options[:page]}" : ''
15
+ response = request_json("/v2/funnels#{page_query}")
16
+ Fountain::Funnels.new response
17
+ end
18
+
19
+ #
20
+ # Update Funnel
21
+ # @param [String] funnel_id ID of the Fountain funnel
22
+ # @param [Hash] update_options A hash of options when updating a funnel
23
+ # custom_id
24
+ # @return [Fountain::Funnel]
25
+ def self.update(funnel_id, update_options = {})
26
+ response = request_json(
27
+ "/v2/funnels/#{funnel_id}",
28
+ method: :put,
29
+ body: Util.slice_hash(update_options, :custom_id)
30
+ )
31
+ Fountain::Funnel.new response
32
+ end
33
+
34
+ #
35
+ # List all Funnel stages
36
+ # @param [String] funnel_id ID of the Fountain funnel
37
+ # @return [[Fountain::Stage]]
38
+ def self.list_stages(funnel_id)
39
+ response = request_json("/v2/funnels/#{funnel_id}/stages")
40
+ response['stages'].map { |hash| Fountain::Stage.new hash }
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,41 @@
1
+ module Fountain
2
+ #
3
+ # Fountain Field
4
+ #
5
+ class Field
6
+ # Raw field data
7
+ attr_reader :raw_data
8
+
9
+ #
10
+ # @param [Hash] data Raw field data
11
+ #
12
+ def initialize(data)
13
+ @raw_data = Util.stringify_hash_keys data
14
+ end
15
+
16
+ # Question
17
+ def question
18
+ raw_data['question']
19
+ end
20
+
21
+ # Type
22
+ def type
23
+ raw_data['type']
24
+ end
25
+
26
+ # Key
27
+ def key
28
+ raw_data['key']
29
+ end
30
+
31
+ def inspect
32
+ format(
33
+ '#<%<class_name>s:0x%<object_id>p @type="%<type>s" @question="%<title>s">',
34
+ class_name: self.class.name,
35
+ object_id: object_id,
36
+ type: type,
37
+ question: question
38
+ )
39
+ end
40
+ end
41
+ end
@@ -28,6 +28,54 @@ module Fountain
28
28
  raw_data['custom_id']
29
29
  end
30
30
 
31
+ # Address
32
+ def address
33
+ raw_data['address']
34
+ end
35
+
36
+ # Time zone
37
+ def time_zone
38
+ raw_data['time_zone']
39
+ end
40
+
41
+ # Description
42
+ def description
43
+ raw_data['description']
44
+ end
45
+
46
+ # Requirements
47
+ def requirements
48
+ raw_data['requirements']
49
+ end
50
+
51
+ # Fields
52
+ def fields
53
+ return [] unless raw_data['fields'].is_a? Array
54
+ raw_data['fields'].map { |hash| Field.new hash }
55
+ end
56
+
57
+ # Stages
58
+ def stages
59
+ return [] unless raw_data['stages'].is_a? Array
60
+ raw_data['stages'].map { |hash| Stage.new hash }
61
+ end
62
+
63
+ # Private
64
+ def private?
65
+ raw_data['is_private']
66
+ end
67
+
68
+ # Active
69
+ def active?
70
+ raw_data['active']
71
+ end
72
+
73
+ # Location
74
+ def location
75
+ return unless raw_data['location'].is_a? Hash
76
+ Location.new raw_data['location']
77
+ end
78
+
31
79
  def inspect
32
80
  format(
33
81
  '#<%<class_name>s:0x%<object_id>p @id="%<id>s" @title="%<title>s">',
@@ -0,0 +1,41 @@
1
+ module Fountain
2
+ #
3
+ # Fountain Funnel collection
4
+ #
5
+ class Funnels
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
+ # Funnel collection
15
+ attr_reader :funnels
16
+
17
+ def_delegators :funnels, :each, :map, :count, :size, :[]
18
+
19
+ #
20
+ # @param [Hash] data Raw funnel 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
+ @funnels = raw_data['funnels'].map { |attr| Funnel.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
@@ -1,3 +1,3 @@
1
1
  module Fountain
2
- VERSION = '0.0.9'.freeze
2
+ VERSION = '0.0.10'.freeze
3
3
  end
@@ -0,0 +1,26 @@
1
+ module Fountain
2
+ #
3
+ # Fountain Location
4
+ #
5
+ class Location
6
+ # Raw location data
7
+ attr_reader :raw_data
8
+
9
+ #
10
+ # @param [Hash] data Raw location data
11
+ #
12
+ def initialize(data)
13
+ @raw_data = Util.stringify_hash_keys data
14
+ end
15
+
16
+ # Location ID
17
+ def id
18
+ raw_data['id']
19
+ end
20
+
21
+ # Name
22
+ def name
23
+ raw_data['name']
24
+ end
25
+ end
26
+ end
@@ -44,8 +44,8 @@ module Fountain
44
44
  end
45
45
 
46
46
  # Showed up
47
- def showed_up
48
- raw_data['showed_up'] == 'true'
47
+ def showed_up?
48
+ raw_data['showed_up'].to_s == 'true'
49
49
  end
50
50
 
51
51
  def inspect
@@ -23,6 +23,11 @@ module Fountain
23
23
  raw_data['title']
24
24
  end
25
25
 
26
+ # Type
27
+ def type
28
+ raw_data['type']
29
+ end
30
+
26
31
  def inspect
27
32
  format(
28
33
  '#<%<class_name>s:0x%<object_id>p @id="%<id>s" @title="%<title>s">',
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.9
4
+ version: 0.0.10
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/available_slots.rb
117
+ - lib/fountain/api/funnels.rb
117
118
  - lib/fountain/api/labels.rb
118
119
  - lib/fountain/api/notes.rb
119
120
  - lib/fountain/api/request_helper.rb
@@ -122,9 +123,12 @@ files:
122
123
  - lib/fountain/background_check.rb
123
124
  - lib/fountain/configuration.rb
124
125
  - lib/fountain/document_signature.rb
126
+ - lib/fountain/field.rb
125
127
  - lib/fountain/funnel.rb
128
+ - lib/fountain/funnels.rb
126
129
  - lib/fountain/gem_version.rb
127
130
  - lib/fountain/label.rb
131
+ - lib/fountain/location.rb
128
132
  - lib/fountain/note.rb
129
133
  - lib/fountain/secure_document.rb
130
134
  - lib/fountain/slot.rb