apphoshies-ruby-client 0.1

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 ADDED
@@ -0,0 +1,3 @@
1
+ === 0.1 2010-07-07
2
+
3
+ * Initial release
data/Manifest.txt ADDED
@@ -0,0 +1,14 @@
1
+ History.txt
2
+ Manifest.txt
3
+ PostInstall.txt
4
+ README.rdoc
5
+ Rakefile
6
+ lib/apphoshies_client.rb
7
+ lib/apphoshies_client/device_token.rb
8
+ lib/apphoshies_client/document.rb
9
+ lib/apphoshies_client/message.rb
10
+ script/console
11
+ script/destroy
12
+ script/generate
13
+ test/test_apphoshies_client.rb
14
+ test/test_helper.rb
data/PostInstall.txt ADDED
@@ -0,0 +1,2 @@
1
+
2
+ Please visit http://apphoshies.com/main/services for more information about the service.
data/README.rdoc ADDED
@@ -0,0 +1,48 @@
1
+ = apphoshies_client
2
+
3
+ * http://github.com/apphoshies/apphoshies-ruby-client
4
+
5
+ == DESCRIPTION:
6
+
7
+ The App Hoshies infrastructure is based on REST Webservices. For your convenience client frameworks are provided to interact with your data.
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * Documents, Device Tokens, Documents
12
+
13
+ == SYNOPSIS:
14
+
15
+ FIX (code sample of usage)
16
+
17
+ == REQUIREMENTS:
18
+
19
+ * Active Resource
20
+
21
+ == INSTALL:
22
+
23
+ * [sudo] gem install apphoshies-ruby-client
24
+
25
+ == LICENSE:
26
+
27
+ (The MIT License)
28
+
29
+ Copyright (c) 2010 Oliver Kiessler / The App Hoshies
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining
32
+ a copy of this software and associated documentation files (the
33
+ 'Software'), to deal in the Software without restriction, including
34
+ without limitation the rights to use, copy, modify, merge, publish,
35
+ distribute, sublicense, and/or sell copies of the Software, and to
36
+ permit persons to whom the Software is furnished to do so, subject to
37
+ the following conditions:
38
+
39
+ The above copyright notice and this permission notice shall be
40
+ included in all copies or substantial portions of the Software.
41
+
42
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
43
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,19 @@
1
+ require 'rubygems'
2
+ gem 'hoe', '>= 2.1.0'
3
+ require 'hoe'
4
+ require 'fileutils'
5
+ require './lib/apphoshies_client'
6
+
7
+ Hoe.plugin :newgem
8
+
9
+ # Generate all the Rake tasks
10
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
11
+ $hoe = Hoe.spec 'apphoshies-ruby-client' do
12
+ self.developer 'Oliver Kiessler', 'kiessler@apphoshies.com'
13
+ self.post_install_message = 'PostInstall.txt'
14
+ self.rubyforge_name = self.name
15
+ self.extra_deps = [['activeresource','>= 2.3.5']]
16
+ end
17
+
18
+ require 'newgem/tasks'
19
+ Dir['tasks/**/*.rake'].each { |t| load t }
@@ -0,0 +1,21 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ module ApphoshiesClient
5
+ VERSION = '0.1'
6
+ end
7
+
8
+ require "rubygems"
9
+ gem 'activeresource'
10
+ require 'active_resource'
11
+
12
+ ActiveResource::Base.include_root_in_json = true
13
+
14
+ require 'apphoshies_client/configuration'
15
+ @@apphoshies_configuration = ApphoshiesClient::Configuration.new
16
+ @@apphoshies_configuration.config
17
+ @@apphoshies_configuration.site = 'https://service.apphoshies.com'
18
+
19
+ require 'apphoshies_client/device_token'
20
+ require 'apphoshies_client/document'
21
+ require 'apphoshies_client/message'
@@ -0,0 +1,11 @@
1
+ class ApphoshiesClient::DeviceToken < ActiveResource::Base
2
+ self.site = @@apphoshies_configuration.site
3
+ self.format = :json
4
+ headers['APH_USERNAME'] = @@apphoshies_configuration.username
5
+ headers['APH_API_KEY'] = @@apphoshies_configuration.api_key
6
+
7
+ def self.find_by_application_client_key(application_client_key, options = {})
8
+ default_options = {:app_id => @@apphoshies_configuration.app_id, :application_client_key => application_client_key}
9
+ find(:all, :params => default_options.merge(options))
10
+ end
11
+ end
@@ -0,0 +1,22 @@
1
+ class ApphoshiesClient::Document < ActiveResource::Base
2
+ self.site = @@apphoshies_configuration.site
3
+ self.format = :json
4
+ headers['APH_USERNAME'] = @@apphoshies_configuration.username
5
+ headers['APH_API_KEY'] = @@apphoshies_configuration.api_key
6
+
7
+ def self.get(query_symbol, options = {})
8
+ return find(query_symbol, :params => {:app_id => @@apphoshies_configuration.app_id}) if query_symbol.is_a?(String)
9
+ default_options = {:app_id => @@apphoshies_configuration.app_id, :limit => 100}
10
+ find(:all, :params => default_options.merge(options))
11
+ end
12
+
13
+ def self.all(options = {})
14
+ get(:all, options)
15
+ end
16
+
17
+ def self.find_by_datasource(datasource, options = {})
18
+ get(:all, options.merge(:datasource => datasource))
19
+ end
20
+
21
+ def self.find_one(id); get(id); end
22
+ end
@@ -0,0 +1,11 @@
1
+ class ApphoshiesClient::Message < ActiveResource::Base
2
+ self.site = @@apphoshies_configuration.site
3
+ self.format = :json
4
+ headers['APH_USERNAME'] = @@apphoshies_configuration.username
5
+ headers['APH_API_KEY'] = @@apphoshies_configuration.api_key
6
+
7
+ def self.find_by_application_client_key(application_client_key, options = {})
8
+ default_options = {:app_id => @@apphoshies_configuration.app_id, :application_client_key => application_client_key}
9
+ find(:all, :params => default_options.merge(options))
10
+ end
11
+ end
data/script/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/apphoshies_client.rb'}"
9
+ puts "Loading apphoshies_client gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
data/script/destroy ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestApphoshiesClient < Test::Unit::TestCase
4
+
5
+ def setup
6
+ end
7
+
8
+ def test_truth
9
+ assert true
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ require 'stringio'
2
+ require 'test/unit'
3
+ require File.dirname(__FILE__) + '/../lib/apphoshies_client'
metadata ADDED
@@ -0,0 +1,120 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: apphoshies-ruby-client
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ version: "0.1"
9
+ platform: ruby
10
+ authors:
11
+ - Oliver Kiessler
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+
16
+ date: 2010-07-08 00:00:00 +02:00
17
+ default_executable:
18
+ dependencies:
19
+ - !ruby/object:Gem::Dependency
20
+ name: activeresource
21
+ prerelease: false
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ segments:
27
+ - 2
28
+ - 3
29
+ - 5
30
+ version: 2.3.5
31
+ type: :runtime
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: rubyforge
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ segments:
41
+ - 2
42
+ - 0
43
+ - 4
44
+ version: 2.0.4
45
+ type: :development
46
+ version_requirements: *id002
47
+ - !ruby/object:Gem::Dependency
48
+ name: hoe
49
+ prerelease: false
50
+ requirement: &id003 !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ segments:
55
+ - 2
56
+ - 6
57
+ - 1
58
+ version: 2.6.1
59
+ type: :development
60
+ version_requirements: *id003
61
+ description: The App Hoshies infrastructure is based on REST Webservices. For your convenience client frameworks are provided to interact with your data.
62
+ email:
63
+ - kiessler@apphoshies.com
64
+ executables: []
65
+
66
+ extensions: []
67
+
68
+ extra_rdoc_files:
69
+ - History.txt
70
+ - Manifest.txt
71
+ - PostInstall.txt
72
+ files:
73
+ - History.txt
74
+ - Manifest.txt
75
+ - PostInstall.txt
76
+ - README.rdoc
77
+ - Rakefile
78
+ - lib/apphoshies_client.rb
79
+ - lib/apphoshies_client/device_token.rb
80
+ - lib/apphoshies_client/document.rb
81
+ - lib/apphoshies_client/message.rb
82
+ - script/console
83
+ - script/destroy
84
+ - script/generate
85
+ - test/test_apphoshies_client.rb
86
+ - test/test_helper.rb
87
+ has_rdoc: true
88
+ homepage: http://github.com/apphoshies/apphoshies-ruby-client
89
+ licenses: []
90
+
91
+ post_install_message: PostInstall.txt
92
+ rdoc_options:
93
+ - --main
94
+ - README.rdoc
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ segments:
102
+ - 0
103
+ version: "0"
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ segments:
109
+ - 0
110
+ version: "0"
111
+ requirements: []
112
+
113
+ rubyforge_project: apphoshies-ruby-client
114
+ rubygems_version: 1.3.6
115
+ signing_key:
116
+ specification_version: 3
117
+ summary: The App Hoshies infrastructure is based on REST Webservices
118
+ test_files:
119
+ - test/test_apphoshies_client.rb
120
+ - test/test_helper.rb