Class: Intercom::Client
- Inherits:
-
Object
- Object
- Intercom::Client
- Includes:
- Options
- Defined in:
- lib/intercom/client.rb
Instance Attribute Summary collapse
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#rate_limit_details ⇒ Object
readonly
Returns the value of attribute rate_limit_details.
Class Method Summary collapse
Instance Method Summary collapse
- #admins ⇒ Object
- #companies ⇒ Object
- #contacts ⇒ Object
- #conversations ⇒ Object
- #counts ⇒ Object
- #delete(path, payload_hash) ⇒ Object
- #events ⇒ Object
- #get(path, params) ⇒ Object
-
#initialize(app_id: 'my_app_id', api_key: 'my_api_key') ⇒ Client
constructor
A new instance of Client.
- #messages ⇒ Object
- #notes ⇒ Object
- #post(path, payload_hash) ⇒ Object
- #put(path, payload_hash) ⇒ Object
- #segments ⇒ Object
- #subscriptions ⇒ Object
- #tags ⇒ Object
- #users ⇒ Object
Methods included from Options
Constructor Details
#initialize(app_id: 'my_app_id', api_key: 'my_api_key') ⇒ Client
Returns a new instance of Client.
16 17 18 19 20 21 |
# File 'lib/intercom/client.rb', line 16 def initialize(app_id: 'my_app_id', api_key: 'my_api_key') @app_id = app_id @api_key = api_key @base_url = 'https://api.intercom.io' @rate_limit_details = {} end |
Instance Attribute Details
#base_url ⇒ Object
Returns the value of attribute base_url.
4 5 6 |
# File 'lib/intercom/client.rb', line 4 def base_url @base_url end |
#rate_limit_details ⇒ Object (readonly)
Returns the value of attribute rate_limit_details.
4 5 6 |
# File 'lib/intercom/client.rb', line 4 def rate_limit_details @rate_limit_details end |
Class Method Details
.set_base_url(base_url) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/intercom/client.rb', line 7 def set_base_url(base_url) return Proc.new do |o| old_url = o.base_url o.send(:base_url=, base_url) Proc.new { |obj| set_base_url(old_url).call(o) } end end |
Instance Method Details
#admins ⇒ Object
23 24 25 |
# File 'lib/intercom/client.rb', line 23 def admins Intercom::Service::Admin.new(self) end |
#companies ⇒ Object
27 28 29 |
# File 'lib/intercom/client.rb', line 27 def companies Intercom::Service::Company.new(self) end |
#contacts ⇒ Object
31 32 33 |
# File 'lib/intercom/client.rb', line 31 def contacts Intercom::Service::Contact.new(self) end |
#conversations ⇒ Object
35 36 37 |
# File 'lib/intercom/client.rb', line 35 def conversations Intercom::Service::Conversation.new(self) end |
#counts ⇒ Object
39 40 41 |
# File 'lib/intercom/client.rb', line 39 def counts Intercom::Service::Counts.new(self) end |
#delete(path, payload_hash) ⇒ Object
83 84 85 |
# File 'lib/intercom/client.rb', line 83 def delete(path, payload_hash) execute_request Intercom::Request.delete(path, payload_hash) end |
#events ⇒ Object
43 44 45 |
# File 'lib/intercom/client.rb', line 43 def events Intercom::Service::Event.new(self) end |
#get(path, params) ⇒ Object
71 72 73 |
# File 'lib/intercom/client.rb', line 71 def get(path, params) execute_request Intercom::Request.get(path, params) end |
#messages ⇒ Object
47 48 49 |
# File 'lib/intercom/client.rb', line 47 def Intercom::Service::Message.new(self) end |
#notes ⇒ Object
51 52 53 |
# File 'lib/intercom/client.rb', line 51 def notes Intercom::Service::Note.new(self) end |
#post(path, payload_hash) ⇒ Object
75 76 77 |
# File 'lib/intercom/client.rb', line 75 def post(path, payload_hash) execute_request Intercom::Request.post(path, payload_hash) end |
#put(path, payload_hash) ⇒ Object
79 80 81 |
# File 'lib/intercom/client.rb', line 79 def put(path, payload_hash) execute_request Intercom::Request.put(path, payload_hash) end |
#segments ⇒ Object
59 60 61 |
# File 'lib/intercom/client.rb', line 59 def segments Intercom::Service::Segment.new(self) end |
#subscriptions ⇒ Object
55 56 57 |
# File 'lib/intercom/client.rb', line 55 def subscriptions Intercom::Service::Subscription.new(self) end |
#tags ⇒ Object
63 64 65 |
# File 'lib/intercom/client.rb', line 63 def Intercom::Service::Tag.new(self) end |
#users ⇒ Object
67 68 69 |
# File 'lib/intercom/client.rb', line 67 def users Intercom::Service::User.new(self) end |