diff --git a/Gemfile.lock b/Gemfile.lock index ce0dac120..540d2f7a3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -67,7 +67,7 @@ GEM cocaine (0.5.8) climate_control (>= 0.0.3, < 1.0) coderay (1.1.1) - concurrent-ruby (1.0.2) + concurrent-ruby (1.0.5) daemons (1.2.4) database_cleaner (1.5.3) delayed_job (4.1.2) @@ -112,7 +112,7 @@ GEM activesupport (>= 4.1.0) http-cookie (1.0.3) domain_name (~> 0.5) - i18n (0.7.0) + i18n (0.8.1) json (1.8.3) json-schema-generator (0.0.9) jsonpath @@ -134,7 +134,7 @@ GEM mime-types-data (3.2016.0521) mimemagic (0.3.2) mini_portile2 (2.1.0) - minitest (5.9.1) + minitest (5.10.1) montrose (0.6.0) activesupport (>= 4.1, < 5.1) multi_json (1.12.1) @@ -203,7 +203,7 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rollbar (2.13.3) + rollbar (2.14.1) multi_json rspec (3.5.0) rspec-core (~> 3.5.0) @@ -232,7 +232,7 @@ GEM json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.0) - skylight (1.0.1) + skylight (1.2.2) activesupport (>= 3.0.0) slop (3.6.0) sprockets (3.7.0) @@ -247,8 +247,8 @@ GEM eventmachine (~> 1.0, >= 1.0.4) rack (>= 1, < 3) thor (0.19.4) - thread_safe (0.3.5) - tzinfo (1.2.2) + thread_safe (0.3.6) + tzinfo (1.2.3) thread_safe (~> 0.1) unf (0.1.4) unf_ext diff --git a/app/controllers/api/images_controller.rb b/app/controllers/api/images_controller.rb index 96374e97b..e4c20b601 100644 --- a/app/controllers/api/images_controller.rb +++ b/app/controllers/api/images_controller.rb @@ -1,5 +1,7 @@ module Api class ImagesController < Api::AbstractController + include Skylight::Helpers + BUCKET = ENV.fetch("GCS_BUCKET") { "YOU_MUST_CONFIG_GOOGLE_CLOUD_STORAGE" } KEY = ENV.fetch("GCS_KEY") { "" } SECRET = ENV.fetch("GCS_ID") { "" } @@ -8,6 +10,7 @@ module Api mutate Images::Create.run({device: current_device}, raw_json) end + instrument_method def index mutate Images::Fetch.run(device: current_device) end diff --git a/app/mutations/images/fetch.rb b/app/mutations/images/fetch.rb index f6e43bbe9..e05a00953 100644 --- a/app/mutations/images/fetch.rb +++ b/app/mutations/images/fetch.rb @@ -1,11 +1,14 @@ module Images class Fetch < Mutations::Command + include Skylight::Helpers + required do model :device, class: Device end + instrument_method def execute device.images.order(created_at: :desc).first(device.max_images_count) end end -end \ No newline at end of file +end diff --git a/app/serializers/image_serializer.rb b/app/serializers/image_serializer.rb index 3ea52baa5..668fee4c5 100644 --- a/app/serializers/image_serializer.rb +++ b/app/serializers/image_serializer.rb @@ -1,7 +1,9 @@ class ImageSerializer < ActiveModel::Serializer + include Skylight::Helpers attributes :id, :device_id, :attachment_processed_at, :updated_at, :created_at, :attachment_url, :meta + instrument_method def attachment_url object.attachment.url("x640") end