transcriptic_kit 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 43b5a0346f7056f9d306113ad326b0ba4808e4c1
4
- data.tar.gz: 341ddd4472e13d11fcb97187ed7e63cc3b1c10b9
3
+ metadata.gz: d75295f0e2fbd1f5ebf01dfee1504439f309b948
4
+ data.tar.gz: 1d29169396ed80422f96032cd9c880aa4202ee8b
5
5
  SHA512:
6
- metadata.gz: 91ba94b9e0b5fd9d970a4f3e4f422b464cc96c389971fc9bd1574ed36bc76d6b132042c578e9c647ac5b09472eb5635e7f68de8650c873e9c8a0fa7a95ce884d
7
- data.tar.gz: 89933f0e0fe0f0a4ae6b46b6d366b9ca5695ffa173784c6a7615dc710068dd6287331fcb782dd68fb577b5c49deba206581d9132551a78df8cd71bf27a5b72f4
6
+ metadata.gz: 82d2fbadfe90ffa58a49686f8c6885deb899e034410116e759ed2de19fe92c5925d5a9f4b8d4b0e5a3cdf0173b2e997bc919cc57d6bbe47024b1599999863a0f
7
+ data.tar.gz: fe34f6ed099d5b902e89238791dd3cac71c48229d73b86e1d58b88bd4ee85705db87eca2bce50460b4756895a40b6f62919c18f9da64f93f5fdccb09d3779f80
@@ -0,0 +1,3 @@
1
+ TRANSCRIPTIC_EMAIL=
2
+ TRANSCRIPTIC_API_KEY=
3
+ TRANSCRIPTIC_ORG_NAME_URL=
data/.gitignore CHANGED
@@ -8,3 +8,4 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  .env
11
+ *.gem
@@ -9,13 +9,14 @@ client = TranscripticKit::Client.new(
9
9
  org_name: ENV['TRANSCRIPTIC_ORG_NAME_URL']
10
10
  )
11
11
 
12
- ## Work with your Organization
12
+ # Work with your Organization
13
13
  puts client.organization.info.name
14
14
 
15
- ## Work with Projects
15
+ # Work with Projects
16
16
 
17
- ## Get all projects
17
+ # Get all projects
18
18
  projects = client.projects.all
19
+ puts projects
19
20
 
20
21
  ## Instantiate a new a project, then save it on the server
21
22
  project = TranscripticKit::Project.new(name: "My New Project", bsl:1)
@@ -25,12 +26,12 @@ puts project.bsl
25
26
  puts created.bsl
26
27
  # => 1
27
28
 
28
- project.bsl = "a"
29
+ project.bsl = "2"
29
30
  puts project.bsl
30
31
  # => 2
31
32
 
32
33
  ## Update on the server
33
- updated = client.projects.update(project, id: project.id)
34
+ updated = client.projects.update(project, id: created.id)
34
35
  puts updated.bsl
35
36
  # => 2
36
37
 
