Module: FastBound::API
- Included in:
- Account, Acquisition, Attachment, Client, Contact, Disposition, Item, SmartList, Webhook
- Defined in:
- lib/fastbound-ruby/api.rb
Constant Summary collapse
- ROOT_URL =
'https://cloud.fastbound.com'.freeze
- USER_AGENT =
"FastBoundRubyGem/#{FastBound::VERSION}".freeze
- FILE_UPLOAD_ATTRS =
{ permitted: %i( file_name file_type file_contents ).freeze, reqired: %i( file_type file_contents ).freeze, }
Instance Method Summary collapse
- #delete_request(client, endpoint) ⇒ Object
- #get_request(client, endpoint) ⇒ Object
- #post_file_request(client, endpoint, file_data) ⇒ Object
- #post_request(client, endpoint, data = {}) ⇒ Object
- #put_request(client, endpoint, data = {}) ⇒ Object
Instance Method Details
#delete_request(client, endpoint) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/fastbound-ruby/api.rb', line 34 def delete_request(client, endpoint) request = Net::HTTP::Delete.new(request_url(client, endpoint)) set_request_headers(client, request) submit_request(client, request) end |
#get_request(client, endpoint) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/fastbound-ruby/api.rb', line 13 def get_request(client, endpoint) request = Net::HTTP::Get.new(request_url(client, endpoint)) set_request_headers(client, request) submit_request(client, request) end |
#post_file_request(client, endpoint, file_data) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/fastbound-ruby/api.rb', line 41 def post_file_request(client, endpoint, file_data) request = Net::HTTP::Post.new(request_url(client, endpoint)) set_request_headers(client, request) submit_file_request(client, request, file_data) end |
#post_request(client, endpoint, data = {}) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/fastbound-ruby/api.rb', line 20 def post_request(client, endpoint, data = {}) request = Net::HTTP::Post.new(request_url(client, endpoint)) set_request_headers(client, request, 'application/json') submit_request(client, request, data) end |
#put_request(client, endpoint, data = {}) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/fastbound-ruby/api.rb', line 27 def put_request(client, endpoint, data = {}) request = Net::HTTP::Put.new(request_url(client, endpoint)) set_request_headers(client, request, 'application/json') submit_request(client, request, data) end |