Class: Hive::Request::WixAPIRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/hive/connect/request/wix_api_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, verb, path, options = {}) ⇒ WixAPIRequest

Returns a new instance of WixAPIRequest.



11
12
13
14
15
16
17
18
# File 'lib/hive/connect/request/wix_api_request.rb', line 11

def initialize(client, verb, path, options = {})
  @client = client
  @verb = verb.to_sym
  @path = path
  @body = options.fetch(:body, {})
  @params = options.fetch(:params, {})
  @headers = options.fetch(:headers, {})
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



9
10
11
# File 'lib/hive/connect/request/wix_api_request.rb', line 9

def body
  @body
end

#headersObject

Returns the value of attribute headers.



9
10
11
# File 'lib/hive/connect/request/wix_api_request.rb', line 9

def headers
  @headers
end

#paramsObject

Returns the value of attribute params.



9
10
11
# File 'lib/hive/connect/request/wix_api_request.rb', line 9

def params
  @params
end

#pathObject

Returns the value of attribute path.



9
10
11
# File 'lib/hive/connect/request/wix_api_request.rb', line 9

def path
  @path
end

#verbObject

Returns the value of attribute verb.



9
10
11
# File 'lib/hive/connect/request/wix_api_request.rb', line 9

def verb
  @verb
end

Instance Method Details

#initialize_copy(_other) ⇒ Object



37
38
39
40
41
42
# File 'lib/hive/connect/request/wix_api_request.rb', line 37

def initialize_copy(_other)
  @path = @path.dup
  @body = @body.dup
  @params = @params.dup
  @headers = @headers.dup
end

#optionsObject



20
21
22
# File 'lib/hive/connect/request/wix_api_request.rb', line 20

def options
  { body: @body.clone, params: @params.clone, headers: @headers.clone }
end

#performObject



24
25
26
27
# File 'lib/hive/connect/request/wix_api_request.rb', line 24

def perform
  sign_request
  @client.wix_request(self).body
end

#perform_with_cursor(klass) ⇒ Object



33
34
35
# File 'lib/hive/connect/request/wix_api_request.rb', line 33

def perform_with_cursor(klass)
  Hive::Cursor.new(perform, klass, self)
end

#perform_with_object(klass) ⇒ Object



29
30
31
# File 'lib/hive/connect/request/wix_api_request.rb', line 29

def perform_with_object(klass)
  klass.new(perform)
end