testcloud_devices_ruby 0.0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2d2b8ce6cb345af4e249a0d19721d158e7f7c2c1
4
+ data.tar.gz: 36355c6fa6547f9df84977abe8d094339ed46ef1
5
+ SHA512:
6
+ metadata.gz: 3a7dcd20c2c8c11e451f9832d0d7553795ba31e81682a09f8d95318dcabf2ef95fa9cc60164c69ebd5441371c80772286dec89b4e63d7280d16daae3fe15024a
7
+ data.tar.gz: 2adf4b6a9130eeee8b301f8710261712fc402481d48b222bb7d8d712408498ea540667e1fd5363c8d7bcc276615772ea423dc2a4d63282a4e2afce77bcf30009
@@ -0,0 +1,44 @@
1
+ module Testcloud
2
+ module Devices
3
+ class Client
4
+ include HTTParty
5
+ DEFAULT_URL ||= 'https://stan.testcloud.io'
6
+ API_TOKEN_KEY ||= 'X-Testcloud-Devices-Token'
7
+
8
+ attr_accessor :type, :category, :api_token
9
+
10
+ def initialize(options = {})
11
+ @type, @category = options[:type], options[:category]
12
+ self.class.debug_output if options[:debug]
13
+ self.class.base_uri(options[:url] || DEFAULT_URL)
14
+ @api_token = options[:api_token] || ''
15
+ end
16
+
17
+ def types
18
+ response = self.class.get('/devices/types', access_headers)
19
+ Response.new(response).keys
20
+ end
21
+
22
+ def categories
23
+ response = self.class.get("/devices/#{type.pluralize}/categories", access_headers)
24
+ Response.new(response).keys
25
+ end
26
+
27
+ def validate(data = {})
28
+ response = self.class.post("/devices/#{type}/#{category}", access_headers.merge(body: data))
29
+ Response.new(response)
30
+ end
31
+
32
+ def form_data
33
+ response = self.class.get("/devices/#{type}/#{category}/form_data", access_headers)
34
+ Response.new(response)
35
+ end
36
+
37
+ private
38
+ def access_headers
39
+ @access_headers ||= { headers: { API_TOKEN_KEY => api_token } }
40
+ end
41
+
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,9 @@
1
+ module Testcloud
2
+ module Devices
3
+ class Response < Hash
4
+ include Hashie::Extensions::MergeInitializer
5
+ include Hashie::Extensions::IndifferentAccess
6
+ include Hashie::Extensions::MethodAccess
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,28 @@
1
+ module Testcloud
2
+ module Devices
3
+ module Ruby
4
+ module VERSION
5
+
6
+ def self.gem_version
7
+ @gem_version ||= Gem::Version.new(STRING)
8
+ end
9
+
10
+ MAJOR = 0
11
+ MINOR = 0
12
+ PATCH = 0
13
+ PRE = 1
14
+ STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
15
+ end
16
+
17
+ class << self
18
+ def version
19
+ VERSION::STRING
20
+ end
21
+ def gem_version
22
+ VERSION.gem_version
23
+ end
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,6 @@
1
+ module Testcloud
2
+ module Devices
3
+ module Ruby
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,10 @@
1
+ require 'httparty'
2
+ require 'hashie'
3
+ require 'active_support/inflector'
4
+
5
+ module Testcloud
6
+ module Devices
7
+ autoload :Client, 'testcloud/devices/client'
8
+ autoload :Response, 'testcloud/devices/response'
9
+ end
10
+ end
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: testcloud_devices_ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - John Faucett
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.1'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.10'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.10'
69
+ - !ruby/object:Gem::Dependency
70
+ name: httparty
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.13'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.13'
83
+ - !ruby/object:Gem::Dependency
84
+ name: hashie
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.3'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.3'
97
+ - !ruby/object:Gem::Dependency
98
+ name: activesupport
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '4'
104
+ - - "<"
105
+ - !ruby/object:Gem::Version
106
+ version: '5'
107
+ type: :runtime
108
+ prerelease: false
109
+ version_requirements: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '4'
114
+ - - "<"
115
+ - !ruby/object:Gem::Version
116
+ version: '5'
117
+ description: Rest API Client for the testcloud-devices public api interface
118
+ email: john.faucett@testcloud.io
119
+ executables: []
120
+ extensions: []
121
+ extra_rdoc_files: []
122
+ files:
123
+ - lib/testcloud/devices.rb
124
+ - lib/testcloud/devices/client.rb
125
+ - lib/testcloud/devices/response.rb
126
+ - lib/testcloud/devices/ruby.rb
127
+ - lib/testcloud/devices/ruby/version.rb
128
+ homepage: https://github.com/testCloud/testcloud-devices-client
129
+ licenses:
130
+ - MIT
131
+ metadata: {}
132
+ post_install_message:
133
+ rdoc_options: []
134
+ require_paths:
135
+ - lib
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ requirements: []
147
+ rubyforge_project:
148
+ rubygems_version: 2.2.2
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: Rest API Client for testcloud-devices
152
+ test_files: []