familyapp_sdk 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b04a0cdce14d7f6dd6e068f182e1444ce2da293c
4
- data.tar.gz: d082ea572d81a34ba66b2c147e0eb3a5dd3d34c2
3
+ metadata.gz: 01b294b1689f4cc87b6591d9055252893c3f5121
4
+ data.tar.gz: 2a54ce44d6abdd13ce044e6140b9a2db9c5f3b06
5
5
  SHA512:
6
- metadata.gz: 110e75d4e7453d85d3435e7e56cda2db54326727e2d3344816ef991e1ddd758fd43942bb1eef1400624ab619f9ff38668ee2500d8c061ff0eb88eab83167bbde
7
- data.tar.gz: f3ff2ab366d69a306c067192f2ee01a212e7581dd8649463d0864ffd806c3c26126f5f4b8b1780538487dc52949627fd1534a90ef24ee45f7c8f620b02667fff
6
+ metadata.gz: 66f9a9a58f54e5cfef7cdd3d88f6d8855c01a1033d64e89304943f517f9c2a65d73b91a1e9210ed5eb35ab058e0469c689e53d3ac2cd56e8441718cba9a9a9d6
7
+ data.tar.gz: 0a75189095e9c004ce271eefa141078e2231c38d5b01b97ad76db144ec61ac6c06b4f5b4edf460d0aa6fa0df9c5c99ab8e1d883e05812d21b7bc6b372ed1d60f
data/.DS_Store ADDED
Binary file
data/Dockerfile ADDED
@@ -0,0 +1,22 @@
1
+ FROM ruby:2.4.1
2
+ MAINTAINER lukasz.horonziak@stermedia.eu
3
+
4
+ # Install necesary dependecies
5
+ RUN rm /bin/sh && ln -s /bin/bash /bin/sh
6
+
7
+ RUN apt-get update -qq && apt-get install -y build-essential
8
+
9
+ # for nokogiri
10
+ RUN apt-get install -y libxml2-dev libxslt1-dev libgmp3-dev
11
+
12
+ # for bundler
13
+ RUN apt-get install -y git
14
+
15
+ # Create application directory
16
+ RUN mkdir -p /home/app/
17
+ WORKDIR /home/app/
18
+ RUN /bin/bash -l -c "gem install bundler"
19
+
20
+ RUN /bin/bash -l -c "bundle config build.nokogiri --use-system-libraries"
21
+
22
+ ADD . /home/app/
data/app/.DS_Store ADDED
Binary file
@@ -0,0 +1,13 @@
1
+ module FamilyappSdk
2
+ class WebhookController < ActionController::Base
3
+ def ensure_request_authorized
4
+ head :unauthorized if token_from_header != ::FamilyappSdk.config.verify_token
5
+ end
6
+
7
+ private
8
+
9
+ def token_from_header
10
+ request.headers['Authorization'].split.last unless request.headers['Authorization'].nil?
11
+ end
12
+ end
13
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ resource :webhook, only: [:create]
3
+ end
data/lib/.DS_Store ADDED
Binary file
@@ -0,0 +1,23 @@
1
+ require 'rest-client'
2
+
3
+ module FamilyappSdk
4
+ class Client
5
+ def self.update_profile(family_id, family_user_id, data)
6
+ url = "/bot_api/v1/families/#{family_id}/family_users/#{family_user_id}"
7
+ RestClient.patch(
8
+ FamilyappSdk.config.api_host + url,
9
+ data,
10
+ { Authorization: FamilyappSdk.config.access_token }
11
+ ) { |response, request, result| response }
12
+ end
13
+
14
+ def self.send(family_id, conversation_id, data)
15
+ url = "/bot_api/v1/families/#{family_id}/conversations/#{conversation_id}/messages"
16
+ RestClient.post(
17
+ FamilyappSdk.config.api_host + url,
18
+ data,
19
+ { Authorization: FamilyappSdk.config.access_token }
20
+ ) { |response, request, result| response }
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,11 @@
1
+ module FamilyappSdk
2
+ class Configuration
3
+ attr_accessor :access_token, :verify_token, :api_host
4
+
5
+ def initialize(access_token: nil, verify_token: nil, api_host: nil)
6
+ @access_token = access_token
7
+ @verify_token = verify_token
8
+ @api_host = api_host || 'https://api.familyapp.io'
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ require 'rails'
2
+
3
+ module FamilyappSdk
4
+ class Engine < ::Rails::Engine
5
+ isolate_namespace FamilyappSdk
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module FamilyappSdk
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: familyapp_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Familyapp API Team
@@ -87,17 +87,26 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
+ - ".DS_Store"
90
91
  - ".gitignore"
91
92
  - ".rspec"
92
93
  - ".travis.yml"
94
+ - Dockerfile
93
95
  - Gemfile
94
96
  - LICENSE.txt
95
97
  - README.md
96
98
  - Rakefile
99
+ - app/.DS_Store
100
+ - app/controller/familyapp_sdk/webhook_controller.rb
97
101
  - bin/console
98
102
  - bin/setup
103
+ - config/routes.rb
99
104
  - familyapp_sdk.gemspec
105
+ - lib/.DS_Store
100
106
  - lib/familyapp_sdk.rb
107
+ - lib/familyapp_sdk/client.rb
108
+ - lib/familyapp_sdk/configuration.rb
109
+ - lib/familyapp_sdk/engine.rb
101
110
  - lib/familyapp_sdk/version.rb
102
111
  homepage: http://rubygems.org/gems/familyapp_sdk
103
112
  licenses:
@@ -119,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
128
  version: '0'
120
129
  requirements: []
121
130
  rubyforge_project:
122
- rubygems_version: 2.6.13
131
+ rubygems_version: 2.5.2
123
132
  signing_key:
124
133
  specification_version: 4
125
134
  summary: Familyapp SDK