moxiworks_platform 0.4.0 → 0.4.1

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
2
  SHA1:
3
- metadata.gz: 42c31e2e96f745d28cce316626e3952b28fa05ac
4
- data.tar.gz: 86041d7a7ad42aec57dae357c05a8206f6eaeddd
3
+ metadata.gz: bebec02a3de5d59b2c1a04647f27519422ba416a
4
+ data.tar.gz: c322209b3b2819bc2a3a9c21370f1ad38ec8fbee
5
5
  SHA512:
6
- metadata.gz: a0175f05701d31299c62a6cf340440890547955e00254cf738667e797a1cf52fa259aea4128dca404b823b6d475fcd7b7d68dd08c45fd5ce23863dad2369d776
7
- data.tar.gz: c3312668276b3cf23fa639aa6f773a891bfdf5508f6c9195c1dbebeb155c9e218388b954e99fcb007f14d6bfb45bab0a930c5c0406476471f077f677afa394a2
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
- group = nil
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] :moxi_works_group_name optional name to search for. If no name is provided, all of the Agent's Groups will be returned
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
@@ -1,3 +1,3 @@
1
1
  module MoxiworksPlatform
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  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.0
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-25 00:00:00.000000000 Z
11
+ date: 2016-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler