caren-api 0.4.13 → 0.4.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/caren-api.gemspec +1 -1
  3. data/lib/caren/caren.rb +22 -5
  4. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.13
1
+ 0.4.14
data/caren-api.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{caren-api}
8
- s.version = "0.4.13"
8
+ s.version = "0.4.14"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andre Foeken"]
data/lib/caren/caren.rb CHANGED
@@ -26,7 +26,8 @@ module Caren
26
26
  attr_accessor :session
27
27
  end
28
28
 
29
- attr_accessor :url, :caren_public_key, :private_key
29
+ # The user_agent is an optional identifier
30
+ attr_accessor :url, :caren_public_key, :private_key, :user_agent
30
31
 
31
32
  # Initialize new API session. Specify your private key to sign outgoing messages and your care provider url.
32
33
  # Optionally you can pass the caren public key used to verify incoming requests.
@@ -59,7 +60,11 @@ module Caren
59
60
  def put path, xml
60
61
  begin
61
62
  timestamp = DateTime.now.to_i
62
- response = RestClient.put url_for(path), xml, :content_type => :xml, :accept => :xml, :timestamp => timestamp, :signature => sign(timestamp,path,xml)
63
+ response = RestClient.put url_for(path), xml, :content_type => :xml,
64
+ :accept => :xml,
65
+ :timestamp => timestamp,
66
+ :signature => sign(timestamp,path,xml),
67
+ :user_agent => user_agent
63
68
  return check_signature(response)
64
69
  rescue RestClient::Exception => e
65
70
  handle_error(e.response)
@@ -69,7 +74,11 @@ module Caren
69
74
  def post path, xml
70
75
  begin
71
76
  timestamp = DateTime.now.to_i
72
- response = RestClient.post url_for(path), xml, :content_type => :xml, :accept => :xml, :timestamp => timestamp, :signature => sign(timestamp,path,xml)
77
+ response = RestClient.post url_for(path), xml, :content_type => :xml,
78
+ :accept => :xml,
79
+ :timestamp => timestamp,
80
+ :signature => sign(timestamp,path,xml),
81
+ :user_agent => user_agent
73
82
  return check_signature(response)
74
83
  rescue RestClient::Exception => e
75
84
  handle_error(e.response)
@@ -79,7 +88,11 @@ module Caren
79
88
  def delete path
80
89
  begin
81
90
  timestamp = DateTime.now.to_i
82
- response = RestClient.delete url_for(path), :content_type => :xml, :accept => :xml, :timestamp => timestamp, :signature => sign(timestamp,path)
91
+ response = RestClient.delete url_for(path), :content_type => :xml,
92
+ :accept => :xml,
93
+ :timestamp => timestamp,
94
+ :signature => sign(timestamp,path),
95
+ :user_agent => user_agent
83
96
  return check_signature(response)
84
97
  rescue RestClient::Exception => e
85
98
  handle_error(e.response)
@@ -89,7 +102,11 @@ module Caren
89
102
  def get path
90
103
  begin
91
104
  timestamp = DateTime.now.to_i
92
- response = RestClient.get url_for(path), :content_type => :xml, :accept => :xml, :timestamp => timestamp, :signature => sign(timestamp,path)
105
+ response = RestClient.get url_for(path), :content_type => :xml,
106
+ :accept => :xml,
107
+ :timestamp => timestamp,
108
+ :signature => sign(timestamp,path),
109
+ :user_agent => user_agent
93
110
  return check_signature(response)
94
111
  rescue RestClient::Exception => e
95
112
  handle_error(e.response)
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 13
8
+ - 14
9
9
  segments_generated: true
10
- version: 0.4.13
10
+ version: 0.4.14
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andre Foeken