shiftplanning 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/shiftplanning/interface.rb +46 -22
- data/lib/shiftplanning/request/sp_module.rb +12 -6
- metadata +46 -58
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f3f4e2133624d89e4c3237beac4513b86771e4d5
|
4
|
+
data.tar.gz: 9a4e0e7e67a0272a2df6aa58125307eab9a65a4b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2e3185a4f3332c99900a36a3be53f021e704f05ef442fd47789ece707cecb8dc8f47cb35f9dfc9b33234a07735d83188d62457202a6acc247daeaaee3aa9d676
|
7
|
+
data.tar.gz: f52a97146bcdf95b162f5540edebc8013624390d475455ad36b3919d61c92952a2b3aeb36d504e42a82103a5895d37bcf14ce307527a32c5e3702ac51f9e278a
|
@@ -37,6 +37,7 @@ class ShiftPlanning
|
|
37
37
|
def submit *args
|
38
38
|
@requests = []; @responses = []
|
39
39
|
msgs = []
|
40
|
+
resp = []
|
40
41
|
|
41
42
|
args.each{ |_request|
|
42
43
|
_request.params[:module] = _request.module
|
@@ -62,11 +63,13 @@ class ShiftPlanning
|
|
62
63
|
@session[:sp_token] = last_response['token'] if(output == 'json' && @session != nil)
|
63
64
|
self.token = last_response['token'] if output == 'json'
|
64
65
|
self.token = @session[:sp_token] unless @session.nil?
|
66
|
+
|
65
67
|
msgs << response_msg(last_response['status']) if output == 'json'
|
68
|
+
resp << self.last_response
|
66
69
|
end
|
67
70
|
}
|
68
71
|
|
69
|
-
msgs
|
72
|
+
return resp, msgs
|
70
73
|
end
|
71
74
|
|
72
75
|
private
|
@@ -79,27 +82,48 @@ class ShiftPlanning
|
|
79
82
|
#**********************************
|
80
83
|
def response_msg code
|
81
84
|
case code.to_i
|
82
|
-
when -3
|
83
|
-
|
84
|
-
when -
|
85
|
-
|
86
|
-
when
|
87
|
-
|
88
|
-
when
|
89
|
-
|
90
|
-
when
|
91
|
-
|
92
|
-
when
|
93
|
-
|
94
|
-
when
|
95
|
-
|
96
|
-
when
|
97
|
-
|
98
|
-
when
|
99
|
-
|
100
|
-
when
|
101
|
-
|
102
|
-
when
|
85
|
+
when -3
|
86
|
+
'Flagged API Key - Pemanently Banned'
|
87
|
+
when -2
|
88
|
+
'Flagged API Key - Too Many invalid access attempts - contact us'
|
89
|
+
when -1
|
90
|
+
'Flagged API Key - Temporarily Disabled - contact us'
|
91
|
+
when 1
|
92
|
+
'Success -'
|
93
|
+
when 2
|
94
|
+
'Invalid API key - App must be granted a valid key by ShiftPlanning'
|
95
|
+
when 3
|
96
|
+
'Invalid token key - Please re-authenticate'
|
97
|
+
when 4
|
98
|
+
'Invalid Method - No Method with that name exists in our API'
|
99
|
+
when 5
|
100
|
+
'Invalid Module - No Module with that name exists in our API'
|
101
|
+
when 6
|
102
|
+
'Invalid Action - No Action with that name exists in our API'
|
103
|
+
when 7
|
104
|
+
'Authentication Failed - You do not have permissions to access the service'
|
105
|
+
when 8
|
106
|
+
'Missing parameters - Your request is missing a required parameter'
|
107
|
+
when 9
|
108
|
+
'Invalid parameters - Your request has an invalid parameter type'
|
109
|
+
when 10
|
110
|
+
'Extra parameters - Your request has an extra/unallowed parameter type'
|
111
|
+
when 12
|
112
|
+
'Create Failed - Your CREATE request failed'
|
113
|
+
when 13
|
114
|
+
'Update Failed - Your UPDATE request failed'
|
115
|
+
when 14
|
116
|
+
'Delete Failed - Your DELETE request failed'
|
117
|
+
when 20
|
118
|
+
'Incorrect Permissions - You don\'t have the proper permissions to access this'
|
119
|
+
when 90
|
120
|
+
'Suspended API key - Access for your account has been suspended, please contact ShiftPlanning'
|
121
|
+
when 91
|
122
|
+
'Throttle exceeded - You have exceeded the max allowed requests. Try again later.'
|
123
|
+
when 98
|
124
|
+
'Bad API Paramaters - Invalid POST request. See Manual.'
|
125
|
+
when 99
|
126
|
+
'Service Offline - This service is temporarily offline. Try again later.'
|
103
127
|
else
|
104
128
|
'Error code not found'
|
105
129
|
end
|
@@ -36,17 +36,23 @@ class SPModule
|
|
36
36
|
#**********************************
|
37
37
|
def required_params method
|
38
38
|
case method.class.to_s
|
39
|
-
when 'Symbol'
|
40
|
-
|
39
|
+
when 'Symbol'
|
40
|
+
method = method.to_s.upcase.to_sym
|
41
|
+
when 'String'
|
42
|
+
method = method.upcase.to_sym
|
41
43
|
else
|
42
44
|
raise %q('method' should be a String or a Symbol)
|
43
45
|
end
|
44
46
|
|
45
47
|
case method
|
46
|
-
when :GET
|
47
|
-
|
48
|
-
when :
|
49
|
-
|
48
|
+
when :GET
|
49
|
+
@required_params[:GET]||'Unsupported method'
|
50
|
+
when :CREATE
|
51
|
+
@required_params[:CREATE]||'Unsupported method'
|
52
|
+
when :UPDATE
|
53
|
+
@required_params[:UPDATE]||'Unsupported method'
|
54
|
+
when :DELETE
|
55
|
+
@required_params[:DELETE]||'Unsupported method'
|
50
56
|
end
|
51
57
|
end
|
52
58
|
end
|
metadata
CHANGED
@@ -1,86 +1,74 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: shiftplanning
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 2
|
10
|
-
version: 0.0.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- FractalPenguin
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2014-04-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
22
14
|
name: json
|
23
|
-
|
24
|
-
|
25
|
-
none: false
|
26
|
-
requirements:
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
27
17
|
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
33
20
|
type: :runtime
|
34
|
-
|
35
|
-
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: " Copyright (C) 2013 Kyle Richardson\n\n This program is free
|
28
|
+
software; you can redistribute it and/or\n modify it under the terms of the GNU
|
29
|
+
General Public License\n as published by the Free Software Foundation; either
|
30
|
+
version 2\n of the License, or (at your option) any later version.\n \n This
|
31
|
+
program is distributed in the hope that it will be useful,\n but WITHOUT ANY
|
32
|
+
WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR
|
33
|
+
A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n
|
34
|
+
\ \n You should have received a copy of the GNU General Public License\n along
|
35
|
+
with this program; if not, write to the Free Software\n Foundation, Inc., 51
|
36
|
+
Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n"
|
36
37
|
email: kylerchrdsn@gmail.com
|
37
38
|
executables: []
|
38
|
-
|
39
39
|
extensions: []
|
40
|
-
|
41
40
|
extra_rdoc_files: []
|
42
|
-
|
43
|
-
files:
|
41
|
+
files:
|
44
42
|
- lib/example.rb
|
45
43
|
- lib/shiftplanning.rb
|
46
|
-
- lib/shiftplanning/
|
47
|
-
- lib/shiftplanning/interface.rb
|
44
|
+
- lib/shiftplanning/config.rb
|
48
45
|
- lib/shiftplanning/http_error.rb
|
46
|
+
- lib/shiftplanning/interface.rb
|
49
47
|
- lib/shiftplanning/request.rb
|
50
|
-
- lib/shiftplanning/
|
51
|
-
has_rdoc: true
|
48
|
+
- lib/shiftplanning/request/sp_module.rb
|
52
49
|
homepage: https://github.com/Kylerchrdsn/ShiftPlanning-ruby
|
53
|
-
licenses:
|
50
|
+
licenses:
|
54
51
|
- GPL-2
|
52
|
+
metadata: {}
|
55
53
|
post_install_message:
|
56
54
|
rdoc_options: []
|
57
|
-
|
58
|
-
require_paths:
|
55
|
+
require_paths:
|
59
56
|
- lib
|
60
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
-
|
62
|
-
requirements:
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
63
59
|
- - ">="
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
version: "0"
|
69
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
-
none: false
|
71
|
-
requirements:
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
72
64
|
- - ">="
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
|
75
|
-
segments:
|
76
|
-
- 0
|
77
|
-
version: "0"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
78
67
|
requirements: []
|
79
|
-
|
80
68
|
rubyforge_project:
|
81
|
-
rubygems_version:
|
69
|
+
rubygems_version: 2.2.2
|
82
70
|
signing_key:
|
83
|
-
specification_version:
|
84
|
-
summary: Aids in interacting with ShiftPlanning API. Their site has SDKs for Javascript,
|
71
|
+
specification_version: 4
|
72
|
+
summary: Aids in interacting with ShiftPlanning API. Their site has SDKs for Javascript,
|
73
|
+
PHP, C#, ASP.NET, and Python, but not Ruby @.@
|
85
74
|
test_files: []
|
86
|
-
|