Class: AFMotion::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/afmotion/http_client.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.sharedObject

Returns the value of attribute shared.



58
59
60
# File 'lib/afmotion/http_client.rb', line 58

def shared
  @shared
end

Class Method Details

.build(base_url, &block) ⇒ Object

Returns an instance of AFHTTPClient



61
62
63
64
65
66
67
68
# File 'lib/afmotion/http_client.rb', line 61

def build(base_url, &block)
  client = AFHTTPClient.clientWithBaseURL(base_url.to_url)
  if block
    dsl = AFMotion::ClientDSL.new(client)
    dsl.instance_eval(&block)
  end
  client
end

.build_shared(base_url, &block) ⇒ Object

Sets AFMotion::Client.shared as the built client TODO: Make sure this only happens once (dispatch_once not available)



72
73
74
# File 'lib/afmotion/http_client.rb', line 72

def build_shared(base_url, &block)
  self.shared = self.build(base_url, &block)
end