devstructure 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/devstructure/api.rb +10 -8
  2. metadata +4 -4
@@ -14,6 +14,7 @@ class DevStructure::API < Net::HTTP
14
14
  end
15
15
 
16
16
  def initialize(token=nil)
17
+ @newimpl = true
17
18
  uri = URI.parse("https://devstructure.com")
18
19
  super uri.host, uri.port
19
20
  self.use_ssl = "https" == uri.scheme
@@ -60,31 +61,32 @@ class DevStructure::API < Net::HTTP
60
61
 
61
62
  def list
62
63
  @api.start unless @api.started?
63
- response, body = @api.get(@api.path("blueprints", @username),
64
- @api.headers)
64
+ response = @api.get(@api.path("blueprints", @username), @api.headers)
65
65
  return response unless Net::HTTPOK == response.class
66
- JSON.parse(body).collect { |hash| Blueprint.new(hash["name"], hash) }
66
+ JSON.parse(response.body).collect do |hash|
67
+ Blueprint.new(hash["name"], hash)
68
+ end
67
69
  end
68
70
 
69
71
  def get(name, token=nil)
70
72
  @api.start unless @api.started?
71
- response, body = @api.get(@api.path("blueprints", @username,
72
- name, token), @api.headers)
73
+ response = @api.get(@api.path("blueprints", @username, name, token),
74
+ @api.headers)
73
75
  return response unless Net::HTTPOK == response.class
74
- hash = JSON.parse(body)
76
+ hash = JSON.parse(response.body)
75
77
  Blueprint.new(hash["name"], hash)
76
78
  end
77
79
 
78
80
  def post(name, options={})
79
81
  @api.start unless @api.started?
80
- response, body = @api.post(@api.path("blueprints", @username, name),
82
+ response = @api.post(@api.path("blueprints", @username, name),
81
83
  JSON.generate(options), @api.headers)
82
84
  response
83
85
  end
84
86
 
85
87
  def delete(name, options={})
86
88
  @api.start unless @api.started?
87
- response, body = @api.delete(@api.path("blueprints", @username, name),
89
+ response = @api.delete(@api.path("blueprints", @username, name),
88
90
  @api.headers)
89
91
  response
90
92
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devstructure
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Richard Crowley
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-07 00:00:00 +00:00
18
+ date: 2010-06-08 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies: []
21
21