hmx_client 0.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/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/hmx_client.gemspec +25 -0
- data/lib/hmx_client/hmx.rb +32 -0
- data/lib/hmx_client/version.rb +3 -0
- data/lib/hmx_client.rb +5 -0
- metadata +75 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/hmx_client.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "hmx_client/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "hmx_client"
|
7
|
+
s.version = HmxClient::VERSION
|
8
|
+
s.authors = ["Alan Moore"]
|
9
|
+
s.email = ["ukmoore@gmail.com"]
|
10
|
+
s.homepage = "http://rubygems.org/gems/hmx_client"
|
11
|
+
s.summary = %q{HMX Client is used to interact with the Jagwire HMX environment, usually hosted as an addon to Heroku}
|
12
|
+
s.description = %q{Gives a client the ability to interact fully with the API for HMX}
|
13
|
+
|
14
|
+
s.rubyforge_project = "hmx_client"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
# s.add_development_dependency "rspec"
|
23
|
+
s.add_runtime_dependency "rest-client"
|
24
|
+
s.add_runtime_dependency "json"
|
25
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rest_client'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module hmx_client
|
6
|
+
class Hmx
|
7
|
+
def initialize(url, urlapi)
|
8
|
+
@urlapi = urlapi
|
9
|
+
response = RestClient.get url
|
10
|
+
@context = JSON.parse(response.to_str)
|
11
|
+
end
|
12
|
+
def get(displayName)
|
13
|
+
hash = Hash.new
|
14
|
+
hash['context'] = @context
|
15
|
+
hash['displayName'] = displayName
|
16
|
+
response = performRequest('user', 'GETDATA', hash)
|
17
|
+
return response.to_str
|
18
|
+
end
|
19
|
+
def put(displayName, content)
|
20
|
+
hash = Hash.new
|
21
|
+
hash['context'] = @context
|
22
|
+
hash['displayName'] = displayName
|
23
|
+
hash['content'] = content
|
24
|
+
response = performRequest('user', 'PUTSIMPLEDATA', hash)
|
25
|
+
return response.to_str
|
26
|
+
end
|
27
|
+
def performRequest(prefix, function, command)
|
28
|
+
response = RestClient.post @urlapi+'/'+prefix, :function=>function, :params=>JSON.generate(command), :multipart=>true
|
29
|
+
return response
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/hmx_client.rb
ADDED
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hmx_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Alan Moore
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-10-23 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rest-client
|
16
|
+
requirement: &70135689387200 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70135689387200
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: json
|
27
|
+
requirement: &70135689386780 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70135689386780
|
36
|
+
description: Gives a client the ability to interact fully with the API for HMX
|
37
|
+
email:
|
38
|
+
- ukmoore@gmail.com
|
39
|
+
executables: []
|
40
|
+
extensions: []
|
41
|
+
extra_rdoc_files: []
|
42
|
+
files:
|
43
|
+
- .gitignore
|
44
|
+
- Gemfile
|
45
|
+
- Rakefile
|
46
|
+
- hmx_client.gemspec
|
47
|
+
- lib/hmx_client.rb
|
48
|
+
- lib/hmx_client/hmx.rb
|
49
|
+
- lib/hmx_client/version.rb
|
50
|
+
homepage: http://rubygems.org/gems/hmx_client
|
51
|
+
licenses: []
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
requirements: []
|
69
|
+
rubyforge_project: hmx_client
|
70
|
+
rubygems_version: 1.8.10
|
71
|
+
signing_key:
|
72
|
+
specification_version: 3
|
73
|
+
summary: HMX Client is used to interact with the Jagwire HMX environment, usually
|
74
|
+
hosted as an addon to Heroku
|
75
|
+
test_files: []
|