Class: Sidemash::Sdk::HookHttpCall

Inherits:
Hook
  • Object
show all
Defined in:
lib/sidemash/sdk/hook_http_call.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Hook

#http_call?, #not_http_call?, #not_ws_call?, #ws_call?

Constructor Details

#initialize(method, url) ⇒ HookHttpCall

Returns a new instance of HookHttpCall.



25
26
27
28
29
# File 'lib/sidemash/sdk/hook_http_call.rb', line 25

def initialize(method, url)
  @_type = 'Hook.HttpCall'
  @method = method
  @url = url
end

Instance Attribute Details

#methodObject (readonly)

Returns the value of attribute method.



22
23
24
# File 'lib/sidemash/sdk/hook_http_call.rb', line 22

def method
  @method
end

#urlObject (readonly)

Returns the value of attribute url.



23
24
25
# File 'lib/sidemash/sdk/hook_http_call.rb', line 23

def url
  @url
end

Class Method Details

._typeObject



31
32
33
# File 'lib/sidemash/sdk/hook_http_call.rb', line 31

def self._type
  'Hook.HttpCall'
end

.from_hash(h) ⇒ Object



61
62
63
64
# File 'lib/sidemash/sdk/hook_http_call.rb', line 61

def self.from_hash(h)
  HookHttpCall.new(HttpMethod.from_s(h['method']),
                   h['url'])
end

.from_json(js) ⇒ Object



35
36
37
38
# File 'lib/sidemash/sdk/hook_http_call.rb', line 35

def self.from_json(js)
  h = JSON.parse(js)
  HookHttpCall.from_hash(h)
end

.from_remote(h) ⇒ Object



56
57
58
59
# File 'lib/sidemash/sdk/hook_http_call.rb', line 56

def self.from_remote(h)
  HookHttpCall.new(HttpMethod.from_s(h['method']),
                   h['url'])
end

Instance Method Details

#to_hashObject



48
49
50
51
52
53
54
# File 'lib/sidemash/sdk/hook_http_call.rb', line 48

def to_hash
  result = {}
  result[:_type] = @_type
  result[:method] = @method.to_s
  result[:url] = @url
  result
end

#to_json(*a) ⇒ Object



66
67
68
# File 'lib/sidemash/sdk/hook_http_call.rb', line 66

def to_json(*a)
  to_hash.to_json(*a)
end

#to_remoteObject



40
41
42
43
44
45
46
# File 'lib/sidemash/sdk/hook_http_call.rb', line 40

def to_remote
  result = {}
  result[:_type] = @_type
  result[:method] = @method.to_s
  result[:url] = @url
  result
end

#to_sObject



70
71
72
73
# File 'lib/sidemash/sdk/hook_http_call.rb', line 70

def to_s
  ('HookHttpCall(method=' + @method.to_s +
                ', url=' + @url + ')')
end