Class: WCC::Data::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/wcc/data/service.rb

Constant Summary collapse

VERBS =
Set.new(%i[get post put patch delete])

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Service

Returns a new instance of Service.



7
8
9
10
# File 'lib/wcc/data/service.rb', line 7

def initialize(args={})
  @uri = URI(args.fetch(:uri) { "" })
  @connection = args.fetch(:connection) { nil }
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



3
4
5
# File 'lib/wcc/data/service.rb', line 3

def connection
  @connection
end

#uriObject (readonly)

Returns the value of attribute uri.



3
4
5
# File 'lib/wcc/data/service.rb', line 3

def uri
  @uri
end

Instance Method Details

#merge(arg = nil) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/wcc/data/service.rb', line 12

def merge(arg=nil)
  right = WCC::Data.Service(arg)
  self.class.new(
    uri: merge_uris(uri, right.uri),
    connection: right.connection || connection
  )
end