Class: SBF::Client::DonationEndpoint

Inherits:
EntityEndpoint show all
Defined in:
lib/stbaldricks/endpoints/donation.rb

Instance Attribute Summary

Attributes inherited from EntityEndpoint

#orig_target_class

Instance Method Summary collapse

Methods inherited from EntityEndpoint

#aggregate, #delete, #find, #find_first, #get, #initialize, #save, #update

Constructor Details

This class inherits a constructor from SBF::Client::EntityEndpoint

Instance Method Details

#create(entity_or_hash, with = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/stbaldricks/endpoints/donation.rb', line 7

def create(entity_or_hash, with = {})
  unless SBF::Client::Configuration.forwarded_for
    SBF::Client::LOG.warn {
      "SBF::Client No forwarded_for configured for the client on the donation create route. \
        This may cause your app to be blocked from creating donations if too many errors occur."
    }
  end
  super
end

#external_sync(data) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/stbaldricks/endpoints/donation.rb', line 17

def external_sync(data)
  response = SBF::Client::Api::Request.post_request("#{base_uri}/external_sync", data)

  unless ok?(response)
    parsed_response_body = JSON.parse(response.body).symbolize!
    error = SBF::Client::ErrorEntity.new(parsed_response_body)
  end

  SBF::Client::Api::Response.new(http_code: response.code, data: response, error: error)
end