Class: Fuselage::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/fuselage/base.rb

Direct Known Subclasses

Blob, Commit, Reference, Repository, Tag, Tree, User

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Base

Returns a new instance of Base.



6
7
8
9
10
11
12
13
14
# File 'lib/fuselage/base.rb', line 6

def initialize(attributes={})
  # Useful for finding out what attr_accessor needs for classes
  # puts caller.first.inspect
  # puts "#{self.class.inspect} #{attributes.keys.map { |s| s.to_sym }.inspect}"
  attributes.each do |key, value|
    method = "#{key}="
    self.send(method, value) if respond_to? method
  end
end

Instance Attribute Details

#apiObject

Returns the value of attribute api.



4
5
6
# File 'lib/fuselage/base.rb', line 4

def api
  @api
end

Class Method Details

.delete_method(path, params = {}) ⇒ Object



26
27
28
# File 'lib/fuselage/base.rb', line 26

def self.delete_method(path, params={})
  Api.api.delete(path, params, self)
end

.get(path, params = {}) ⇒ Object



16
17
18
19
# File 'lib/fuselage/base.rb', line 16

def self.get(path, params={})
  response = Api.api.get(path, params, self)
  response.parsed_response
end

.post(path, params = {}) ⇒ Object



21
22
23
24
# File 'lib/fuselage/base.rb', line 21

def self.post(path, params={})
  response = Api.api.post(path, params, self)
  response.parsed_response
end