Module: Bucketkit::Configurable

Included in:
Bucketkit, Client
Defined in:
lib/bucketkit/configurable.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_endpointObject



38
39
40
# File 'lib/bucketkit/configurable.rb', line 38

def api_endpoint
  File.join @api_endpoint, ''
end

#auto_paginateObject

Returns the value of attribute auto_paginate.



3
4
5
# File 'lib/bucketkit/configurable.rb', line 3

def auto_paginate
  @auto_paginate
end

#connection_optionsObject

Returns the value of attribute connection_options.



3
4
5
# File 'lib/bucketkit/configurable.rb', line 3

def connection_options
  @connection_options
end

#default_media_typeObject

Returns the value of attribute default_media_type.



3
4
5
# File 'lib/bucketkit/configurable.rb', line 3

def default_media_type
  @default_media_type
end

#loginObject



46
47
48
49
50
# File 'lib/bucketkit/configurable.rb', line 46

def 
  @login ||= begin
    user. if basic_authenticated?
  end
end

#middlewareObject

Returns the value of attribute middleware.



3
4
5
# File 'lib/bucketkit/configurable.rb', line 3

def middleware
  @middleware
end

#oauth_tokensObject

Returns the value of attribute oauth_tokens.



3
4
5
# File 'lib/bucketkit/configurable.rb', line 3

def oauth_tokens
  @oauth_tokens
end

#password=(value) ⇒ Object (writeonly)

Sets the attribute password

Parameters:

  • value

    the value to set the attribute password to.



6
7
8
# File 'lib/bucketkit/configurable.rb', line 6

def password=(value)
  @password = value
end

#per_pageObject

Returns the value of attribute per_page.



3
4
5
# File 'lib/bucketkit/configurable.rb', line 3

def per_page
  @per_page
end

#proxyObject

Returns the value of attribute proxy.



3
4
5
# File 'lib/bucketkit/configurable.rb', line 3

def proxy
  @proxy
end

#user_agentObject

Returns the value of attribute user_agent.



3
4
5
# File 'lib/bucketkit/configurable.rb', line 3

def user_agent
  @user_agent
end

#web_endpointObject



42
43
44
# File 'lib/bucketkit/configurable.rb', line 42

def web_endpoint
  File.join @web_endpoint, ''
end

Class Method Details

.keysObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bucketkit/configurable.rb', line 9

def keys
  @keys ||= [
      :oauth_tokens,
      :auto_paginate,
      :per_page,
      :api_endpoint,
      :web_endpoint,
      :login,
      :password,
      :connection_options,
      :default_media_type,
      :middleware,
      :user_agent
  ]
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



26
27
28
# File 'lib/bucketkit/configurable.rb', line 26

def configure
  yield self
end

#reset!Object Also known as: setup



30
31
32
33
34
35
# File 'lib/bucketkit/configurable.rb', line 30

def reset!
  Bucketkit::Configurable.keys.each { |key|
    instance_variable_set(:"@#{key}", Bucketkit::Default.options[key])
  }
  self
end