Class: LucidIntercom::UpdateUser
- Inherits:
-
Object
- Object
- LucidIntercom::UpdateUser
- Defined in:
- lib/lucid_intercom/update_user.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#call ⇒ Object
Create or update user identified by attributes.
-
#initialize(shop_attributes, app_attributes, credentials = LucidIntercom.credentials) ⇒ UpdateUser
constructor
A new instance of UpdateUser.
Constructor Details
#initialize(shop_attributes, app_attributes, credentials = LucidIntercom.credentials) ⇒ UpdateUser
Returns a new instance of UpdateUser.
17 18 19 20 |
# File 'lib/lucid_intercom/update_user.rb', line 17 def initialize(shop_attributes, app_attributes, credentials = LucidIntercom.credentials) @attributes = Attributes.new(shop_attributes, app_attributes, credentials) @credentials = credentials end |
Instance Attribute Details
#attributes ⇒ LucidIntercom::Attributes (readonly)
23 24 25 |
# File 'lib/lucid_intercom/update_user.rb', line 23 def attributes @attributes end |
#credentials ⇒ LucidIntercom::Credentials (readonly)
25 26 27 |
# File 'lib/lucid_intercom/update_user.rb', line 25 def credentials @credentials end |
Instance Method Details
#call ⇒ Object
Create or update user identified by attributes.
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/lucid_intercom/update_user.rb', line 32 def call res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(req, data) end status = res.code.to_i if status >= 400 # rubocop:disable Style/GuardClause raise LucidIntercom::RequestError.new(status), 'invalid response code %s' % status end end |