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.
11 12 13 14 15 |
# File 'lib/transcriptic_kit/client.rb', line 11 def initialize( = {}) @email = .with_indifferent_access[:email] @key = .with_indifferent_access[:key] @org_name = .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
31 32 33 34 35 36 37 38 |
# File 'lib/transcriptic_kit/client.rb', line 31 def method_missing(name, *args, &block) if self.class.resources.keys.include?(name) resources[name] ||= self.class.resources[name].new(connection: connection, org_name: @org_name) resources[name] else super end end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
9 10 11 |
# File 'lib/transcriptic_kit/client.rb', line 9 def email @email end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
9 10 11 |
# File 'lib/transcriptic_kit/client.rb', line 9 def key @key end |
#org_name ⇒ Object (readonly)
Returns the value of attribute org_name.
9 10 11 |
# File 'lib/transcriptic_kit/client.rb', line 9 def org_name @org_name end |
#org_url ⇒ Object (readonly)
Returns the value of attribute org_url.
9 10 11 |
# File 'lib/transcriptic_kit/client.rb', line 9 def org_url @org_url end |
Class Method Details
.resources ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/transcriptic_kit/client.rb', line 23 def self.resources { projects: ProjectResource, organization: OrganizationResource, runs: RunResource } end |
Instance Method Details
#connection ⇒ Object
17 18 19 20 21 |
# File 'lib/transcriptic_kit/client.rb', line 17 def connection Faraday.new() do |req| req.adapter :net_http end end |
#resources ⇒ Object
40 41 42 |
# File 'lib/transcriptic_kit/client.rb', line 40 def resources @resources ||= {} end |