bastilian-fluxapi 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ === 0.5.0 / 2009-02-07
2
+
3
+ * First release
@@ -0,0 +1,51 @@
1
+ = fluxapi
2
+
3
+ == DESCRIPTION:
4
+
5
+ A API-wrapper for the Fluxiom-API (http://www.fluxiom.com)
6
+
7
+ == FEATURES/PROBLEMS:
8
+
9
+ Currently very basic and only to retrieve data, not update or upload data.
10
+
11
+ == SYNOPSIS:
12
+
13
+ require 'fluxapi'
14
+
15
+ @fluxiom = Fluxiom.new('validcode', 'sebastian', 'SecretPassword')
16
+ @fluxiom.assets
17
+ @fluxiom.users
18
+
19
+
20
+ == REQUIREMENTS:
21
+
22
+ * httparty >= 0.3.0
23
+
24
+ == INSTALL:
25
+
26
+ sudo gem install fluxapi
27
+
28
+ == LICENSE:
29
+
30
+ (The MIT License)
31
+
32
+ Copyright (c) 2009 Sebastian Gräßl
33
+
34
+ Permission is hereby granted, free of charge, to any person obtaining
35
+ a copy of this software and associated documentation files (the
36
+ 'Software'), to deal in the Software without restriction, including
37
+ without limitation the rights to use, copy, modify, merge, publish,
38
+ distribute, sublicense, and/or sell copies of the Software, and to
39
+ permit persons to whom the Software is furnished to do so, subject to
40
+ the following conditions:
41
+
42
+ The above copyright notice and this permission notice shall be
43
+ included in all copies or substantial portions of the Software.
44
+
45
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
46
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
47
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
48
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
49
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
50
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
51
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,7 @@
1
+ require 'httparty'
2
+ require 'fluxapi/base'
3
+ require 'fluxapi/account'
4
+ require 'fluxapi/asset'
5
+ require 'fluxapi/assets'
6
+ require 'fluxapi/user'
7
+ require 'fluxapi/users'
@@ -0,0 +1,12 @@
1
+ class Fluxiom::Account < Fluxiom
2
+ def initialize(options = {})
3
+ self.class.call('/api/account.xml')['account'].each do |k, v|
4
+ self.instance_variable_set("@#{k}", v)
5
+ self.class.send(:define_method, k, proc{self.instance_variable_get("@#{k}")})
6
+ self.class.send(:define_method, "#{k}=", proc{|v| self.instance_variable_set("@#{k}", v)})
7
+ end
8
+ end
9
+ def assets
10
+ Fluxiom::Assets.new
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ class Fluxiom::Asset < Fluxiom
2
+ def initialize(data)
3
+ data.each do |k, v|
4
+ self.instance_variable_set("@#{k}", v)
5
+ self.class.send(:define_method, k, proc{self.instance_variable_get("@#{k}")})
6
+ self.class.send(:define_method, "#{k}=", proc{|v| self.instance_variable_set("@#{k}", v)})
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ class Fluxiom::Assets < Fluxiom
2
+ include Enumerable
3
+ def initialize
4
+ @assets = []
5
+ self.class.call('/api/assets.xml')['documents'].each do |v|
6
+ @assets << Fluxiom::Asset.new(v)
7
+ end
8
+ end
9
+ def each
10
+ @assets.each {|pt| yield pt}
11
+ end
12
+ end
@@ -0,0 +1,20 @@
1
+ class Fluxiom
2
+ include HTTParty
3
+ format :xml
4
+ def initialize(sub, u, p)
5
+ self.class.base_uri sub + '.fluxiom.com'
6
+ self.class.basic_auth u, p
7
+ end
8
+ def self.call(url)
9
+ get(url)
10
+ end
11
+ def account
12
+ Fluxiom::Account.new
13
+ end
14
+ def assets
15
+ Fluxiom::Assets.new
16
+ end
17
+ def users
18
+ Fluxiom::Users.new
19
+ end
20
+ end
@@ -0,0 +1,9 @@
1
+ class Fluxiom::User < Fluxiom
2
+ def initialize(data)
3
+ data.each do |k, v|
4
+ self.instance_variable_set("@#{k}", v)
5
+ self.class.send(:define_method, k, proc{self.instance_variable_get("@#{k}")})
6
+ self.class.send(:define_method, "#{k}=", proc{|v| self.instance_variable_set("@#{k}", v)})
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ class Fluxiom::Users < Fluxiom
2
+ include Enumerable
3
+ def initialize
4
+ @users = []
5
+ self.class.call('/api/users.xml')['users'].each do |v|
6
+ @users << Fluxiom::User.new(v)
7
+ end
8
+ end
9
+ def each
10
+ @users.each {|pt| yield pt}
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bastilian-fluxapi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.1
5
+ platform: ruby
6
+ authors:
7
+ - "Sebastian Gr\xC3\xA4\xC3\x9Fl"
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-02-08 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: httparty
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.3.0
23
+ version:
24
+ description: Fluxiom API wrapper
25
+ email: sebastian.graessl@gmail.com
26
+ executables: []
27
+
28
+ extensions: []
29
+
30
+ extra_rdoc_files:
31
+ - README.txt
32
+ files:
33
+ - History.txt
34
+ - README.txt
35
+ - lib/fluxapi.rb
36
+ - lib/fluxapi/base.rb
37
+ - lib/fluxapi/asset.rb
38
+ - lib/fluxapi/assets.rb
39
+ - lib/fluxapi/user.rb
40
+ - lib/fluxapi/users.rb
41
+ - lib/fluxapi/account.rb
42
+ has_rdoc: false
43
+ homepage:
44
+ post_install_message:
45
+ rdoc_options: []
46
+
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: "0"
60
+ version:
61
+ requirements: []
62
+
63
+ rubyforge_project:
64
+ rubygems_version: 1.2.0
65
+ signing_key:
66
+ specification_version: 2
67
+ summary: Fluxiom API wrapper
68
+ test_files: []
69
+