Class: SpreeCmCommissioner::GoogleWallets::HotelClassUpdater

Inherits:
BaseHotelClass show all
Defined in:
app/services/spree_cm_commissioner/google_wallets/hotel_class_updater.rb

Constant Summary

Constants inherited from BaseGenericClass

BaseGenericClass::GOOGLE_API_ENDPOINT, BaseGenericClass::GOOGLE_OAUTH_SCOPE

Instance Method Summary collapse

Methods inherited from BaseHotelClass

#background_color, #build_request_body, #call, #class_id, #hero_image, #hotel_address, #hotel_name, #issuer_id, #issuer_name, #logo

Methods inherited from BaseGenericClass

#access_token, #build_request_body, #credentials, #initialize

Constructor Details

This class inherits a constructor from SpreeCmCommissioner::GoogleWallets::BaseGenericClass

Instance Method Details

#send_requestObject

override



5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/services/spree_cm_commissioner/google_wallets/hotel_class_updater.rb', line 5

def send_request
  uri = URI.parse("#{GOOGLE_API_ENDPOINT}/#{class_id}")
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true

  request = Net::HTTP::Patch.new(uri)
  request['Authorization'] = "Bearer #{access_token}"
  request['Content-Type'] = 'application/json'
  request.body = build_request_body

  http.request(request)
end