Class: DhanHQ::Models::Profile
- Defined in:
- lib/DhanHQ/models/profile.rb
Overview
Model for retrieving authenticated user profile and account information.
The User Profile API can be used to check the validity of access token and account setup. It is a simple GET request and serves as a great test API to start integration with DhanHQ. The profile contains account-level metadata including token validity, active segments, DDPI status, MTF consent, and Data API subscription status.
Constant Summary collapse
- HTTP_PATH =
Base path for profile retrieval.
"/v2/profile"
Constants included from ResponseHelper
ResponseHelper::STATUS_ERROR_FALLBACK
Instance Attribute Summary
Attributes inherited from BaseModel
Class Method Summary collapse
-
.fetch ⇒ Profile?
Fetches the authenticated user’s profile details and account information.
-
.resource ⇒ DhanHQ::Resources::Profile
Provides a shared instance of the Profile resource.
Methods inherited from BaseModel
all, api, api_type, #assign_attributes, attributes, create, #delete, #destroy, find, #id, #initialize, #new_record?, #optionchain_api?, parse_collection_response, #persisted?, resource_path, #save, #save!, #to_request_params, #update, #valid?, validate_attributes, validation_contract, #validation_contract, where
Methods included from APIHelper
Methods included from AttributeHelper
#camelize_keys, #inspect, #normalize_keys, #snake_case, #titleize_keys
Methods included from ValidationHelper
#valid?, #validate!, #validate_params!
Methods included from RequestHelper
Constructor Details
This class inherits a constructor from DhanHQ::BaseModel
Class Method Details
.fetch ⇒ Profile?
Fetches the authenticated user’s profile details and account information.
Retrieves account-level metadata including token validity, active segments, DDPI status, MTF consent status, and Data API subscription status. This is a simple GET request that serves as a great test API to verify your access token and account setup before starting integration.
118 119 120 121 122 123 |
# File 'lib/DhanHQ/models/profile.rb', line 118 def fetch response = resource.fetch return nil unless response.is_a?(Hash) new(response, skip_validation: true) end |
.resource ⇒ DhanHQ::Resources::Profile
Provides a shared instance of the Profile resource.
54 55 56 |
# File 'lib/DhanHQ/models/profile.rb', line 54 def resource @resource ||= DhanHQ::Resources::Profile.new end |