Class: Xapixctl::PhoenixClient::OrganizationConnection
- Inherits:
-
Object
- Object
- Xapixctl::PhoenixClient::OrganizationConnection
- Defined in:
- lib/xapixctl/phoenix_client/organization_connection.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#org ⇒ Object
readonly
Returns the value of attribute org.
Instance Method Summary collapse
- #apply(resource_description, &block) ⇒ Object
- #delete(resource_type, resource_id, &block) ⇒ Object
-
#initialize(connection, org) ⇒ OrganizationConnection
constructor
A new instance of OrganizationConnection.
- #resource(resource_type, resource_id, format: :hash, &block) ⇒ Object
- #resource_ids(resource_type, &block) ⇒ Object
Constructor Details
#initialize(connection, org) ⇒ OrganizationConnection
Returns a new instance of OrganizationConnection.
8 9 10 11 12 |
# File 'lib/xapixctl/phoenix_client/organization_connection.rb', line 8 def initialize(connection, org) @connection = connection @client = connection.client @org = org end |
Instance Attribute Details
#org ⇒ Object (readonly)
Returns the value of attribute org.
6 7 8 |
# File 'lib/xapixctl/phoenix_client/organization_connection.rb', line 6 def org @org end |
Instance Method Details
#apply(resource_description, &block) ⇒ Object
26 27 28 29 30 |
# File 'lib/xapixctl/phoenix_client/organization_connection.rb', line 26 def apply(resource_description, &block) result_handler(block). prepare_data(->(data) { data['resource_ids'] }). run { @client[generic_resource_path].put(resource_description.to_json, content_type: :json) } end |
#delete(resource_type, resource_id, &block) ⇒ Object
32 33 34 35 |
# File 'lib/xapixctl/phoenix_client/organization_connection.rb', line 32 def delete(resource_type, resource_id, &block) result_handler(block). run { @client[resource_path(resource_type, resource_id)].delete } end |
#resource(resource_type, resource_id, format: :hash, &block) ⇒ Object
14 15 16 17 18 |
# File 'lib/xapixctl/phoenix_client/organization_connection.rb', line 14 def resource(resource_type, resource_id, format: :hash, &block) result_handler(block). formatter(FORMATTERS[format]). run { @client[resource_path(resource_type, resource_id)].get } end |
#resource_ids(resource_type, &block) ⇒ Object
20 21 22 23 24 |
# File 'lib/xapixctl/phoenix_client/organization_connection.rb', line 20 def resource_ids(resource_type, &block) result_handler(block). prepare_data(->(data) { data['resource_ids'] }). run { @client[resources_path(resource_type)].get } end |