sfrest 0.0.13 → 0.0.14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: edf073b0cb0a501406818044613d07af0f2105b2
4
- data.tar.gz: b47e8e4f6d1c59ad1f5bd13eadfa675d032500dc
2
+ SHA256:
3
+ metadata.gz: 08936ab1f2d5f8780cba9b3c74884806896886bd6c26210e3d3f69de44f6f510
4
+ data.tar.gz: 299199ecf27db665e2dacd3300a0a033251baf26a0964852592fb22a24d5dbf9
5
5
  SHA512:
6
- metadata.gz: c2835b20da38d1762f099504dd5e7c97e39ee69d29fa3caddd6f1dccdf62ac0c77499e866af7c266752a15a9df3289d002248415b0886f9576c7f0e986e25312
7
- data.tar.gz: 27c5cb395231d07733a9cb26e1379a0e8a0972de6fd7827be9e6cf2daba76f3d9b4253ddc30226a52b1bb8434bb0e5b5bff7352e856fa78c9d738025d2ffd342
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(URI.encode(pb.build_url_query(current_path, datum))).to_s
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.
@@ -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(audit
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).freeze
181
+ variable].freeze
183
182
 
184
183
  REST_METHODS.each do |m|
185
184
  define_method(m) do
@@ -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
- datum.each do |key, value|
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(URI.encode(pb.build_url_query(current_path, datum))).to_s
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(URI.encode(pb.build_url_query(current_path, datum))).to_s
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
@@ -1,4 +1,4 @@
1
1
  module SFRest
2
2
  # Just tracks the version of sfrest.
3
- VERSION = '0.0.13'.freeze
3
+ VERSION = '0.0.14'.freeze
4
4
  end
data/lib/sfrest.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # Simple wrappper around RestClient.Resource
2
- $LOAD_PATH.unshift(File.dirname(__FILE__)) unless
3
- $LOAD_PATH.include?(File.dirname(__FILE__)) ||
4
- $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
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.select { |k| !k.to_s.match(/time|count/) }
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.13
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.6.13
144
+ rubygems_version: 2.7.4
145
145
  signing_key:
146
146
  specification_version: 4
147
147
  summary: Acquia Site Factory Rest API.