Class: TinCan

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/tincan.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_id, app_key, app_name) ⇒ TinCan

Returns a new instance of TinCan.



10
11
12
# File 'lib/tincan.rb', line 10

def initialize(app_id, app_key, app_name)
    @id, @key, @name = app_id, app_key, app_name
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



8
9
10
# File 'lib/tincan.rb', line 8

def id
  @id
end

#keyObject

Returns the value of attribute key.



8
9
10
# File 'lib/tincan.rb', line 8

def key
  @key
end

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/tincan.rb', line 8

def name
  @name
end

Instance Method Details

#validateObject



27
28
29
30
31
32
33
34
# File 'lib/tincan.rb', line 27

def validate
    return  read_response(
                self.class.get(
                    "/#{@name}/authorized",
                    :basic_auth => {:username => @id, :password => @key}
                ).body
            )
end