biosphere 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af41c8485d5ec0811a8bc7cbbab11204a2bf6063
4
- data.tar.gz: c2978b2f6b0365cefcfeaee24ac8e22eb257df4f
3
+ metadata.gz: 39c9987b17ef9850602f0d6e68c8002a8b64d842
4
+ data.tar.gz: 4c463b3c39668f2329a9820d2645a6443a0ce38f
5
5
  SHA512:
6
- metadata.gz: eac28688a1713bb4868c218594d40f6ed4668429dd6fcdd58a7def99c9d02b89003376591d4113f2847c790c68f542c80022d77ed86b84050f8221f06f11bef9
7
- data.tar.gz: 8af9ff67b5a1c4e64224d1011aa37d5202ec0bf6909fbbd38408b67f494d3ef3e6e11c42549eed5197fe0b2c3e64409d79b367c2cd3c9025e15bb73130ac5949
6
+ metadata.gz: 7959a09eb3d179d78ae78cc7319885decf77ae57fa31d512e446ff5d6c594abecef8a0e0eb5af6085c5bcf13001fbf80466ab0a7d21cee92bcc8ccd5fa09b8e1
7
+ data.tar.gz: 4d507b41a170ed80f9a0a986144b2928991d87fe587f0c60fae3f9bd6c5ed739f1e79ef854cd42e4403097b9d89140b8157f660cfffca28ccde77cbca1d9db6d
@@ -71,7 +71,23 @@ class Biosphere
71
71
  end
72
72
 
73
73
  ns_prefix = client.build_namespace_prefix(resource[:metadata][:namespace])
74
- ret = client.rest_client[ns_prefix + resource_name].post(resource.to_h.to_json, { 'Content-Type' => 'application/json' }.merge(client.instance_variable_get("@headers")))
74
+ begin
75
+ ret = client.rest_client[ns_prefix + resource_name].post(resource.to_h.to_json, { 'Content-Type' => 'application/json' }.merge(client.instance_variable_get("@headers")))
76
+ rescue RestClient::MethodNotAllowed => e
77
+ if !resource[:metadata][:namespace]
78
+ puts "Error doing api call: #{e}".colorize(:red)
79
+ puts "This might be because you did not specify namespace in your resource: #{resource[:metadata]}".colorize(:yellow)
80
+ else
81
+ puts "Error calling API: #{e}"
82
+ end
83
+ puts "rest_client: #{ns_prefix + resource_name}, client: #{client.rest_client[ns_prefix + resource_name]}"
84
+ raise e
85
+
86
+ rescue RestClient::Exception => e
87
+ puts "Error calling API: #{e}"
88
+ puts "rest_client: #{ns_prefix + resource_name}, client: #{client.rest_client[ns_prefix + resource_name]}"
89
+ raise e
90
+ end
75
91
  return {
76
92
  action: :post,
77
93
  resource: ns_prefix + resource_name + "/#{name}",
@@ -1,3 +1,3 @@
1
1
  class Biosphere
2
- Version = "0.2.5"
2
+ Version = "0.2.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biosphere
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juho Mäkinen