apphoshies-ruby-client 0.1 → 0.2

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/Manifest.txt CHANGED
@@ -4,6 +4,7 @@ PostInstall.txt
4
4
  README.rdoc
5
5
  Rakefile
6
6
  lib/apphoshies_client.rb
7
+ lib/apphoshies_client/configuration.rb
7
8
  lib/apphoshies_client/device_token.rb
8
9
  lib/apphoshies_client/document.rb
9
10
  lib/apphoshies_client/message.rb
@@ -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.1'
5
+ VERSION = '0.2'
6
6
  end
7
7
 
8
8
  require "rubygems"
@@ -0,0 +1,24 @@
1
+ class ApphoshiesClient::Configuration
2
+ attr_accessor :site, :username, :api_key, :app_id
3
+
4
+ def config(scope = 'default')
5
+ @config ||= read_config
6
+ self.username = @config[scope]['username']
7
+ self.api_key = @config[scope]['api_key']
8
+ self.app_id = @config[scope]['app_id']
9
+ end
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"))
15
+ else
16
+ begin
17
+ puts "Using config in your home directory"
18
+ @config = YAML.load(File.read("#{ENV['HOME']}/.apphoshies.yml"))
19
+ rescue Errno::ENOENT
20
+ raise "apphoshies.yml expected in current directory or ~/.apphoshies.yml"
21
+ end
22
+ end
23
+ end
24
+ end
metadata CHANGED
@@ -4,8 +4,8 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
- version: "0.1"
7
+ - 2
8
+ version: "0.2"
9
9
  platform: ruby
10
10
  authors:
11
11
  - Oliver Kiessler
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2010-07-08 00:00:00 +02:00
16
+ date: 2010-07-10 00:00:00 +02:00
17
17
  default_executable:
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
@@ -76,6 +76,7 @@ files:
76
76
  - README.rdoc
77
77
  - Rakefile
78
78
  - lib/apphoshies_client.rb
79
+ - lib/apphoshies_client/configuration.rb
79
80
  - lib/apphoshies_client/device_token.rb
80
81
  - lib/apphoshies_client/document.rb
81
82
  - lib/apphoshies_client/message.rb