apphoshies-ruby-client 0.2 → 0.3

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.
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
1
  === 0.1 2010-07-07
2
2
 
3
3
  * Initial release
4
+
5
+ === 0.2
6
+
7
+ === 0.3
8
+
9
+ * Config loading improvements (for Rails)
10
+ * New helper methods in Document
@@ -1,17 +1,17 @@
1
1
  class ApphoshiesClient::Configuration
2
2
  attr_accessor :site, :username, :api_key, :app_id
3
3
 
4
- def config(scope = 'default')
5
- @config ||= read_config
4
+ def config(scope = 'default', cfg_path = "apphoshies.yml")
5
+ @config ||= read_config(cfg_path)
6
6
  self.username = @config[scope]['username']
7
7
  self.api_key = @config[scope]['api_key']
8
8
  self.app_id = @config[scope]['app_id']
9
9
  end
10
10
 
11
- def read_config
12
- if File.exists?("apphoshies.yml")
13
- puts "Using config in this directory"
14
- @config = YAML.load(File.read("apphoshies.yml"))
11
+ def read_config(cfg_path)
12
+ if File.exists?(cfg_path)
13
+ puts "Using config: #{cfg_path}"
14
+ @config = YAML.load(File.read(cfg_path))
15
15
  else
16
16
  begin
17
17
  puts "Using config in your home directory"
@@ -19,4 +19,11 @@ class ApphoshiesClient::Document < ActiveResource::Base
19
19
  end
20
20
 
21
21
  def self.find_one(id); get(id); end
22
+
23
+ def get_value(key)
24
+ if self.values
25
+ v = self.values.select {|value_object| value_object.respond_to?(key.to_sym)}
26
+ return v.first.send(key.to_sym) if v and v.any?
27
+ end
28
+ end
22
29
  end
@@ -2,7 +2,7 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  module ApphoshiesClient
5
- VERSION = '0.2'
5
+ VERSION = '0.3'
6
6
  end
7
7
 
8
8
  require "rubygems"
metadata CHANGED
@@ -1,11 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apphoshies-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 13
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
- - 2
8
- version: "0.2"
8
+ - 3
9
+ version: "0.3"
9
10
  platform: ruby
10
11
  authors:
11
12
  - Oliver Kiessler
@@ -13,16 +14,18 @@ autorequire:
13
14
  bindir: bin
14
15
  cert_chain: []
15
16
 
16
- date: 2010-07-10 00:00:00 +02:00
17
+ date: 2010-11-06 00:00:00 +01:00
17
18
  default_executable:
18
19
  dependencies:
19
20
  - !ruby/object:Gem::Dependency
20
21
  name: activeresource
21
22
  prerelease: false
22
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
23
25
  requirements:
24
26
  - - ">="
25
27
  - !ruby/object:Gem::Version
28
+ hash: 9
26
29
  segments:
27
30
  - 2
28
31
  - 3
@@ -34,9 +37,11 @@ dependencies:
34
37
  name: rubyforge
35
38
  prerelease: false
36
39
  requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
37
41
  requirements:
38
42
  - - ">="
39
43
  - !ruby/object:Gem::Version
44
+ hash: 7
40
45
  segments:
41
46
  - 2
42
47
  - 0
@@ -48,9 +53,11 @@ dependencies:
48
53
  name: hoe
49
54
  prerelease: false
50
55
  requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
51
57
  requirements:
52
58
  - - ">="
53
59
  - !ruby/object:Gem::Version
60
+ hash: 21
54
61
  segments:
55
62
  - 2
56
63
  - 6
@@ -96,23 +103,27 @@ rdoc_options:
96
103
  require_paths:
97
104
  - lib
98
105
  required_ruby_version: !ruby/object:Gem::Requirement
106
+ none: false
99
107
  requirements:
100
108
  - - ">="
101
109
  - !ruby/object:Gem::Version
110
+ hash: 3
102
111
  segments:
103
112
  - 0
104
113
  version: "0"
105
114
  required_rubygems_version: !ruby/object:Gem::Requirement
115
+ none: false
106
116
  requirements:
107
117
  - - ">="
108
118
  - !ruby/object:Gem::Version
119
+ hash: 3
109
120
  segments:
110
121
  - 0
111
122
  version: "0"
112
123
  requirements: []
113
124
 
114
125
  rubyforge_project: apphoshies-ruby-client
115
- rubygems_version: 1.3.6
126
+ rubygems_version: 1.3.7
116
127
  signing_key:
117
128
  specification_version: 3
118
129
  summary: The App Hoshies infrastructure is based on REST Webservices