servicenow 1.1.2 → 1.1.3

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: 50811eaebda4b3293c39dbca68a12552c79c1413
4
- data.tar.gz: 7266d98a79d7c30d907b4fea252dd2b512ea2a3b
3
+ metadata.gz: 18c4645dd46a4043144d7f0f95a6283be65ad32f
4
+ data.tar.gz: cecb08079b14e3c1679d5cdf59c2ccbc944fd12c
5
5
  SHA512:
6
- metadata.gz: b0da2932d8df63756bcf537956c036be0990d20eaef69a220421111d80282be0065ea72f1ad5ad3014f55f937221fc548bbb78d16a74a1d2e974f59e632c68e6
7
- data.tar.gz: 66c93a9908078e34bf9e79a89f7c4a2a193250dc98769adf349c4b13b0e605bfb0b6e7597ad6b35551b7d10eb28af970a6404277c26c1923dd7d68f7e433a35d
6
+ metadata.gz: 6ad4abf79e426b25f34aad75c3fa39be3148ba1a8d98951c292690013d497a419820685af52eeca1fab190475d5b8a559d371d0cbecc2bb1728de6c84895401f
7
+ data.tar.gz: 57bd61e2b229770c7f354c38c767d362f9d5ec4cf807c08bc5cf4491a408e4c8f168d7ae19ec1836693130dc31e8d7e86021f9b14dba136b3ec5f6130ea7ff40
@@ -1,3 +1,9 @@
1
+ ## 1.1.3
2
+
3
+ * @maxy removed unused variable assignments
4
+ * fixed readme and code climate integration
5
+ * fixed additional rubocop offenses
6
+
1
7
  ## 1.1.2
2
8
 
3
9
  * fixed Rake test invocation, thanks @maxy
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # servicenow [![Build Status](https://travis-ci.org/rubyisbeautiful/servicenow.png)](https://travis-ci.org/rubyisbeautiful/servicenow)[![Code Climate](ht tps://codeclimate.com/github/rubyisbeautiful/servicenow.png)](https://codeclimate.com/github/rubyisbeautiful/servicenow)
1
+ # servicenow [![Build Status](https://travis-ci.org/rubyisbeautiful/servicenow.png)](https://travis-ci.org/rubyisbeautiful/servicenow)[![Code Climate](https://codeclimate.com/github/rubyisbeautiful/servicenow.png)](https://codeclimate.com/github/rubyisbeautiful/servicenow)
2
2
  This is a very simple, WIP REST API Client for ServiceNow.
3
3
 
4
4
 
data/Rakefile CHANGED
@@ -7,4 +7,4 @@ Rake::TestTask.new(:test) do |t|
7
7
  t.test_files = FileList['test/**/test_*.rb']
8
8
  end
9
9
 
10
- task :default => :test
10
+ task default: :test
@@ -2,6 +2,9 @@ require 'servicenow/version'
2
2
  require 'servicenow/client'
3
3
  require 'servicenow/change'
4
4
 
5
+ # This module is the base for the ServiceNow gem. It's primary
6
+ # interface consists of the 'configure', 'configuration'
7
+ # and 'logger' methods
5
8
  module Servicenow
6
9
 
7
10
  @logger = nil
@@ -20,18 +23,14 @@ module Servicenow
20
23
  #
21
24
  # @yieldparam config [Servicenow::Configuration]
22
25
  def self.configure(&block)
23
- if @configuration.nil?
24
- @configuration = OpenStruct.new({})
25
- end
26
+ @configuration = OpenStruct.new({}) if @configuration.nil?
26
27
  yield @configuration
27
28
  end
28
29
 
29
30
 
30
31
  # @return [Servicenow::Configuration]
31
32
  def self.configuration
32
- if @configuration.nil?
33
- @configuration = OpenStruct.new({})
34
- end
33
+ @configuration = OpenStruct.new({}) if @configuration.nil?
35
34
  @configuration
36
35
  end
37
36
 
@@ -48,9 +47,7 @@ module Servicenow
48
47
  #
49
48
  # @return [Logger] the module logger
50
49
  def self.logger
51
- if @logger.nil?
52
- @logger = Logger.new(STDOUT)
53
- end
50
+ @logger = Logger.new(STDOUT) if @logger.nil?
54
51
  @logger
55
52
  end
56
53
 
@@ -2,6 +2,9 @@ require 'ostruct'
2
2
 
3
3
  module Servicenow
4
4
 
5
+ # This class represents a ServiceNow Change. A Change is a local
6
+ # representation of the state of the remote. For writing operations, the
7
+ # local is updated, and then a request to update the remote is sent
5
8
  class Change < OpenStruct
