oceanarium 1.0.0 → 1.1.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d24e5ef02095427cad50b2459ece46c38e0af9b4
4
- data.tar.gz: 1e7b9003d684efacc1905937d5aeed40de3359d4
3
+ metadata.gz: a15b899a5889fc34fb5154e38caf914ca6b1f954
4
+ data.tar.gz: 2b91d44e365dfc8f3423be14282672cde42970e7
5
5
  SHA512:
6
- metadata.gz: e3ff20e8057cdc8aa549c772cb858f37d9779cb3feddd4c56e3265e3ccc2a0f14481c35edf6e516c3c0f1a9a96e23df739f5296d5f99c0bd1f6d60d3f3df7d12
7
- data.tar.gz: bfbe77e8322113347a7e47ef8c6f700a8aafca53a5db483ed90d183c95268d482f276bfb0e0fac72f34a72159db9a70646eb009d9aec4476f698c5e4b81b4238
6
+ metadata.gz: e5a1a7911b184be441031afede3056f77e59f9d73219858215948de0ff5374d761d0573c36a0c4fdb3147c415493d5777b63b544d3f1cd97850fbd9c895ac2fe
7
+ data.tar.gz: e57ac80f71315accaca350a44f3fd734c9bf3b5077a1fcb8cf1e0ae4b7a3984a6897e3a0c1bf5c4240b208540c1caf96ea0da1bc0660e76e012e9fb1f13c1980
data/lib/oceanarium.rb CHANGED
@@ -112,4 +112,10 @@ module Oceanarium
112
112
  @regions
113
113
  end
114
114
  end
115
+
116
+ # /events/
117
+
118
+ def self.event(id = nil)
119
+ Oceanarium::Event.new(id, Oceanarium::Config.api_key, Oceanarium::Config.client_id)
120
+ end
115
121
  end
@@ -5,6 +5,7 @@ require 'oceanarium/resources/domain'
5
5
  require 'oceanarium/resources/record'
6
6
  require 'oceanarium/resources/region'
7
7
  require 'oceanarium/resources/size'
8
+ require 'oceanarium/resources/event'
8
9
 
9
10
  module Oceanarium
10
11
  module Resources
@@ -0,0 +1,36 @@
1
+ module Oceanarium
2
+ class Event
3
+ attr_accessor :id, :action_status, :droplet_id, :event_type_id, :percentage
4
+
5
+ def initialize(option, api_key, client_id)
6
+ if api_key.nil? || client_id.nil?
7
+ raise 'No API key/client ID!'
8
+ else
9
+ if option.is_a?(Hash)
10
+ @object = option
11
+ else
12
+ @object = Oceanarium::Event.find(option)
13
+ end
14
+ if @object.nil?
15
+ self.id = nil
16
+ else
17
+ self.id = @object['id']
18
+ self.action_status = @object['action_status']
19
+ self.droplet_id = @object['droplet_id']
20
+ self.event_type_id = @object['event_type_id']
21
+ self.percentage = @object['percentage']
22
+ end
23
+ end
24
+ end
25
+
26
+ # Core API
27
+
28
+ def self.find(id)
29
+ @request = Oceanarium::Request.new
30
+ @get = @request.get("/events/#{id}/")
31
+ if @get.parsed_response['status'] == 'OK'
32
+ @get.parsed_response['event']
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,3 +1,3 @@
1
1
  module Oceanarium
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oceanarium
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valdos Sine
@@ -85,6 +85,7 @@ files:
85
85
  - lib/oceanarium/resources.rb
86
86
  - lib/oceanarium/resources/domain.rb
87
87
  - lib/oceanarium/resources/droplet.rb
88
+ - lib/oceanarium/resources/event.rb
88
89
  - lib/oceanarium/resources/image.rb
89
90
  - lib/oceanarium/resources/record.rb
90
91
  - lib/oceanarium/resources/region.rb
@@ -112,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
113
  version: '0'
113
114
  requirements: []
114
115
  rubyforge_project:
115
- rubygems_version: 2.0.3
116
+ rubygems_version: 2.0.7
116
117
  signing_key:
117
118
  specification_version: 4
118
119
  summary: Smart and tiny Digital Ocean API wrapper for Ruby/Rails. For all dirty work