Class: TranscripticKit::Client
- Inherits:
-
Object
- Object
- TranscripticKit::Client
- Defined in:
- lib/transcriptic_kit/client.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#org_name ⇒ Object
readonly
Returns the value of attribute org_name.
-
#org_url ⇒ Object
readonly
Returns the value of attribute org_url.
Class Method Summary collapse
Instance Method Summary collapse
- #connection ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #method_missing(name, *args, &block) ⇒ Object
- #resources ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 |
# File 'lib/transcriptic_kit/client.rb', line 8 def initialize( = {}) @email = .with_indifferent_access[:email] @key = .with_indifferent_access[:key] @org_name = .with_indifferent_access[:org_name] @org_url = "https://secure.transcriptic.com/#{.with_indifferent_access[:org_name]}" end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/transcriptic_kit/client.rb', line 28 def method_missing(name, *args, &block) if self.class.resources.keys.include?(name) resources[name] ||= self.class.resources[name].new(connection: connection) resources[name] else super end end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
6 7 8 |
# File 'lib/transcriptic_kit/client.rb', line 6 def email @email end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
6 7 8 |
# File 'lib/transcriptic_kit/client.rb', line 6 def key @key end |
#org_name ⇒ Object (readonly)
Returns the value of attribute org_name.
6 7 8 |
# File 'lib/transcriptic_kit/client.rb', line 6 def org_name @org_name end |
#org_url ⇒ Object (readonly)
Returns the value of attribute org_url.
6 7 8 |
# File 'lib/transcriptic_kit/client.rb', line 6 def org_url @org_url end |
Class Method Details
.resources ⇒ Object
21 22 23 24 25 26 |
# File 'lib/transcriptic_kit/client.rb', line 21 def self.resources { projects: ProjectResource, organization: OrganizationResource } end |
Instance Method Details
#connection ⇒ Object
15 16 17 18 19 |
# File 'lib/transcriptic_kit/client.rb', line 15 def connection Faraday.new() do |req| req.adapter :net_http end end |
#resources ⇒ Object
37 38 39 |
# File 'lib/transcriptic_kit/client.rb', line 37 def resources @resources ||= {} end |