securevideo-api 0.3.0 → 0.4.0

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: a30e0703195e86139b545ff329551fd2b8055dbb
4
- data.tar.gz: 6db9bea001b4431cc832963569ad65c43add5960
3
+ metadata.gz: 9ee485b92afaf9dacb01c1e3c91b6bdce40316a1
4
+ data.tar.gz: 0edace78fb53dfe7c80ba058d2d6ff668f90dd25
5
5
  SHA512:
6
- metadata.gz: 0f18d8493f84d744e4d75f8396d39dd213815238738efd0bc23418569bc8ab31ec02cd7bbe78994e5148da950125d5031f7fa6f05da357b056957935b86a6199
7
- data.tar.gz: 78d7bbae107982634773735f76cddcc26991876ca3762354246e4badbc1440699b3987d5e9b7cfc959f8a7aeabfd8456d5da752e314b2f54b9245df6292f2349
6
+ metadata.gz: 2a81f3cff1f30cfd410ff49078706027907d367871386c34ad081617837c698eb7220774ead08519b94387c4c3697c41154ecb2e0eed5346670b1289544a20a9
7
+ data.tar.gz: 93ace387f66e0bd0f67bddeda081077d81bdf848cbd6ea9d222f567c8f4a6c754ce4a93c9bac86ccc909c85fa4d8606f9983d23f9c526e6d499caab7c46e07df
@@ -3,6 +3,7 @@ require 'faraday_middleware'
3
3
  require 'her'
4
4
  require "securevideo/api/version"
5
5
  require "securevideo/api/time_zones"
6
+ require "securevideo/api/response"
6
7
  module Securevideo
7
8
  module Api
8
9
  class ClientNotConfigured < Exception; end
@@ -0,0 +1,37 @@
1
+ module Securevideo
2
+ module Api
3
+ class Response
4
+ attr_reader :response
5
+ def initialize(response)
6
+ @response = response
7
+ end
8
+
9
+ def success?
10
+ status == :ok
11
+ end
12
+
13
+ def status
14
+ if !response.respond_to?(:Message) || response.Message.nil?
15
+ :ok
16
+ else
17
+ :error
18
+ end
19
+ end
20
+
21
+ def error_message
22
+ response.Message
23
+ end
24
+
25
+ def error_details
26
+ response.MessageDetail
27
+ end
28
+
29
+ def to_s
30
+ "status:#{status} message:#{success? ? '' : error_message}"
31
+ end
32
+ def inspect
33
+ "#{self.class.name} - #{to_s}"
34
+ end
35
+ end
36
+ end
37
+ end
@@ -4,7 +4,7 @@ module Securevideo
4
4
  include Her::Model
5
5
  uses_api Securevideo::Api.api
6
6
  primary_key :SessionId
7
- collection_path "session/:UserId"
7
+ collection_path 'session/:UserId'
8
8
 
9
9
  attributes :UserId, :ScheduleTs, :Participants
10
10
  validates :UserId, presence: true
@@ -12,15 +12,22 @@ module Securevideo
12
12
  validates :Participants, presence: true
13
13
 
14
14
  def reschedule(schedule_ts)
15
- self.class.put("session/#{id}", { 'ScheduleTs' => schedule_ts })
15
+ self.class.reschedule(id, schedule_ts)
16
16
  end
17
17
 
18
18
  def destroy
19
- self.class.delete("session/#{id}")
20
- nil
19
+ self.class.cancel(id)
21
20
  end
22
21
 
23
22
  class << self
23
+ def cancel(session_id)
24
+ Response.new(delete("session/#{session_id}"))
25
+ end
26
+
27
+ def reschedule(session_id, schedule_ts)
28
+ Response.new(put("session/#{session_id}", 'ScheduleTs' => schedule_ts))
29
+ end
30
+
24
31
  #
25
32
  # @params month - 2014-01-01
26
33
  #
@@ -1,5 +1,5 @@
1
1
  module Securevideo
2
2
  module Api
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: securevideo-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxim Pechnikov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-03-24 00:00:00.000000000 Z
11
+ date: 2015-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon
@@ -244,6 +244,7 @@ files:
244
244
  - bin/setup
245
245
  - lib/securevideo/api.rb
246
246
  - lib/securevideo/api/participant.rb
247
+ - lib/securevideo/api/response.rb
247
248
  - lib/securevideo/api/session.rb
248
249
  - lib/securevideo/api/time_zones.rb
249
250
  - lib/securevideo/api/user.rb