Class: PlatformSdk::Bynder::Client
- Inherits:
 - 
      Object
      
        
- Object
 - PlatformSdk::Bynder::Client
 
 
- Defined in:
 - lib/platform_sdk/bynder/client.rb
 
Constant Summary collapse
- INTEGRATION_ID =
          
Wordpress integration id
 "b242c16d-70f4-4101-8df5-87b35bbe56f0"
Instance Attribute Summary collapse
- 
  
    
      #access_token  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute access_token.
 - 
  
    
      #base_url  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute base_url.
 - 
  
    
      #conn  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute conn.
 
Instance Method Summary collapse
- #asset(asset_id) ⇒ Object
 - #assets(query_params = {}) ⇒ Object
 - #create_asset_usage(asset_id, uri, integration_id: INTEGRATION_ID) ⇒ Object
 - 
  
    
      #initialize(base_url, access_token, conn: nil)  ⇒ Client 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Client.
 - #remove_asset_usage(asset_id, uri, integration_id: INTEGRATION_ID) ⇒ Object
 
Constructor Details
#initialize(base_url, access_token, conn: nil) ⇒ Client
Returns a new instance of Client.
      10 11 12 13 14  | 
    
      # File 'lib/platform_sdk/bynder/client.rb', line 10 def initialize(base_url, access_token, conn: nil) @access_token = access_token @base_url = base_url @conn = conn || build_connection end  | 
  
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
      6 7 8  | 
    
      # File 'lib/platform_sdk/bynder/client.rb', line 6 def access_token @access_token end  | 
  
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
      6 7 8  | 
    
      # File 'lib/platform_sdk/bynder/client.rb', line 6 def base_url @base_url end  | 
  
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
      6 7 8  | 
    
      # File 'lib/platform_sdk/bynder/client.rb', line 6 def conn @conn end  | 
  
Instance Method Details
#asset(asset_id) ⇒ Object
      22 23 24 25 26  | 
    
      # File 'lib/platform_sdk/bynder/client.rb', line 22 def asset(asset_id) resource_path = "/api/v4/media" response = get(resource_path, { id: asset_id }) response.body end  | 
  
#assets(query_params = {}) ⇒ Object
      16 17 18 19 20  | 
    
      # File 'lib/platform_sdk/bynder/client.rb', line 16 def assets(query_params = {}) resource_path = "/api/v4/media" response = get(resource_path, query_params) response.body end  | 
  
#create_asset_usage(asset_id, uri, integration_id: INTEGRATION_ID) ⇒ Object
      28 29 30 31 32 33  | 
    
      # File 'lib/platform_sdk/bynder/client.rb', line 28 def create_asset_usage(asset_id, uri, integration_id: INTEGRATION_ID) resource_path = "/api/media/usage" body = { integration_id:, asset_id:, uri: } response = post(resource_path, body.to_json) response.body end  | 
  
#remove_asset_usage(asset_id, uri, integration_id: INTEGRATION_ID) ⇒ Object
      35 36 37 38 39  | 
    
      # File 'lib/platform_sdk/bynder/client.rb', line 35 def remove_asset_usage(asset_id, uri, integration_id: INTEGRATION_ID) resource_path = "/api/media/usage" response = delete(resource_path, { integration_id:, asset_id:, uri: }) response.body end  |