This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FactoryBot.define do | |
| factory :lead_photo do | |
| document_type, name: Faker::Lorem.sentence, code: Faker::Lorem.word # If Faker doesn't work, you can also try something like Time.now.to_s, so it's always a unique string. | |
| lead | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "rails_helper" | |
| describe MediaItem, ldap: :stub do | |
| describe "validations" do | |
| describe "#attachment" do | |
| context "when there is a device" do | |
| let(:device) { build_stubbed(:mobile_device) } | |
| let(:media_item) { build_stubbed(:media_item, device: device) } | |
| it "should be valid" do | |
| expect(media_item).to be_valid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "frequent_contacts": [ | |
| { | |
| "frequent_contact_type": "ConnectRoom", | |
| "frequent_contact_id": 7904, | |
| "message_count": 32 | |
| }, | |
| { | |
| "frequent_contact_type": "ConnectRoom", | |
| "frequent_contact_id": 7907, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Verb Endpoint Rails Controller Action | |
| GET /api/v3/connect/state(.:format) api/v3/connect/state#index {:format=>"json"} | |
| GET /api/v3/connect/bookmarks(.:format) api/v3/connect/bookmarks#index {:format=>"json"} | |
| POST /api/v3/connect/bookmarks(.:format) api/v3/connect/bookmarks#create {:format=>"json"} | |
| DELETE /api/v3/connect/bookmarks/:id(.:format) api/v3/connect/bookmarks#destroy {:format=>"json"} | |
| PUT|PATCH /api/v3/connect/bookmarks(.:format) api/v3/connect/bookmarks#update {:format=>"json"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "version": 1541, | |
| "rooms": [ | |
| { | |
| "id": 1699103, | |
| "bookmarkable_type": "ConnectRoom", | |
| "bookmarkable_id": 7148 | |
| }, | |
| { | |
| "id": 1487573, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| payload = { title: "Greg Blake", | |
| body: ConnectMessage.find(24705809).body, | |
| data: { | |
| sound: "NitroNotification.caf", | |
| user_id: 31995, | |
| badge: 1, | |
| category: "connect-reply", | |
| "message-type": "connect", | |
| "as-of": Time.current.iso8601, | |
| "nitro-environment": Rails.env, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "rooms": { | |
| "1": { | |
| "id": 1, | |
| "name": "My Private Room", | |
| "private": true, | |
| "archived": false, | |
| "broadcaster_user_ids": [], | |
| "owner_user_ids": [], | |
| "interested_user_ids": [], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| irb(main):006:0> room = ConnectRoom.last | |
| => #<ConnectRoom id: 9974, name: "820am", jid: nil, created_at: "2018-05-01 12:20:10", updated_at: "2018-05-01 12:20:10", created_by_id: 31995, updated_by_id: nil, private: true, archived: false, corporate_event_id: nil, short_name: nil, connect_updated_at: "2018-05-01 12:20:10", group_conversation: false> | |
| irb(main):007:0> room.connect_bookmarks.count | |
| => 1 | |
| irb(main):008:0> bookmark = room.connect_bookmarks.first | |
| => #<ConnectBookmark id: 2296652, user_id: 31995, bookmarkable_id: 9974, bookmarkable_type: "ConnectRoom", section: "rooms", created_at: "2018-05-01 12:20:10", updated_at: "2018-05-01 12:20:10", position: 1> | |
| irb(main):009:0> room.created_at == bookmark.created_at | |
| => true | |
| irb(main):010:0> bookmark.created_at | |
| => Tue, 01 May 2018 08:20:10 EDT -04:00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def show | |
| project_photo = ProjectPhoto.find(params[:id]) | |
| if project_photo.media_item? | |
| media_item = # Some method to lookup the media_item associated with the project_photo | |
| render json: media_item.as_json | |
| else | |
| # You have at least 2 options here. You could: | |
| # 1) refactor the project_photo Boxer representation into a similar as_json method, or | |
| # 2) Modify the existing project_photo Boxer representation, and render the json using Boxer. | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="media"> | |
| <div class="media-left"> | |
| <a href="javascript:void(0)"> | |
| <img class="media-object img-rounded" src="/assets/connect-logo.png" alt="Connect logo" width="72" height="72"> | |
| </a> | |
| </div> | |
| <div class="media-body"> | |
| <h2 class="media-heading">Connect for Android</h2> | |
| <p>Version 1</p> | |
| </div> |