Class: Typekitable::RequestFetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/typekitable/request_fetcher.rb

Constant Summary collapse

VALID_TYPES =
[:kit_list, :kit_add, :kit_info, :kit_publish]
VALID_OPTIONS =
{
  :kit_add => [:name, :domains]
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, options = {}, resource_id = nil) ⇒ RequestFetcher

Returns a new instance of RequestFetcher.



10
11
12
13
14
# File 'lib/typekitable/request_fetcher.rb', line 10

def initialize(type, options = {}, resource_id = nil)
  @type = validate_type(type)
  @options = validate_options(options)
  @resource_id = resource_id
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/typekitable/request_fetcher.rb', line 3

def options
  @options
end

#resource_idObject (readonly)

Returns the value of attribute resource_id.



3
4
5
# File 'lib/typekitable/request_fetcher.rb', line 3

def resource_id
  @resource_id
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/typekitable/request_fetcher.rb', line 3

def type
  @type
end

Instance Method Details

#parametersObject



24
25
26
# File 'lib/typekitable/request_fetcher.rb', line 24

def parameters
  options
end

#request_pathObject



16
17
18
# File 'lib/typekitable/request_fetcher.rb', line 16

def request_path
  request_config[type][:request_path]
end

#responseObject



28
29
30
# File 'lib/typekitable/request_fetcher.rb', line 28

def response
  Request.new(request_path, verb, parameters).response
end

#verbObject



20
21
22
# File 'lib/typekitable/request_fetcher.rb', line 20

def verb
  request_config[type][:verb]
end