fountain 0.0.6 → 0.0.7

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: b3f653218c512db55d5962968cd24d27ddd397d9
4
- data.tar.gz: 4de91be1284cec1b666cff24fa6f125faf00f272
3
+ metadata.gz: a99befaad758ca023d25977f69894c365f0ef0df
4
+ data.tar.gz: 65affa8bb6929cd6ed9cb239a2ab84abb1231a5e
5
5
  SHA512:
6
- metadata.gz: 134cd04804537aa3e18752ff099491bd99e92391eef01b95c10d9b02856ea7d514eca255cf412ddb9e611dcfd496b1d75513e502610f43cd023ddfa192cf1192
7
- data.tar.gz: f3b60a48988a06d3727e5e292b7a690e1d9430f52c6c8c93d777c2c84d688fc4e2a3a911fc086fa2a1cbfe9c561cec31d9cf6f39e0fa83174e168272d63c8ea2
6
+ metadata.gz: 737b8f67303d80b8343649b926e034b058a50ae1c590c6ed26cebfa6b871aa86c7f01a2813e39dd9ec71318796adfeec26b2c1088a9a59e4cfc29fe86e2f7de1
7
+ data.tar.gz: 28677cf2804ec759ea3b9f14713c235081df80c01a6ace4d6c9e36e9d124fe1f28b7bd92b4c3fbf1e79e1f24c73497c40d352aa47b6618adc9a7d365f59918f9
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
- [![Travis Build Status](http://img.shields.io/travis/Studiosity/fountain-ruby.svg?style=flat)](https://travis-ci.org/Studiosity/fountain-ruby)
1
+ [![Travis Build Status](https://travis-ci.org/Studiosity/fountain-ruby.svg?branch=master)](https://travis-ci.org/Studiosity/fountain-ruby)
2
2
  [![Maintainability](https://api.codeclimate.com/v1/badges/0820e34b69a0dc3a7e8b/maintainability)](https://codeclimate.com/github/Studiosity/fountain-ruby/maintainability)
3
3
  [![Test Coverage](https://api.codeclimate.com/v1/badges/0820e34b69a0dc3a7e8b/test_coverage)](https://codeclimate.com/github/Studiosity/fountain-ruby/test_coverage)
4
- [![Gem Version](http://img.shields.io/gem/v/fountain.svg?style=flat)](#)
4
+ [![Gem Version](https://badge.fury.io/rb/fountain.svg)](https://badge.fury.io/rb/fountain)
5
5
 
6
6
  # Fountain REST API for Ruby
7
7
 
@@ -18,3 +18,54 @@ gem 'fountain'
18
18
  And then execute:
19
19
 
20
20
  $ bundle
21
+
22
+ ## Supported API calls
23
+
24
+ #### Applicant Management
25
+ List, create, delete, get, update applicant etc
26
+
27
+ See https://developer.fountain.com/docs/applicants
28
+
29
+ ## Usage
30
+
31
+ First, initialise the Fountain API token
32
+
33
+ ```ruby
34
+ Fountain.configure do |config|
35
+ config.api_token = 'YOUR-FOUNTAIN-API-TOKEN'
36
+ end
37
+ ```
38
+
39
+ #### List all applicants
40
+ ```ruby
41
+ applicants = Fountain::Api::Applicants.list
42
+ loop do
43
+ break if applicants.count.zero?
44
+ applicants.each do |applicant|
45
+ # Do something with the applicant
46
+ end
47
+ applicants = Fountain::Api::Applicants.list(cursor: applicants.next_cursor)
48
+ end
49
+ ```
50
+
51
+ ## Contributing
52
+
53
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Studiosity/fountain-ruby.
54
+
55
+ Note that spec tests are appreciated to minimise regressions. Before submitting a PR, please ensure that:
56
+
57
+ ```bash
58
+ $ rspec
59
+ ```
60
+
61
+ and
62
+
63
+ ```bash
64
+ $ rubocop
65
+ ```
66
+
67
+ both succeed
68
+
69
+ ## License
70
+
71
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -22,9 +22,11 @@ require 'fountain/background_check'
22
22
  require 'fountain/booked_slot'
23
23
  require 'fountain/document_signature'
24
24
  require 'fountain/funnel'
25
+ require 'fountain/label'
25
26
  require 'fountain/secure_document'
26
27
  require 'fountain/stage'
27
28
  require 'fountain/transition'
28
29
 
29
30
  require 'fountain/api/request_helper'
30
31
  require 'fountain/api/applicants'
32
+ require 'fountain/api/labels'
@@ -1,7 +1,7 @@
1
1
  module Fountain
2
2
  module Api
3
3
  #
4
- # Fountain Applicant API
4
+ # Fountain Applicant Management API
5
5
  #
6
6
  class Applicants
7
7
  extend RequestHelper
@@ -0,0 +1,51 @@
1
+ require 'date'
2
+
3
+ module Fountain
4
+ module Api
5
+ #
6
+ # Fountain Label Management API
7
+ #
8
+ class Labels
9
+ extend RequestHelper
10
+
11
+ #
12
+ # List Labels for an Applicant
13
+ # @param [String] applicant_id ID of the Fountain applicant
14
+ # @return [[Fountain::Label]]
15
+ def self.applicant_labels(applicant_id)
16
+ response = request_json("/v2/applicants/#{applicant_id}/labels")
17
+ response['labels'].map { |hash| Fountain::Label.new hash }
18
+ end
19
+
20
+ #
21
+ # Update Label for an Applicant
22
+ # @param [String] applicant_id ID of the Fountain applicant
23
+ # @param [String] title ID of the Fountain applicant
24
+ # @param [Hash] update_options A hash of options to update applicant labels
25
+ # completed
26
+ # completed_at - Date the label was completed
27
+ # @return [[Fountain::Label]]
28
+ def self.update_applicant_label(applicant_id, title, update_options = {})
29
+ filtered_options = Util.slice_hash(update_options, :completed, :completed_at)
30
+ if filtered_options[:completed_at].is_a? Date
31
+ filtered_options[:completed_at] = filtered_options[:completed_at].strftime('%F')
32
+ end
33
+ response = request_json(
34
+ "/v2/applicants/#{applicant_id}/labels/#{URI.encode(title)}",
35
+ method: :put,
36
+ body: filtered_options
37
+ )
38
+ response['labels'].map { |hash| Fountain::Label.new hash }
39
+ end
40
+
41
+ #
42
+ # List Labels for a Stage
43
+ # @param [String] stage_id ID of the Fountain stage
44
+ # @return [[Fountain::Label]]
45
+ def self.stage_labels(stage_id)
46
+ response = request_json("/v2/stages/#{stage_id}/labels")
47
+ response['labels'].map { |hash| Fountain::Label.new hash }
48
+ end
49
+ end
50
+ end
51
+ end
@@ -1,3 +1,3 @@
1
1
  module Fountain
2
- VERSION = '0.0.6'.freeze
2
+ VERSION = '0.0.7'.freeze
3
3
  end
@@ -0,0 +1,35 @@
1
+ module Fountain
2
+ #
3
+ # Fountain Label
4
+ #
5
+ class Label
6
+ # Raw label data
7
+ attr_reader :raw_data
8
+
9
+ #
10
+ # @param [Hash] data Raw label data
11
+ #
12
+ def initialize(data)
13
+ @raw_data = Util.stringify_hash_keys data
14
+ end
15
+
16
+ # Label title
17
+ def title
18
+ raw_data['title']
19
+ end
20
+
21
+ # Completed
22
+ def completed
23
+ raw_data['completed']
24
+ end
25
+
26
+ def inspect
27
+ format(
28
+ '#<%<class_name>s:0x%<object_id>p @title="%<title>s">',
29
+ class_name: self.class.name,
30
+ object_id: object_id,
31
+ title: title
32
+ )
33
+ end
34
+ end
35
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fountain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - abrom
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-22 00:00:00.000000000 Z
11
+ date: 2018-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -113,6 +113,7 @@ files:
113
113
  - fountain.gemspec
114
114
  - lib/fountain.rb
115
115
  - lib/fountain/api/applicants.rb
116
+ - lib/fountain/api/labels.rb
116
117
  - lib/fountain/api/request_helper.rb
117
118
  - lib/fountain/applicant.rb
118
119
  - lib/fountain/applicants.rb
@@ -122,6 +123,7 @@ files:
122
123
  - lib/fountain/document_signature.rb
123
124
  - lib/fountain/funnel.rb
124
125
  - lib/fountain/gem_version.rb
126
+ - lib/fountain/label.rb
125
127
  - lib/fountain/secure_document.rb
126
128
  - lib/fountain/stage.rb
127
129
  - lib/fountain/transition.rb