Class: Mashery::Key

Inherits:
ApiObjectBase show all
Defined in:
lib/mashery/key.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiObjectBase

delete, fetch, method

Constructor Details

#initialize(data) ⇒ Key

Returns a new instance of Key.



13
14
15
16
17
# File 'lib/mashery/key.rb', line 13

def initialize(data)
  limits = data.delete('limits')
  @limits = limits.map {|l| Limit.new(l['period'], l['source'], l['ceiling'])} if limits
  super
end

Instance Attribute Details

#apikeyObject

Returns the value of attribute apikey.



4
5
6
# File 'lib/mashery/key.rb', line 4

def apikey
  @apikey
end

#createdObject (readonly)

Returns the value of attribute created.



3
4
5
# File 'lib/mashery/key.rb', line 3

def created
  @created
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/mashery/key.rb', line 3

def id
  @id
end

#limitsObject (readonly)

Returns the value of attribute limits.



3
4
5
# File 'lib/mashery/key.rb', line 3

def limits
  @limits
end

#qps_limit_ceilingObject

Returns the value of attribute qps_limit_ceiling.



4
5
6
# File 'lib/mashery/key.rb', line 4

def qps_limit_ceiling
  @qps_limit_ceiling
end

#qps_limit_exemptObject

Returns the value of attribute qps_limit_exempt.



4
5
6
# File 'lib/mashery/key.rb', line 4

def qps_limit_exempt
  @qps_limit_exempt
end

#rate_limit_ceilingObject

Returns the value of attribute rate_limit_ceiling.



4
5
6
# File 'lib/mashery/key.rb', line 4

def rate_limit_ceiling
  @rate_limit_ceiling
end

#rate_limit_exemptObject

Returns the value of attribute rate_limit_exempt.



4
5
6
# File 'lib/mashery/key.rb', line 4

def rate_limit_exempt
  @rate_limit_exempt
end

#required_refererObject

Returns the value of attribute required_referer.



4
5
6
# File 'lib/mashery/key.rb', line 4

def required_referer
  @required_referer
end

#secretObject

Returns the value of attribute secret.



4
5
6
# File 'lib/mashery/key.rb', line 4

def secret
  @secret
end

#service_keyObject (readonly)

Returns the value of attribute service_key.



3
4
5
# File 'lib/mashery/key.rb', line 3

def service_key
  @service_key
end

#statusObject

Returns the value of attribute status.



4
5
6
# File 'lib/mashery/key.rb', line 4

def status
  @status
end

#updatedObject (readonly)

Returns the value of attribute updated.



3
4
5
# File 'lib/mashery/key.rb', line 3

def updated
  @updated
end

#usernameObject (readonly)

Returns the value of attribute username.



3
4
5
# File 'lib/mashery/key.rb', line 3

def username
  @username
end

Class Method Details

.create(service_key, username, fields = {}) ⇒ Object



7
8
9
10
11
# File 'lib/mashery/key.rb', line 7

def self.create(service_key, username, fields = {})
  fields ||= {}
  our_fields = fields.merge('service' => {'service_key' => service_key}, 'member' => {'username' => username})
  super(our_fields)
end