6
9
 
7
10
  @_client = nil
@@ -16,7 +19,7 @@ module Servicenow
16
19
  work_notes: notes
17
20
  }
18
21
 
19
- response = client.send_request(url, query, :patch)
22
+ client.send_request(url, query, :patch)
20
23
  change
21
24
  end
22
25
 
@@ -33,7 +36,7 @@ module Servicenow
33
36
  work_start: Time.now.utc
34
37
  }.merge(extra)
35
38
 
36
- response = client.send_request(url, query, :patch)
39
+ client.send_request(url, query, :patch)
37
40
  change
38
41
  end
39
42
 
@@ -50,7 +53,7 @@ module Servicenow
50
53
  work_end: Time.now.utc
51
54
  }.merge(extra)
52
55
 
53
- response = client.send_request(url, query, :patch)
56
+ client.send_request(url, query, :patch)
54
57
  change
55
58
  end
56
59
 
@@ -70,9 +73,7 @@ module Servicenow
70
73
 
71
74
 
72
75
  def client
73
- if @_client.nil?
74
- @_client = Servicenow::Client.new
75
- end
76
+ @_client = Servicenow::Client.new if @_client.nil?
76
77
  @_client
77
78
  end
78
79
 
@@ -83,7 +84,7 @@ module Servicenow
83
84
  'work in progress' => 2,
84
85
  'work complete' => 11,
85
86
  'work incomplete' => 4,
86
- 'waiting on user' => -5,
87
+ 'waiting on user' => -5
87
88
  }
88
89
  end
89
90
 
@@ -4,6 +4,7 @@ require 'json'
4
4
 
5
5
  module Servicenow
6
6
 
7
+ # Client is the client to interact with the ServiceNow REST API
7
8
  class Client
8
9
 
9
10
  attr_reader :snow_api_base_url, :snow_table_url
@@ -42,8 +43,8 @@ module Servicenow
42
43
  def get_changes_by_user(user_id)
43
44
  url = format('%s/change_request', @snow_table_url)
44
45
  query = {
45
- sysparm_limit: 10,
46
- sysparm_query: "active=true^GOTOu_cr_requester.u_name_idLIKE#{user_id}"
46
+ sysparm_limit: 10,
47
+ sysparm_query: "active=true^GOTOu_cr_requester.u_name_idLIKE#{user_id}"
47
48
  }
48
49
 
49
50
  response = send_request(url, query)
@@ -61,9 +62,9 @@ module Servicenow
61
62
  def get_changes_by_query(encodedquery, limit=10, page=1)
62
63
  url = format('%s/change_request', @snow_table_url)
63
64
  query = {
64
- sysparm_limit: limit,
65
- sysparm_page: page,
66
- sysparm_query: encodedquery
65
+ sysparm_limit: limit,
66
+ sysparm_page: page,
67
+ sysparm_query: encodedquery
67
68
  }
68
69
 
69
70
  response = send_request(url, query)
@@ -80,8 +81,8 @@ module Servicenow
80
81
  def get_change(number)
81
82
  url = format('%s/change_request', @snow_table_url)
82
83
  query = {
83
- sysparm_limit: 1,
84
- number: number
84
+ sysparm_limit: 1,
85
+ number: number
85
86
  }
86
87
 
87
88
  response = send_request(url, query)
@@ -1,3 +1,3 @@
1
1
  module Servicenow
2
- VERSION = '1.1.2'
2
+ VERSION = '1.1.3'.freeze
3
3
  end
@@ -1,5 +1,4 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
 
5
4
  require 'base64'
@@ -11,8 +10,8 @@ Gem::Specification.new do |spec|
11
10
  spec.authors = ['rubyisbeautiful']
12
11
  spec.email = ['YmNwdGF5bG9yQGdtYWlsLmNvbQ==\n'].collect{ |foo| Base64.decode64(foo) }
13
12
 
14
- spec.summary = %q{Simple WIP REST API client for ServiceNow}
15
- spec.description = %q{This REST API client for ServiceNow is a work in progress}
13
+ spec.summary = 'Simple WIP REST API client for ServiceNow'
14
+ spec.description = 'This REST API client for ServiceNow is a work in progress'
16
15
  spec.homepage = 'https://github.com/rubyisbeautiful/servicenow'
17
16
  spec.license = 'MIT'
18
17
 
@@ -25,7 +24,7 @@ Gem::Specification.new do |spec|
25
24
  'public gem pushes.'
26
25
  end
27
26
 
28
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
29
28
  f.match(%r{^(test|spec|features)/})
30
29
  end
31
30
  spec.bindir = 'exe'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: servicenow
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - rubyisbeautiful