mite-rb 0.4.5 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -4,4 +4,5 @@ doc
4
4
  .DS_Store
5
5
  debug.rb
6
6
  Gemfile.lock
7
- .rvmrc
7
+ .rvmrc
8
+ .rbenv-*
data/CHANGES.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## mite-rb Changelog
2
2
 
3
+ ### 0.5.0 / 2012-12-11
4
+
5
+ * Fixed Mite::Tracker for activeresource >= 3.1.0 [#9]
6
+ * From now on only support activeresource >= 3.1.0
7
+
3
8
  ### 0.4.5 / 2012-11-28
4
9
 
5
10
  * Fixed support for activesupport > 3.0.9 [#4]
data/README.md CHANGED
@@ -5,10 +5,10 @@ The official ruby library for interacting with the [RESTful API](http://mite.yo.
5
5
  ## Install
6
6
 
7
7
  Install the lib as a ruby gem:
8
-
8
+
9
9
  gem install mite-rb
10
10
 
11
- mite-rb requires activeresource and activesupport in version 2.3.14 or above.
11
+ mite-rb requires activeresource and activesupport in version 3.1 or above. If you want/need to use it with activeresource 2.3.14 to 3.0.9 please use mite-rb 0.4.5.
12
12
 
13
13
  ## Documentation
14
14
 
@@ -23,11 +23,11 @@ The first thing you need to set is the account name. This is the same as the we
23
23
  Mite.account = 'demo'
24
24
 
25
25
  Then, you should set the authentication. You can either use your mite.api key (recommended) or your login credentials (email and password).
26
-
26
+
27
27
  Mite.key = 'cdfeasdaabcdefgssaeabcdefg'
28
-
28
+
29
29
  or
30
-
30
+
31
31
  Mite.authenticate('rick@techno-weenie.net', 'spacemonkey')
32
32
 
33
33
  ### User-Agent
@@ -45,13 +45,13 @@ You can combine your custom string with the default one:
45
45
  You can validate the connection/authentication with
46
46
 
47
47
  Mite.validate
48
-
48
+
49
49
  This will return true when the connection is valid and false if not.
50
50
 
51
51
  Use
52
52
 
53
53
  Mite.validate!
54
-
54
+
55
55
  and mite-rb will raise an exception with further details when the connection is not valid.
56
56
 
57
57
  ### Project
@@ -59,45 +59,45 @@ and mite-rb will raise an exception with further details when the connection is
59
59
  #### Find all active projects
60
60
 
61
61
  Mite::Project.all
62
-
62
+
63
63
  #### Find all archived projects
64
64
 
65
65
  Mite::Project.archived
66
-
66
+
67
67
  #### Find projects where name contains 'web'
68
68
 
69
69
  Mite::Project.all(:params => {:name => 'web'})
70
-
70
+
71
71
  #### Find single project by ID
72
72
 
73
73
  Mite::Project.find(1209)
74
-
74
+
75
75
  #### Get all time entries of a project
76
76
 
77
77
  project = Mite::Project.find(1209)
78
78
  project.time_entries
79
-
79
+
80
80
  #### Get the customer of a project
81
81
 
82
82
  project = Mite::Project.find(1209)
83
83
  project.customer
84
-
84
+
85
85
  #### Creating
86
86
 
87
87
  project = Mite::Project.new(:name => 'Playing with the mite.api')
88
88
  project.save
89
89
 
90
90
  or in a single step
91
-
92
- project = Mite::Project.create(:name => 'Playing with the mite.api')
93
-
91
+
92
+ project = Mite::Project.create(:name => 'Playing with the mite.api')
93
+
94
94
  #### Updating
95
95
 
96
96
  project = Mite::Project.find(1209)
97
97
  project.name = "mite.api"
98
98
  project.customer = Mite::Customer.find(384)
99
99
  project.save
100
-
100
+
101
101
  #### Deleting
102
102
 
103
103
  project = Mite::Project.find(1209)
data/lib/mite/tracker.rb CHANGED
@@ -3,13 +3,13 @@ class Mite::Tracker < Mite::Base
3
3
  self.collection_name = "tracker"
4
4
 
5
5
  def self.current
6
- tracking_time_entry = connection.get(collection_path, headers)["tracking_time_entry"]
6
+ tracking_time_entry = (format.decode(connection.get(collection_path, headers).body) || {})["tracking_time_entry"]
7
7
  tracking_time_entry ? instantiate_record(tracking_time_entry) : nil
8
8
  end
9
9
 
10
10
  def self.start(time_entry_or_id)
11
11
  id = time_entry_or_id.is_a?(Mite::TimeEntry) ? time_entry_or_id.id : time_entry_or_id
12
- self.new(:id => id).start
12
+ new({:id => id}, true).start
13
13
  end
14
14
 
15
15
  def self.stop
@@ -24,7 +24,7 @@ class Mite::Tracker < Mite::Base
24
24
  end
25
25
 
26
26
  def stop
27
- connection.delete(element_path, self.class.headers).is_a?(Net::HTTPSuccess) ? self : false
27
+ Net::HTTPSuccess === connection.delete(element_path, self.class.headers) && self
28
28
  end
29
29
 
30
30
  def time_entry
data/lib/mite/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mite
2
- VERSION = "0.4.5"
2
+ VERSION = "0.5.0"
3
3
  end
data/mite-rb.gemspec CHANGED
@@ -19,6 +19,6 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_runtime_dependency(%q<activeresource>, [">= 2.3.14"])
22
+ s.add_runtime_dependency(%q<activeresource>, [">= 3.1.0"])
23
23
  end
24
24
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mite-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-28 00:00:00.000000000 Z
12
+ date: 2012-12-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activeresource
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 2.3.14
21
+ version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: 2.3.14
29
+ version: 3.1.0
30
30
  description: The official ruby library for interacting with the RESTful mite.api.
31
31
  email:
32
32
  - sebastian@yo.lk