@@ -0,0 +1,25 @@
1
+ require './lib/transcriptic_kit'
2
+ require 'dotenv'
3
+ Dotenv.load
4
+
5
+ ## Create the API client
6
+ client = TranscripticKit::Client.new(
7
+ email: ENV['TRANSCRIPTIC_EMAIL'],
8
+ key: ENV['TRANSCRIPTIC_API_KEY'],
9
+ org_name: ENV['TRANSCRIPTIC_ORG_NAME_URL']
10
+ )
11
+
12
+ ## Fetch Runs
13
+ projects = client.projects.all
14
+ run = client.runs.all(project_id: projects[0].id)
15
+ puts "#{run.length} runs"
16
+
17
+ ## Submit Runs
18
+ string = '{"refs": {"working_sypro": {"new": "micro-1.5", "discard": true}, "milli_lyso": {"new": "micro-1.5", "discard": true}, "working_lyso": {"new": "micro-1.5", "discard": true}, "sypro_mm-1_2016-09-22": {"new": "micro-1.5", "discard": true}, "assay_plate": {"new": "96-pcr", "store": {"where": "cold_4"}}}, "outs": {"working_lyso": {"0": {"properties": {"concentration": "83:micromole / liter"}}}, "milli_lyso": {"0": {"properties": {"concentration": "0.83:millimole / liter"}}}, "sypro_mm-1_2016-09-22": {"0": {"name": "sypro_mm"}}}, "instructions": [{"to": [{"volume": "900.0:microliter", "well": "milli_lyso/0"}, {"volume": "100.0:microliter", "well": "milli_lyso/0"}], "op": "provision", "resource_id": "rs17gmh5wafm5p"}, {"to": [{"volume": "1.0:microliter", "well": "milli_lyso/0"}], "op": "provision", "resource_id": "rs18u5sv3y8haj"}, {"groups": [{"mix": [{"volume": "500:microliter", "well": "milli_lyso/0", "repetitions": 10, "speed": "100:microliter/second"}]}], "op": "pipette"}, {"to": [{"volume": "100.0:microliter", "well": "working_lyso/0"}], "op": "provision", "resource_id": "rs17gmh5wafm5p"}, {"groups": [{"transfer": [{"volume": "10.0:microliter", "to": "working_lyso/0", "from": "milli_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"mix": [{"volume": "500:microliter", "well": "working_lyso/0", "repetitions": 10, "speed": "100:microliter/second"}]}, {"mix": [{"volume": "200:microliter", "well": "working_sypro/0", "repetitions": 10, "speed": "50:microliter/second"}]}], "op": "pipette"}, {"to": [{"volume": "268.8:microliter", "well": "sypro_mm-1_2016-09-22/0"}], "op": "provision", "resource_id": "rs17gmh5wafm5p"}, {"to": [{"volume": "11.2:microliter", "well": "sypro_mm-1_2016-09-22/0"}], "op": "provision", "resource_id": "rs18xyxuedc3gp"}, {"reagent": "pbs", "object": "assay_plate", "columns": [{"column": 0, "volume": "35.0:microliter"}], "op": "dispense"}, {"groups": [{"distribute": {"to": [{"volume": "5.0:microliter", "well": "assay_plate/0"}, {"volume": "5.0:microliter", "well": "assay_plate/12"}, {"volume": "5.0:microliter", "well": "assay_plate/24"}, {"volume": "5.0:microliter", "well": "assay_plate/36"}, {"volume": "5.0:microliter", "well": "assay_plate/48"}, {"volume": "5.0:microliter", "well": "assay_plate/60"}, {"volume": "5.0:microliter", "well": "assay_plate/72"}, {"volume": "5.0:microliter", "well": "assay_plate/84"}, {"volume": "5.0:microliter", "well": "assay_plate/1"}, {"volume": "5.0:microliter", "well": "assay_plate/13"}, {"volume": "5.0:microliter", "well": "assay_plate/25"}, {"volume": "5.0:microliter", "well": "assay_plate/37"}, {"volume": "5.0:microliter", "well": "assay_plate/49"}, {"volume": "5.0:microliter", "well": "assay_plate/61"}, {"volume": "5.0:microliter", "well": "assay_plate/73"}, {"volume": "5.0:microliter", "well": "assay_plate/85"}, {"volume": "5.0:microliter", "well": "assay_plate/2"}, {"volume": "5.0:microliter", "well": "assay_plate/14"}, {"volume": "5.0:microliter", "well": "assay_plate/26"}, {"volume": "5.0:microliter", "well": "assay_plate/38"}, {"volume": "5.0:microliter", "well": "assay_plate/50"}, {"volume": "5.0:microliter", "well": "assay_plate/62"}, {"volume": "5.0:microliter", "well": "assay_plate/74"}, {"volume": "5.0:microliter", "well": "assay_plate/86"}, {"volume": "5.0:microliter", "well": "assay_plate/3"}, {"volume": "5.0:microliter", "well": "assay_plate/15"}, {"volume": "5.0:microliter", "well": "assay_plate/27"}, {"volume": "5.0:microliter", "well": "assay_plate/39"}, {"volume": "5.0:microliter", "well": "assay_plate/51"}, {"volume": "5.0:microliter", "well": "assay_plate/63"}, {"volume": "5.0:microliter", "well": "assay_plate/75"}, {"volume": "5.0:microliter", "well": "assay_plate/87"}, {"volume": "5.0:microliter", "well": "assay_plate/4"}, {"volume": "5.0:microliter", "well": "assay_plate/16"}, {"volume": "5.0:microliter", "well": "assay_plate/28"}, {"volume": "5.0:microliter", "well": "assay_plate/40"}, {"volume": "5.0:microliter", "well": "assay_plate/52"}, {"volume": "5.0:microliter", "well": "assay_plate/64"}, {"volume": "5.0:microliter", "well": "assay_plate/76"}, {"volume": "5.0:microliter", "well": "assay_plate/88"}], "from": "sypro_mm-1_2016-09-22/0", "allow_carryover": false}}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/0", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/12", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/24", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/36", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/48", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/60", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/72", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/84", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/1", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/13", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/25", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/37", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/49", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/61", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/73", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/85", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/2", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/14", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/26", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/38", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/50", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/62", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/74", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/86", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/3", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/15", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/27", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/39", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/51", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/63", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/75", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/87", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/4", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/16", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/28", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/40", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/52", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/64", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}, {"transfer": [{"volume": "2.0:microliter", "to": "assay_plate/76", "from": "working_lyso/0", "mix_after": {"volume": "25:microliter", "repetitions": 10, "speed": "100:microliter/second"}}]}], "op": "pipette"}, {"object": "assay_plate", "type": "ultra-clear", "op": "seal"}, {"acceleration": "2000:g", "duration": "2.0:minute", "object": "assay_plate", "op": "spin"}, {"dataref": "thermofluor", "melting": {"start": "25.00:celsius", "rate": "30.00:second", "end": "99.00:celsius", "increment": "0.50:celsius"}, "object": "assay_plate", "volume": "45:microliter", "groups": [{"cycles": 1, "steps": [{"duration": "30.0:second", "read": true, "temperature": "25.0:celsius"}]}], "dyes": {"FRET": ["A1", "B1", "C1", "D1", "E1", "F1", "G1", "H1", "A2", "B2", "C2", "D2", "E2", "F2", "G2", "H2", "A3", "B3", "C3", "D3", "E3", "F3", "G3", "H3", "A4", "B4", "C4", "D4", "E4", "F4", "G4", "H4", "A5", "B5", "C5", "D5", "E5", "F5", "G5", "H5"]}, "op": "thermocycle"}]}
19
+ '
20
+ protocol1 = JSON.parse(string)
21
+ new_run = TranscripticKit::Run.new(title: "gem test run", test_mode: true, protocol: protocol1)
22
+
23
+ resp = client.runs.create(new_run, project_id: projects[0].id)
24
+
25
+ puts "Run submitted with ID #{resp.id}"
@@ -13,14 +13,17 @@ module TranscripticKit
13
13
  require_relative 'transcriptic_kit/models/base_model'
