iron_core 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ .idea
2
+ .bundle
3
+ pkg
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'http://rubygems.org'
2
+
3
+
4
+ gemspec
5
+
6
+
7
+ gem 'rest', '>= 2.0.3'
8
+
9
+ group :development do
10
+ gem 'rake'
11
+ gem 'jeweler2'
12
+ end
@@ -0,0 +1,22 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler2 (2.0.9)
6
+ git (>= 1.2.5)
7
+ mime-types (1.19)
8
+ net-http-persistent (2.7)
9
+ rake (0.9.2.2)
10
+ rest (2.0.3)
11
+ net-http-persistent
12
+ rest-client (>= 0.3.0)
13
+ rest-client (1.6.7)
14
+ mime-types (>= 1.16)
15
+
16
+ PLATFORMS
17
+ ruby
18
+
19
+ DEPENDENCIES
20
+ jeweler2
21
+ rake
22
+ rest (>= 2.0.3)
@@ -0,0 +1 @@
1
+ Common library among www.iron.io Ruby clients.
@@ -0,0 +1,25 @@
1
+ require File.expand_path('../lib/3rdparty/facets/require_relative', __FILE__)
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ require 'jeweler2'
6
+
7
+ Jeweler::Tasks.new do |gem|
8
+ begin
9
+ Bundler.setup(:default, :development)
10
+ rescue Bundler::BundlerError => e
11
+ $stderr.puts e.message
12
+ $stderr.puts "Run `bundle install` to install missing gems"
13
+ exit e.status_code
14
+ end
15
+
16
+ gem.name = "iron_core"
17
+ gem.homepage = "https://github.com/iron-io/iron_core_ruby"
18
+ gem.description = %Q{Core library for Iron products}
19
+ gem.summary = %Q{Core library for Iron products}
20
+ gem.email = "info@iron.io"
21
+ gem.authors = ["Andrew Kirilenko", "Iron.io, Inc"]
22
+ gem.files.exclude('.document', 'Gemfile', 'Gemfile.lock', 'Rakefile', 'iron_core.gemspec')
23
+ end
24
+
25
+ Jeweler::RubygemsDotOrgTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.3
1
+ 0.3.5
@@ -0,0 +1,25 @@
1
+ require File.expand_path('../lib/iron_core/version', __FILE__)
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.authors = ["Andrew Kirilenko", "Iron.io, Inc"]
5
+ gem.email = ["info@iron.io"]
6
+ gem.description = "Core library for Iron products"
7
+ gem.summary = "Core library for Iron products"
8
+ gem.homepage = "https://github.com/iron-io/iron_core_ruby"
9
+
10
+ gem.files = `git ls-files`.split($\)
11
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
12
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
+ gem.name = "iron_core"
14
+ gem.require_paths = ["lib"]
15
+ gem.version = IronCore::VERSION
16
+
17
+ gem.required_rubygems_version = ">= 1.3.6"
18
+ gem.required_ruby_version = Gem::Requirement.new(">= 1.9")
19
+ gem.add_runtime_dependency "rest", ">= 2.0.3"
20
+
21
+ gem.add_development_dependency "test-unit"
22
+ gem.add_development_dependency "minitest"
23
+ gem.add_development_dependency "rake"
24
+
25
+ end
@@ -0,0 +1,22 @@
1
+ module Kernel
2
+ unless private_method_defined?(:require_relative) # 1.9
3
+ # Require file from same dir as calling script...
4
+ #
5
+ # require_local 'myscript'
6
+ #
7
+ # CREDIT: Paul Brannan, Pragmatic Programmers
8
+ #
9
+ def require_relative(relative_feature)
10
+ c = caller.first
11
+ fail "Can't parse #{c}" unless c.rindex(/:\d+(:in `.*')?$/)
12
+
13
+ file = $` # File.dirname(c)
14
+ if /\A\((.*)\)/ =~ file # eval, etc.
15
+ raise LoadError, "require_relative is called in #{$1}"
16
+ end
17
+
18
+ absolute = File.expand_path(relative_feature, File.dirname(file))
19
+ require absolute
20
+ end
21
+ end
22
+ end
@@ -1,3 +1,5 @@
1
+ require File.expand_path('../3rdparty/facets/require_relative', __FILE__)
2
+
1
3
  require_relative 'iron_core/version'
2
4
  require_relative 'iron_core/logger'
3
5
  require_relative 'iron_core/client'
@@ -154,18 +154,22 @@ module IronCore
154
154
  {'User-Agent' => @user_agent}
155
155
  end
156
156
 
157
- def url
157
+ def base_url
158
158
  "#{scheme}://#{host}:#{port}/"
159
159
  end
160
160
 
161
+ def url(method)
162
+ base_url + method
163
+ end
164
+
161
165
  def get(method, params = {})
162
166
  request_hash = {}
163
167
  request_hash[:headers] = headers
164
168
  request_hash[:params] = params
165
169
 
166
- IronCore::Logger.debug 'IronCore', "GET #{url + method} with params='#{request_hash.to_s}'"
170
+ IronCore::Logger.debug 'IronCore', "GET #{url(method)} with params='#{request_hash.to_s}'"
167
171
 
168
- @rest.get(url + method, request_hash)
172
+ @rest.get(url(method), request_hash)
169
173
  end
170
174
 
171
175
  def post(method, params = {})
@@ -173,9 +177,9 @@ module IronCore
173
177
  request_hash[:headers] = headers.merge({'Content-Type' => @content_type})
174
178
  request_hash[:body] = params.to_json
175
179
 
176
- IronCore::Logger.debug 'IronCore', "POST #{url + method} with params='#{request_hash.to_s}'"
180
+ IronCore::Logger.debug 'IronCore', "POST #{base_url + method} with params='#{request_hash.to_s}'"
177
181
 
178
- @rest.post(url + method, request_hash)
182
+ @rest.post(base_url + method, request_hash)
179
183
  end
180
184
 
181
185
  def put(method, params={})
@@ -183,9 +187,9 @@ module IronCore
183
187
  request_hash[:headers] = headers.merge({'Content-Type' => @content_type})
184
188
  request_hash[:body] = params.to_json
185
189
 
186
- IronCore::Logger.debug 'IronCore', "PUT #{url + method} with params='#{request_hash.to_s}'"
190
+ IronCore::Logger.debug 'IronCore', "PUT #{base_url + method} with params='#{request_hash.to_s}'"
187
191
 
188
- @rest.put(url + method, request_hash)
192
+ @rest.put(base_url + method, request_hash)
189
193
  end
190
194
 
191
195
  def delete(method, params = {})
@@ -193,9 +197,9 @@ module IronCore
193
197
  request_hash[:headers] = headers
194
198
  request_hash[:params] = params
195
199
 
196
- IronCore::Logger.debug 'IronCore', "DELETE #{url + method} with params='#{request_hash.to_s}'"
200
+ IronCore::Logger.debug 'IronCore', "DELETE #{base_url + method} with params='#{request_hash.to_s}'"
197
201
 
198
- @rest.delete(url + method, request_hash)
202
+ @rest.delete(base_url + method, request_hash)
199
203
  end
200
204
 
201
205
  def post_file(method, file_field, file, params_field, params = {})
@@ -203,9 +207,9 @@ module IronCore
203
207
  request_hash[:headers] = headers
204
208
  request_hash[:body] = {params_field => params.to_json, file_field => file}
205
209
 
206
- IronCore::Logger.debug 'IronCore', "POST #{url + method} with params='#{request_hash.to_s}'"
210
+ IronCore::Logger.debug 'IronCore', "POST #{base_url + method} with params='#{request_hash.to_s}'"
207
211
 
208
- @rest.post_file(url + method, request_hash)
212
+ @rest.post_file(base_url + method, request_hash)
209
213
  end
210
214
 
211
215
  def parse_response(response, parse_json = true)
@@ -1,7 +1,3 @@
1
1
  module IronCore
2
- @@version = nil
3
-
4
- def self.version
5
- @@version ||= File.read(File.dirname(__FILE__) + '/../../VERSION').strip
6
- end
2
+ VERSION = "0.4.0"
7
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iron_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-07-20 00:00:00.000000000 Z
13
+ date: 2012-08-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest
@@ -19,7 +19,7 @@ dependencies:
19
19
  requirements:
20
20
  - - ! '>='
21
21
  - !ruby/object:Gem::Version
22
- version: 2.0.0
22
+ version: 2.0.3
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,9 +27,25 @@ dependencies:
27
27
  requirements:
28
28
  - - ! '>='
29
29
  - !ruby/object:Gem::Version
30
- version: 2.0.0
30
+ version: 2.0.3
31
31
  - !ruby/object:Gem::Dependency
32
- name: rake
32
+ name: test-unit
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: minitest
33
49
  requirement: !ruby/object:Gem::Requirement
34
50
  none: false
35
51
  requirements:
@@ -45,7 +61,7 @@ dependencies:
45
61
  - !ruby/object:Gem::Version
46
62
  version: '0'
47
63
  - !ruby/object:Gem::Dependency
48
- name: jeweler2
64
+ name: rake
49
65
  requirement: !ruby/object:Gem::Requirement
50
66
  none: false
51
67
  requirements:
@@ -61,14 +77,21 @@ dependencies:
61
77
  - !ruby/object:Gem::Version
62
78
  version: '0'
63
79
  description: Core library for Iron products
64
- email: info@iron.io
80
+ email:
81
+ - info@iron.io
65
82
  executables: []
66
83
  extensions: []
67
- extra_rdoc_files:
68
- - LICENSE
84
+ extra_rdoc_files: []
69
85
  files:
86
+ - .gitignore
87
+ - Gemfile
88
+ - Gemfile.lock
70
89
  - LICENSE
90
+ - README.md
91
+ - Rakefile
71
92
  - VERSION
93
+ - iron_core.gemspec
94
+ - lib/3rdparty/facets/require_relative.rb
72
95
  - lib/iron_core.rb
73
96
  - lib/iron_core/client.rb
74
97
  - lib/iron_core/error.rb
@@ -86,16 +109,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
109
  requirements:
87
110
  - - ! '>='
88
111
  - !ruby/object:Gem::Version
89
- version: '0'
90
- segments:
91
- - 0
92
- hash: -553634863
112
+ version: '1.9'
93
113
  required_rubygems_version: !ruby/object:Gem::Requirement
94
114
  none: false
95
115
  requirements:
96
116
  - - ! '>='
97
117
  - !ruby/object:Gem::Version
98
- version: '0'
118
+ version: 1.3.6
99
119
  requirements: []
100
120
  rubyforge_project:
101
121
  rubygems_version: 1.8.24