sfrest 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/sfrest/backup.rb +1 -1
- data/lib/sfrest/connection.rb +2 -3
- data/lib/sfrest/pathbuilder.rb +1 -8
- data/lib/sfrest/task.rb +1 -1
- data/lib/sfrest/usage.rb +1 -1
- data/lib/sfrest/version.rb +1 -1
- data/lib/sfrest.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 08936ab1f2d5f8780cba9b3c74884806896886bd6c26210e3d3f69de44f6f510
|
4
|
+
data.tar.gz: 299199ecf27db665e2dacd3300a0a033251baf26a0964852592fb22a24d5dbf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f76a2ec444911abdaa7c0eaac3d3c2797822f6e79c9b75096d7d7565ddd27151e3be0907779b78f1fc27fe3f0428dd48342f77aa690fbd2deb79cf064003494c
|
7
|
+
data.tar.gz: 5283104b05712b69a454d5a5b5c8e181b90f4168c53c8ce35a436283d61d9fd2b1e2dd35c9ad1e00f1493b90be5f414f57294d5d49573d08c7a89314e4348f3b
|
data/lib/sfrest/backup.rb
CHANGED
@@ -12,7 +12,7 @@ module SFRest
|
|
12
12
|
def get_backups(site_id, datum = nil)
|
13
13
|
current_path = "/api/v1/sites/#{site_id}/backups"
|
14
14
|
pb = SFRest::Pathbuilder.new
|
15
|
-
@conn.get URI.parse(
|
15
|
+
@conn.get URI.parse(pb.build_url_query(current_path, datum)).to_s
|
16
16
|
end
|
17
17
|
|
18
18
|
# Deletes a site backup.
|
data/lib/sfrest/connection.rb
CHANGED
@@ -47,7 +47,6 @@ module SFRest
|
|
47
47
|
begin
|
48
48
|
data = access_check JSON(res.body), res.status
|
49
49
|
return res.status, data
|
50
|
-
|
51
50
|
rescue JSON::ParserError
|
52
51
|
return res.status, res.body
|
53
52
|
end
|
@@ -164,7 +163,7 @@ module SFRest
|
|
164
163
|
#
|
165
164
|
# If a new class is added, add the accessor to this list.
|
166
165
|
# NOTE: accessor == Class_name.to_lower
|
167
|
-
REST_METHODS = %w
|
166
|
+
REST_METHODS = %w[audit
|
168
167
|
backup
|
169
168
|
codebase
|
170
169
|
collection
|
@@ -179,7 +178,7 @@ module SFRest
|
|
179
178
|
update
|
180
179
|
usage
|
181
180
|
user
|
182
|
-
variable
|
181
|
+
variable].freeze
|
183
182
|
|
184
183
|
REST_METHODS.each do |m|
|
185
184
|
define_method(m) do
|
data/lib/sfrest/pathbuilder.rb
CHANGED
@@ -9,16 +9,9 @@ module SFRest
|
|
9
9
|
def build_url_query(current_path, datum = nil)
|
10
10
|
unless datum.nil?
|
11
11
|
current_path += '?'
|
12
|
-
|
13
|
-
current_path += '&' if needs_new_parameter? current_path
|
14
|
-
current_path += key.to_s + '=' + value.to_s
|
15
|
-
end
|
12
|
+
current_path += URI.encode_www_form datum
|
16
13
|
end
|
17
14
|
current_path
|
18
15
|
end
|
19
|
-
|
20
|
-
private def needs_new_parameter?(path)
|
21
|
-
path[-1, 1] != '?' # if path has '?' then we need to create a new parameter
|
22
|
-
end
|
23
16
|
end
|
24
17
|
end
|
data/lib/sfrest/task.rb
CHANGED
@@ -146,7 +146,7 @@ module SFRest
|
|
146
146
|
def find_tasks(datum = nil)
|
147
147
|
current_path = '/api/v1/tasks'
|
148
148
|
pb = SFRest::Pathbuilder.new
|
149
|
-
@conn.get URI.parse(
|
149
|
+
@conn.get URI.parse(pb.build_url_query(current_path, datum)).to_s
|
150
150
|
end
|
151
151
|
|
152
152
|
# Looks for a task with a specific name
|
data/lib/sfrest/usage.rb
CHANGED
@@ -38,7 +38,7 @@ module SFRest
|
|
38
38
|
def monthly(stack_id = 1, datum = {})
|
39
39
|
datum[stack_id] = stack_id
|
40
40
|
current_path = '/api/v1/dynamic-requests/monthly'
|
41
|
-
@conn.get URI.parse(
|
41
|
+
@conn.get URI.parse(pb.build_url_query(current_path, datum)).to_s
|
42
42
|
end
|
43
43
|
|
44
44
|
# returns a Pathbuilder object for manipulating the query parameters
|
data/lib/sfrest/version.rb
CHANGED
data/lib/sfrest.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Simple wrappper around RestClient.Resource
|
2
|
-
$LOAD_PATH.unshift(
|
3
|
-
$LOAD_PATH.include?(
|
4
|
-
$LOAD_PATH.include?(File.expand_path(
|
2
|
+
$LOAD_PATH.unshift(__dir__) unless
|
3
|
+
$LOAD_PATH.include?(__dir__) ||
|
4
|
+
$LOAD_PATH.include?(File.expand_path(__dir__))
|
5
5
|
|
6
6
|
require 'excon'
|
7
7
|
require 'json'
|
@@ -52,7 +52,7 @@ module SFRest
|
|
52
52
|
# @param [String] key one of the user data returned (id, name, domain...)
|
53
53
|
# @return [Object] Integer, String, Array, Hash depending on the collection data
|
54
54
|
def self.find_data_from_results(res, field, datapat, key)
|
55
|
-
data = res.
|
55
|
+
data = res.reject { |k| k.to_s.match(/time|count/) }
|
56
56
|
raise InvalidDataError('The data you are searching is not a hash') unless data.is_a?(Hash)
|
57
57
|
data.each_value do |datum|
|
58
58
|
datum.each do |dat|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sfrest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ACSF Engineering
|
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
version: '0'
|
142
142
|
requirements: []
|
143
143
|
rubyforge_project:
|
144
|
-
rubygems_version: 2.
|
144
|
+
rubygems_version: 2.7.4
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: Acquia Site Factory Rest API.
|