14
14
  require_relative 'transcriptic_kit/models/project'
15
15
  require_relative 'transcriptic_kit/models/organization'
16
+ require_relative 'transcriptic_kit/models/run'
16
17
 
17
18
  # Resources
18
19
  require_relative 'transcriptic_kit/resources/project_resource'
19
20
  require_relative 'transcriptic_kit/resources/organization_resource'
21
+ require_relative 'transcriptic_kit/resources/run_resource'
20
22
 
21
23
  # JSON Maps
22
24
  require_relative 'transcriptic_kit/mappings/project_mapping'
23
25
  require_relative 'transcriptic_kit/mappings/organization_mapping'
26
+ require_relative 'transcriptic_kit/mappings/run_mapping'
24
27
 
25
28
  # Errors
26
29
  require_relative 'transcriptic_kit/mappings/error_mapping'
@@ -1,5 +1,8 @@
1
1
  require 'faraday'
2
2
 
3
+ TRANSCRIPTIC_URL = "https://secure.transcriptic.com/"
4
+
5
+
3
6
  module TranscripticKit
4
7
  class Client
5
8
 
@@ -9,7 +12,6 @@ module TranscripticKit
9
12
  @email = options.with_indifferent_access[:email]
10
13
  @key = options.with_indifferent_access[:key]
11
14
  @org_name = options.with_indifferent_access[:org_name]
12
- @org_url = "https://secure.transcriptic.com/#{options.with_indifferent_access[:org_name]}"
13
15
  end
14
16
 
15
17
  def connection
@@ -21,13 +23,14 @@ module TranscripticKit
21
23
  def self.resources
22
24
  {
23
25
  projects: ProjectResource,
24
- organization: OrganizationResource
26
+ organization: OrganizationResource,
27
+ runs: RunResource
25
28
  }
