moxiworks_platform 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/moxiworks_platform/group.rb +14 -18
- data/lib/moxiworks_platform/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bebec02a3de5d59b2c1a04647f27519422ba416a
|
4
|
+
data.tar.gz: c322209b3b2819bc2a3a9c21370f1ad38ec8fbee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3737841094f6bbe208ba154dfb615f384e1ef3bae5962525e6eea9f9522732b904376eba83066c5c4f78c8990c9b61f14acec84445bb89bc6db4ab7fdc092280
|
7
|
+
data.tar.gz: 7faa44e1c16345a4099616efe17d51de8f376b6020dbb885e00927bed09cb57c6c5dc2c834d44b13923d637c20c7ccc6aaca789c4fe0cd2fd333ffe969951a94
|
@@ -42,30 +42,14 @@ module MoxiworksPlatform
|
|
42
42
|
# )
|
43
43
|
#
|
44
44
|
def self.find(opts={})
|
45
|
-
required_opts = [:moxi_works_agent_id, :moxi_works_group_name]
|
46
|
-
required_opts.each do |opt|
|
47
|
-
raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
|
48
|
-
opts[opt].nil? or opts[opt].empty?
|
49
|
-
end
|
50
45
|
url = "#{MoxiworksPlatform::Config.url}/api/groups/#{opts[:moxi_works_group_name]}"
|
51
|
-
|
52
|
-
RestClient::Request.execute(method: :get,
|
53
|
-
url: url,
|
54
|
-
payload: opts, headers: self.headers) do |response|
|
55
|
-
puts response if MoxiworksPlatform::Config.debug
|
56
|
-
self.check_for_error_in_response(response)
|
57
|
-
json = JSON.parse(response)
|
58
|
-
return false if not json['status'].nil? and json['status'] =='fail'
|
59
|
-
group = MoxiworksPlatform::Group.new(json) unless json.nil? or json.empty?
|
60
|
-
end
|
61
|
-
group
|
46
|
+
self.send_request(:get, opts, url)
|
62
47
|
end
|
63
48
|
|
64
|
-
|
65
49
|
# Search an Agent's Groups in Moxi Works Platform
|
66
50
|
# @param [Hash] opts named parameter Hash
|
67
51
|
# @option opts [String] :moxi_works_agent_id *REQUIRED* The Moxi Works Agent ID for the agent to which this event is associated
|
68
|
-
# @option opts [String] :
|
52
|
+
# @option opts [String] :name optional name to search for. If no name is provided, all of the Agent's Groups will be returned
|
69
53
|
#
|
70
54
|
# @return [Array] containing MoxiworksPlatform::Group objects formatted as follows:
|
71
55
|
#
|
@@ -109,5 +93,17 @@ module MoxiworksPlatform
|
|
109
93
|
end
|
110
94
|
new_contacts
|
111
95
|
end
|
96
|
+
|
97
|
+
protected
|
98
|
+
def self.send_request(method, opts={}, url=nil)
|
99
|
+
url ||= "#{MoxiworksPlatform::Config.url}/api/agents"
|
100
|
+
required_opts = [:moxi_works_agent_id]
|
101
|
+
required_opts.each do |opt|
|
102
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
|
103
|
+
opts[opt].nil? or opts[opt].empty?
|
104
|
+
end
|
105
|
+
super(method, opts, url)
|
106
|
+
end
|
107
|
+
|
112
108
|
end
|
113
109
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moxiworks_platform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tres Wong-Godfrey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|