apphoshies-ruby-client 0.3.9 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -16,3 +16,8 @@
16
16
  === 0.3.9
17
17
 
18
18
  * Pre-Release for automatic getters/setters on documents
19
+
20
+
21
+ === 0.4.0
22
+
23
+ * File Upload Support
data/Manifest.txt CHANGED
@@ -4,10 +4,12 @@ PostInstall.txt
4
4
  README.rdoc
5
5
  Rakefile
6
6
  lib/apphoshies_client.rb
7
+ lib/apphoshies_client/class_methods.rb
7
8
  lib/apphoshies_client/configuration.rb
8
9
  lib/apphoshies_client/device_token.rb
9
10
  lib/apphoshies_client/document.rb
10
11
  lib/apphoshies_client/message.rb
12
+ lib/apphoshies_client/file_upload.rb
11
13
  script/console
12
14
  script/destroy
13
15
  script/generate
@@ -0,0 +1,2 @@
1
+ module ClassMethods
2
+ end
@@ -1,4 +1,6 @@
1
1
  class ApphoshiesClient::DeviceToken < ActiveResource::Base
2
+ extend ClassMethods
3
+
2
4
  self.site = @@apphoshies_configuration.site
3
5
  self.format = :json
4
6
  headers['APH_USERNAME'] = @@apphoshies_configuration.username
@@ -1,20 +1,25 @@
1
1
  class ApphoshiesClient::Document < ActiveResource::Base
2
+ extend ClassMethods
3
+
2
4
  self.site = @@apphoshies_configuration.site
3
5
  self.format = :json
4
6
  headers['APH_USERNAME'] = @@apphoshies_configuration.username
5
7
  headers['APH_API_KEY'] = @@apphoshies_configuration.api_key
6
8
 
7
9
  def self.get(query_symbol, options = {})
10
+ reload_http_headers
8
11
  return find(query_symbol, :params => {:app_id => @@apphoshies_configuration.app_id}) if query_symbol.is_a?(String)
9
12
  default_options = {:app_id => @@apphoshies_configuration.app_id, :limit => 100}
10
13
  find(:all, :params => default_options.merge(options))
11
14
  end
12
15
 
13
16
  def self.all(options = {})
17
+ reload_http_headers
14
18
  get(:all, options)
15
19
  end
16
20
 
17
21
  def self.find_by_datasource(datasource, options = {})
22
+ reload_http_headers
18
23
  get(:all, options.merge(:datasource => datasource))
19
24
  end
20
25
 
@@ -49,4 +54,10 @@ class ApphoshiesClient::Document < ActiveResource::Base
49
54
  return nil
50
55
  end
51
56
  end
57
+
58
+ private
59
+ def self.reload_http_headers
60
+ headers['APH_USERNAME'] = @@apphoshies_configuration.username
61
+ headers['APH_API_KEY'] = @@apphoshies_configuration.api_key
62
+ end
52
63
  end
@@ -0,0 +1,33 @@
1
+ class ApphoshiesClient::FileUpload < ActiveResource::Base
2
+ extend ClassMethods
3
+
4
+ self.site = @@apphoshies_configuration.site
5
+ self.format = :json
6
+ headers['APH_USERNAME'] = @@apphoshies_configuration.username
7
+ headers['APH_API_KEY'] = @@apphoshies_configuration.api_key
8
+
9
+ def url
10
+ "https://service.apphoshies.com/file_uploads/#{self.id}"
11
+ end
12
+
13
+ def self.find_by_application_client_key(application_client_key, options = {})
14
+ reload_http_headers
15
+ default_options = {:app_id => @@apphoshies_configuration.app_id, :application_client_key => application_client_key}
16
+ find(:all, :params => default_options.merge(options))
17
+ end
18
+
19
+ def self.find_one(id); get(id); end
20
+
21
+ def self.get(query_symbol, options = {})
22
+ reload_http_headers
23
+ return find(query_symbol, :params => {:app_id => @@apphoshies_configuration.app_id}) if query_symbol.is_a?(String)
24
+ default_options = {:app_id => @@apphoshies_configuration.app_id, :limit => 100}
25
+ find(:all, :params => default_options.merge(options))
26
+ end
27
+
28
+ private
29
+ def self.reload_http_headers
30
+ headers['APH_USERNAME'] = @@apphoshies_configuration.username
31
+ headers['APH_API_KEY'] = @@apphoshies_configuration.api_key
32
+ end
33
+ end
@@ -1,4 +1,6 @@
1
1
  class ApphoshiesClient::Message < ActiveResource::Base
2
+ extend ClassMethods
3
+
2
4
  self.site = @@apphoshies_configuration.site
3
5
  self.format = :json
4
6
  headers['APH_USERNAME'] = @@apphoshies_configuration.username
@@ -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.3.9'
5
+ VERSION = '0.4.0'
6
6
  end
7
7
 
8
8
  require "rubygems"
@@ -11,12 +11,15 @@ require 'active_resource'
11
11
 
12
12
  ActiveResource::Base.include_root_in_json = true
13
13
 
14
+ require 'apphoshies_client/class_methods'
14
15
  require 'apphoshies_client/configuration'
15
16
  @@apphoshies_configuration = ApphoshiesClient::Configuration.new
16
17
  @@apphoshies_configuration.site = 'https://service.apphoshies.com'
17
18
  @@apphoshies_configuration.username = ''
18
19
  @@apphoshies_configuration.api_key = ''
20
+ @@apphoshies_configuration.app_id = ''
19
21
 
20
22
  require 'apphoshies_client/device_token'
21
23
  require 'apphoshies_client/document'
22
24
  require 'apphoshies_client/message'
25
+ require 'apphoshies_client/file_upload'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apphoshies-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 3
9
- - 9
10
- version: 0.3.9
8
+ - 4
9
+ - 0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Oliver Kiessler
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-07 00:00:00 +01:00
18
+ date: 2010-11-17 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -84,10 +84,12 @@ files:
84
84
  - README.rdoc
85
85
  - Rakefile
86
86
  - lib/apphoshies_client.rb
87
+ - lib/apphoshies_client/class_methods.rb
87
88
  - lib/apphoshies_client/configuration.rb
88
89
  - lib/apphoshies_client/device_token.rb
89
90
  - lib/apphoshies_client/document.rb
90
91
  - lib/apphoshies_client/message.rb
92
+ - lib/apphoshies_client/file_upload.rb
91
93
  - script/console
92
94
  - script/destroy
93
95
  - script/generate