Class: Amberlock::Amber

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

Instance Method Summary collapse

Constructor Details

#initialize(api_key, amber_code) ⇒ Amber

Returns a new instance of Amber.



6
7
8
9
10
11
# File 'lib/amberlock.rb', line 6

def initialize(api_key, amber_code)
  @api_key = api_key
  @amber_code = amber_code
  @subscribe_url = 'http://amberlock.herokuapp.com/api/amber_users'
  @request_unlock_url = 'http://amberlock.herokuapp.com/api/unlock'
end

Instance Method Details

#request_unlock(mobile, email) ⇒ Object



17
18
19
# File 'lib/amberlock.rb', line 17

def request_unlock(mobile, email)
  RestClient.post "#{@request_unlock_url}", "api_key=#{@api_key}&amber_code=#{@amber_code}&mobile=#{mobile}&email=#{email}"
end

#subscribe_user(mobile, email) ⇒ Object



13
14
15
# File 'lib/amberlock.rb', line 13

def subscribe_user(mobile, email)
  RestClient.post "#{@subscribe_url}", "api_key=#{@api_key}&amber_code=#{@amber_code}&mobile=#{mobile}&email=#{email}"
end