26
29
  end
27
30
 
28
31
  def method_missing(name, *args, &block)
29
32
  if self.class.resources.keys.include?(name)
30
- resources[name] ||= self.class.resources[name].new(connection: connection)
33
+ resources[name] ||= self.class.resources[name].new(connection: connection, org_name: @org_name)
31
34
  resources[name]
32
35
  else
33
36
  super
@@ -42,7 +45,7 @@ module TranscripticKit
42
45
 
43
46
  def connection_options
44
47
  {
45
- url: org_url,
48
+ url: TRANSCRIPTIC_URL + "/#{@org_name}",
46
49
  headers: {
47
50
  content_type: 'application/json',
48
51
  accept: 'application/json',
@@ -0,0 +1,14 @@
1
+ module TranscripticKit
2
+ class RunMapping
3
+ include Kartograph::DSL
4
+
5
+ kartograph do
6
+ mapping Run
7
+ root_key singular: 'run', scopes: [:update]
8
+
9
+ property :id, :title, :status, :created_at, :accepted_at, :started_at, :refs, :instructions, :updated_at, :completed_at, :results, :progress, :total_cost, :bsl, :owner, scopes: [:read]
10
+ property :title, :test_mode, :protocol, scopes: [:create]
11
+ # property :refs, :instructions, key: "protocol", scopes: [:create]
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ module TranscripticKit
2
+ class Run < BaseModel
3
+ [:id, :status, :title, :protocol, :created_at, :accepted_at, :started_at, :updated_at, :completed_at, :results,
4
+ :test_mode, :progress, :total_cost, :bsl, :protocol, :refs, :instructions, :owner].each do |key|
5
+ attribute(key)
6
+ end
7
+ #For creates
8
+ attribute :title
9
+ attribute :test_mode
10
+ attribute :protocol
11
+ end
12
+ end
@@ -1,9 +1,20 @@
1
1
  module TranscripticKit
2
2
  class OrganizationResource < ResourceKit::Resource
3
3
  include ErrorHandlingResourcable
4
+
5
+ def self.new(options)
6
+ @org_name = options[:org_name]
7
+
8
+ self.resources.each do |res|
9
+ res.instance_eval("@path = '#{@org_name}/#{res.path}'")
10
+ end
11
+
12
+ super(connection: options[:connection])
13
+ end
14
+
4
15
  resources do
5
16
  default_handler(:ok) {|r| OrganizationMapping.extract_single(r.body, :read) }
6
- get 'swiftpharma' => :info
17
+ get '' => :info
7
18
  end
8
19
  end
9
20
  end
@@ -2,6 +2,16 @@ module TranscripticKit
2
2
  class ProjectResource < ResourceKit::Resource
3
3
  include ErrorHandlingResourcable
4
4
 
5
+ def self.new(options)
6
+ @org_name = options[:org_name]
7
+
8
+ self.resources.each do |res|
9
+ res.instance_eval("@path = '#{@org_name}/#{res.path}'")
10
+ end
11
+
12
+ super(connection: options[:connection])
13
+ end
14
+
5
15
  resources do
6
16
  default_handler(422) { |response| ErrorMapping.extract_single(response.body, :read) }
7
17
  default_handler(:ok, :created) { |response| ProjectMapping.extract_single(response.body, :read) }
@@ -9,26 +19,27 @@ module TranscripticKit
9
19
 
10
20
  action :all do
11
21
  verb :get
12
- path 'swiftpharma/projects.json'
22
+ puts @org_name
23
+ path "projects.json"
13
24
  handler(200) { |response| ProjectMapping.extract_collection(response.body, :read) }
14
25
  end
15
26
 
16
27
  action :find do
17
28
  verb :get
18
- path ':id.json'
29
+ path ":id.json"
19
30
  handler(200) { |response| ProjectMapping.extract_single(response.body, :read) }
20
31
  end
21
32
 
22
33
  action :create do
23
34
  verb :post
24
- path 'swiftpharma'
35
+ path ""
25
36
  body { |object| ProjectMapping.representation_for(:create, object) }
26
37
  handler(202) { |response| ProjectMapping.extract_single(response.body, :read) }
27
38
  end
28
39
 
29
40
  action :update do
30
41
  verb :put
31
- path 'swiftpharma/:id'
42
+ path ":id"
32
43
  body { |object| ProjectMapping.representation_for(:update, object) }
33
44
  handler(200) { |response, object| ProjectMapping.extract_into_object(object, response.body, :read) }
34
45
  end
@@ -0,0 +1,47 @@
1
+ module TranscripticKit
2
+ class RunResource < ResourceKit::Resource
3
+ include ErrorHandlingResourcable
4
+
5
+ def self.new(options)
6
+ @org_name = options[:org_name]
7
+
8
+ self.resources.each do |res|
9
+ res.instance_eval("@path = '#{@org_name}/#{res.path}'")
10
+ end
11
+
12
+ super(connection: options[:connection])
13
+ end
14
+
15
+ resources do
16
+ default_handler(422) { |response| ErrorMapping.extract_single(response.body, :read) }
17
+ default_handler(:ok, :created) { |response| RunMapping.extract_single(response.body, :read) }
18
+ default_handler { |response| raise "Unexpected response status #{response.status}... #{response.inspect}" }
19
+
20
+ action :all do
21
+ verb :get
22
+ path ':project_id/runs.json'
23
+ handler(200) { |response| RunMapping.extract_collection(response.body, :read) }
24
+ end
25
+
26
+ action :find do
27
+ verb :get
28
+ path ':project_id/runs/:run_id.json'
29
+ handler(200) { |response| RunMapping.extract_single(response.body, :read) }
30
+ end
31
+
32
+ action :create do
33
+ verb :post
34
+ path ':project_id/runs'
35
+ body { |object| RunMapping.representation_for(:create, object) }
36
+ handler(202) { |response| RunMapping.extract_single(response.body, :read) }
37
+ end
38
+
39
+ action :update do
40
+ verb :put
41
+ path ':project_id/:run_id'
42
+ body { |object| RunMapping.representation_for(:update, object) }
43
+ handler(200) { |response, object| RunMapping.extract_into_object(object, response.body, :read) }
44
+ end
45
+ end
46
+ end
47
+ end
@@ -1,3 +1,3 @@
1
1
  module TranscripticKit
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transcriptic_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Miles
@@ -135,6 +135,7 @@ executables: []
135
135
  extensions: []
136
136
  extra_rdoc_files: []
137
137
  files:
138
+ - ".env.sample"
138
139
  - ".gitignore"
139
140
  - ".rspec"
140
141
  - ".travis.yml"
@@ -145,19 +146,22 @@ files:
145
146
  - Rakefile
146
147
  - bin/console
147
148
  - bin/setup
148
- - example.rb
149
+ - examples/example.rb
150
+ - examples/run_example.rb
149
151
  - lib/transcriptic_kit.rb
150
152
  - lib/transcriptic_kit/client.rb
151
- - lib/transcriptic_kit/configuration.rb
152
153
  - lib/transcriptic_kit/error_handling_resourcable.rb
153
154
  - lib/transcriptic_kit/mappings/error_mapping.rb
154
155
  - lib/transcriptic_kit/mappings/organization_mapping.rb
155
156
  - lib/transcriptic_kit/mappings/project_mapping.rb
157
+ - lib/transcriptic_kit/mappings/run_mapping.rb
156
158
  - lib/transcriptic_kit/models/base_model.rb
157
159
  - lib/transcriptic_kit/models/organization.rb
158
160
  - lib/transcriptic_kit/models/project.rb
161
+ - lib/transcriptic_kit/models/run.rb
159
162
  - lib/transcriptic_kit/resources/organization_resource.rb
160
163
  - lib/transcriptic_kit/resources/project_resource.rb
164
+ - lib/transcriptic_kit/resources/run_resource.rb
161
165
  - lib/transcriptic_kit/version.rb
162
166
  - transcriptic_kit.gemspec
163
167
  homepage: https://github.com/bmiles/transcriptic_kit
@@ -1,11 +0,0 @@
1
- module Transcriptic
2
- class Configuration
3
- attr_accessor :transcriptic_email, :transcriptic_api_key, :transcriptic_org_name_url
4
-
5
- def initialize
6
- @transcriptic_email = nil
7
- @transcriptic_api_key = nil
8
- @transcriptic_org_name_url = nil
9
- end
10
- end
11
- end