Class: EY::ServicesAPI::Connection
- Inherits:
-
ApiHMAC::AuthedConnection
- Object
- ApiHMAC::AuthedConnection
- EY::ServicesAPI::Connection
- Defined in:
- lib/ey_services_api/connection.rb
Instance Method Summary collapse
- #default_user_agent ⇒ Object
- #destroy_invoice(url) ⇒ Object
- #destroy_service(url) ⇒ Object
- #get_service(url) ⇒ Object
- #list_invoices(invoices_url) ⇒ Object
- #list_services(url) ⇒ Object
- #register_service(registration_url, params) ⇒ Object
- #send_invoice(invoices_url, invoice) ⇒ Object
- #send_message(url, message) ⇒ Object
- #update_provisioned_service(url, params) ⇒ Object
- #update_service(url, params) ⇒ Object
- #update_service_account(url, params) ⇒ Object
Instance Method Details
#default_user_agent ⇒ Object
9 10 11 |
# File 'lib/ey_services_api/connection.rb', line 9 def default_user_agent "EY-ServicesAPI/#{VERSION}" end |
#destroy_invoice(url) ⇒ Object
78 79 80 |
# File 'lib/ey_services_api/connection.rb', line 78 def destroy_invoice(url) delete(url) end |
#destroy_service(url) ⇒ Object
46 47 48 |
# File 'lib/ey_services_api/connection.rb', line 46 def destroy_service(url) delete(url) end |
#get_service(url) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/ey_services_api/connection.rb', line 33 def get_service(url) get(url) do |json_body, response_location| service = Service.new(json_body["service"]) service.connection = self service.url = url service end end |
#list_invoices(invoices_url) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/ey_services_api/connection.rb', line 66 def list_invoices(invoices_url) get(invoices_url) do |json_body, response_location| json_body.map do |json_item| invoice = Invoice.new(json_item["invoice"]) invoice.connection = self invoice.url = json_item["invoice"]["url"] invoice.status = json_item["invoice"]["status"] invoice end end end |
#list_services(url) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ey_services_api/connection.rb', line 13 def list_services(url) response = get(url) do |json_body, response_location| json_body.map do |json_item| service = Service.new(json_item["service"]) service.connection = self service.url = json_item["service"]["url"] service end end end |
#register_service(registration_url, params) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/ey_services_api/connection.rb', line 24 def register_service(registration_url, params) post(registration_url, :service => params) do |json_body, response_location| service = Service.new(params) service.connection = self service.url = response_location service end end |
#send_invoice(invoices_url, invoice) ⇒ Object
62 63 64 |
# File 'lib/ey_services_api/connection.rb', line 62 def send_invoice(invoices_url, invoice) post(invoices_url, :invoice => invoice.to_hash) end |
#send_message(url, message) ⇒ Object
58 59 60 |
# File 'lib/ey_services_api/connection.rb', line 58 def (url, ) post(url, :message => .to_hash) end |
#update_provisioned_service(url, params) ⇒ Object
54 55 56 |
# File 'lib/ey_services_api/connection.rb', line 54 def update_provisioned_service(url, params) put(url, :provisioned_service => params) end |
#update_service(url, params) ⇒ Object
42 43 44 |
# File 'lib/ey_services_api/connection.rb', line 42 def update_service(url, params) put(url, :service => params) end |
#update_service_account(url, params) ⇒ Object
50 51 52 |
# File 'lib/ey_services_api/connection.rb', line 50 def update_service_account(url, params) put(url, :service_account => params) end |