Class: FriendlyScore::Endpoints::Base

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

Direct Known Subclasses

Show, ShowPartnerUser, UserPositive, UserStatus, Users

Instance Method Summary collapse

Constructor Details

#initialize(application_id, application_secret, responder) ⇒ Base

Returns a new instance of Base.



4
5
6
7
8
# File 'lib/friendly_score/endpoints/base.rb', line 4

def initialize application_id, application_secret, responder
  @application_id = application_id
  @application_secret = application_secret
  @responder = responder
end

Instance Method Details

#perform(*args) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/friendly_score/endpoints/base.rb', line 10

def perform *args
  code, body = make_request args
  case code
    when "200" then process_response body
    when "404" then process_error body
    else raise Errors::ServerError
  end
end