pseng_ekg_client 0.1.5 → 0.1.6

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: 3d799737cc28e125d8cf47b5809003097eee889c
4
- data.tar.gz: 5506a269b773ec3de32753a89a6cdcabbc590562
3
+ metadata.gz: d9ae09a3e58a486de47ee190cd73b23a589537f4
4
+ data.tar.gz: a1417ecb611a7ee8093ac99656b9b721e2134080
5
5
  SHA512:
6
- metadata.gz: 22060391b6f30576d8681917aef1432dc4099c2e914e4c3a3783b94da1e29ff8d90d91fdcb8624479f059b59f2199195c4ff95bcabb9452e828a630ab7182002
7
- data.tar.gz: da4735fa53eac9f22aba8995e4cbaf1ba56cbd906a98b555ecb1e18226ec8e1dc315462f0153cce45498d1f5216043742bf256a8c75311cf871d8976420f0ea7
6
+ metadata.gz: 57a39e750f5be447169956b56da141a87d7859ac42f85ae1345770fc6b391bd92123b9bc6b9d4576a1344b8c3c7e400227ccaa9c44bd69ee1b9af2a89d7dfe37
7
+ data.tar.gz: 28c1d1c68b031e7bf669976852da00ceeae6d8a3338b0f2b8ed6f1588313a1884830dd1a9f6b8a57fa93489c0b94220dd3d550a0273e5b9e30b9bfb8777d7ce4
@@ -3,29 +3,34 @@ require 'httparty'
3
3
 
4
4
  module PsengEkgClient
5
5
  class Api
6
- include Httparty
6
+ include HTTParty
7
7
  VALID_ACTIONS = %w(index show create update destroy)
8
8
  VALID_RECORD_TYPES = %w(application task)
9
9
 
10
10
  def initialize(base_uri)
11
- self.class.send(:base_uri, base_uri)
11
+ self.class.base_uri base_uri
12
12
  end
13
13
 
14
14
  def send_message(record_type, action, payload)
15
15
  raise 'Invalid Action' unless VALID_ACTIONS.include?(action)
16
- raise 'Invalid Record Type' unless VALID_RECORD_TYPES.include?(action)
16
+ raise 'Invalid Record Type' unless VALID_RECORD_TYPES.include?(record_type)
17
+
18
+ options = {
19
+ body: payload.to_json,
20
+ headers: { 'Content-Type' => 'application/json' }
21
+ }
17
22
 
18
23
  case action
19
24
  when 'index'
20
- self.class.get("/#{record_type}s.json", payload)
25
+ self.class.get("/#{record_type}s.json", options)
21
26
  when 'show'
22
- self.class.get("/#{record_type}s/#{payload.id}.json", payload)
27
+ self.class.get("/#{record_type}s/#{payload.id}.json", options)
23
28
  when 'create'
24
- self.class.post("/#{record_type}s.json", payload)
29
+ self.class.post("/#{record_type}s.json", options)
25
30
  when 'update'
26
- self.class.patch("/#{record_type}s/#{payload.id}.json", payload)
31
+ self.class.patch("/#{record_type}s/#{payload.id}.json", options)
27
32
  when 'destroy'
28
- self.class.delete("/#{record_type}s/#{payload.id}.json", payload)
33
+ self.class.delete("/#{record_type}s/#{payload.id}.json", options)
29
34
  end
30
35
  end
31
36
  end
@@ -1,3 +1,3 @@
1
1
  module PsengEkgClient
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pseng_ekg_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Tanner