mite-rb 0.5.2 → 0.5.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: 0c042ea5462d2d113e9a76e68b1b321a9e0aa068
4
- data.tar.gz: 13fed82112b7786843e76cbb87ff49f054d1da07
3
+ metadata.gz: 9a364e42b20e1729d93db5dc2afa04031a73d549
4
+ data.tar.gz: 30d8911c095ec2e69a22d7f5fb0ab18a8682a229
5
5
  SHA512:
6
- metadata.gz: b602667276bf13caf6f3ed021edb6c1707bf45e9b5ef75d175db1e41bf1be45f3bbe6b8709bc589a030abb1ce7ae5c43a9ee23b99ae74eb962ee059c1d16ed99
7
- data.tar.gz: 97abae68038f672aab4196282a119e5b3fabd0f196d793dfad60d23b933767d8188dffd725e059ad27562a1c549c72b939149b8e43a66a18fbe51d956524c596
6
+ metadata.gz: 37e4c26fa50f63013dcb87f7e6653ed6dbf9145c530d2bb632e39bc02ab33c7100ef9893394892c0a5f842219c2528bb521d683aae6ee8c08014e7ad5a6ca833
7
+ data.tar.gz: 92a973d1dc86ee42d1ccd878edf6ce18681e0e714e984ec0b783063e659a1f2f10e9ee1f1f761be73ed4ba322acd3356d7ca380b1164d42f4f66a0561e742286
data/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## mite-rb Changelog
2
2
 
3
+ ### 0.5.3 / 2013-11-28
4
+
5
+ * Fixed issue with error format returned from mite
6
+
3
7
  ### 0.5.2 / 2013-11-27
4
8
 
5
9
  * Fixed issue with activeresource 4: always include json root
@@ -1,6 +1,7 @@
1
1
  require 'active_support'
2
2
  require 'active_resource'
3
- require 'mite/version.rb'
3
+ require 'mite/activeresource_patch'
4
+ require 'mite/version'
4
5
 
5
6
  # The official ruby library for interacting with the RESTful API of mite,
6
7
  # a sleek time tracking webapp.
@@ -0,0 +1,24 @@
1
+ require "active_resource/validations"
2
+
3
+ module ActiveResource
4
+ class Errors < ActiveModel::Errors
5
+ def from_json(json, save_cache = false)
6
+ decoded = ActiveSupport::JSON.decode(json) || {} rescue {}
7
+ from_hash decoded, save_cache
8
+ end
9
+
10
+ def from_hash(messages, save_cache = false)
11
+ clear unless save_cache
12
+
13
+ messages.each do |(key,errors)|
14
+ Array(errors).each do |error|
15
+ if key == 'base'
16
+ self[:base] << error
17
+ else
18
+ add key, error
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module Mite
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mite-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Munz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-27 00:00:00.000000000 Z
11
+ date: 2013-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource
@@ -39,6 +39,7 @@ files:
39
39
  - Rakefile
40
40
  - lib/mite-rb.rb
41
41
  - lib/mite/account.rb
42
+ - lib/mite/activeresource_patch.rb
42
43
  - lib/mite/customer.rb
43
44
  - lib/mite/myself.rb
44
45
  - lib/mite/project.rb