rapidapi 0.1.1 → 0.1.2

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: 01b14bc1e880d4594f2b67229d36bc10eb278926
4
- data.tar.gz: 40f5aa9ebe55980f05d01773c530a915dafa059f
3
+ metadata.gz: 1ce57a28128fe74a9719ed9c6b25952ab8ea6ea2
4
+ data.tar.gz: 2b3235bae870282e102046d24596fd72e24829d0
5
5
  SHA512:
6
- metadata.gz: 94d36fe4917b65a016453bd1dc4d5219fe09cc3a7907a51eb16983edc8e21778fa08d238198fefd2348684525335c2fd2b0f93b1c8c0dbc28e53e57c2c7bd74a
7
- data.tar.gz: 762de32d4dd3b08021a037c30f082f11d492fc9d761ba7fd32cc66b0ae680d163510f10ae338416e2b57615002dd30bac57cf9137eb3f25e8feea0cac143223f
6
+ metadata.gz: 66ce83fe19adf4e8397a4b99f04d2236ca35ddbd8add5c65419bceebacda932a3add7181d4c91e6a1265fd0d7d5a7894a0988fbf9d88be75c967776f68a2607b
7
+ data.tar.gz: 8079069621d353646a7aabdeed66ff07b20e59febec1018c5ad877d94c47458cf8253e465728ee97893f302ac19340e31dd2beb1530e7516ae124d933c7c2da2
data/README.md CHANGED
@@ -0,0 +1,99 @@
1
+ <p align="center">
2
+ <img src="https://storage.googleapis.com/rapid_connect_static/static/github-header.png" width=350 />
3
+ </p>
4
+
5
+ ## Overview
6
+ RapidAPI is the world's first opensource API marketplace. It allows developers to discover and connect to the world's top APIs more easily and manage multiple API connections in one place.
7
+
8
+ ## iOS SDK
9
+ * In case you're using [CocoaPods](https://cocoapods.org), add the following line to your `Podfile`:
10
+
11
+ ```ruby
12
+ pod "RapidAPISDK", "~> 0.1"
13
+ ```
14
+
15
+ * Otherwise, you can add RapidAPISDK manually to your Xcode project.
16
+ 1. Go to the [releases tab](https://github.com/RapidSoftwareSolutions/rapidapi-ios-sdk/releases).
17
+ 2. Download the latest release zip.
18
+ 3. Unzip the file and drag the *RapidConnectSDK.framework* directory to the "Frameworks" folder in your project.
19
+
20
+ ## Initialization
21
+ Import RapidAPISDK by putting the following code in your header file
22
+
23
+ ```objective-c
24
+ #import <RapidConnectSDK/RapidConnectSDK.h>
25
+ ```
26
+
27
+ Now initialize it using:
28
+
29
+ ```objective-c
30
+ RapidConnect *rapid = [[RapidConnect alloc] initWithProjectName:@"PROJECT_NAME" andToken:@"TOKEN"];
31
+ ```
32
+ ## Usage
33
+ To use any block in the marketplace, just copy it's code snippet and paste it in your code. For example, the following is the snippet for the **Delivery.sendSMS** block:
34
+
35
+ ```objective-c
36
+ [rapid callPackage:@"Delivery" block:@"sendSMS"
37
+ withParameters:[NSDictionary dictionaryWithObjectsAndKeys:
38
+ @"Hello from RapidAPI!",@"message",
39
+ @"4158496404", @"number",
40
+ nil]
41
+ success:^(NSDictionary *responseDict) {
42
+
43
+ // response handling here ...
44
+ NSLog(@"%@",responseDict);
45
+
46
+ } failure:^(NSError *error) {
47
+ // error handling here ...
48
+ NSLog(@"%@",[error localizedDescription]);
49
+ ```
50
+
51
+
52
+ **Notice** that the `error` event will also be called if you make an invalid block call (for example - the package you refer to does not exist).
53
+
54
+ ## Using Files
55
+ Whenever a block in RapidAPI requires a file, you can either pass a URL to the file or a read stream.
56
+
57
+ #### URL
58
+ The following code will call the block MicrosoftComputerVision.analyzeImage with a URL of an image:
59
+
60
+ ```objective-c
61
+ [rapid callPackage:@"MicrosoftComputerVision" block:@"analyzeImage"
62
+ withParameters:[NSDictionary dictionaryWithObjectsAndKeys:
63
+ @"XXXXXXXXXXXXXXXXXXX",@"subscriptionKey",
64
+ @"http://example.com/file.jpg", @"image",
65
+ nil]
66
+ success:^(NSDictionary *responseDict) {
67
+ NSLog(@"%@",responseDict);
68
+ } failure:^(NSError *error) {
69
+ // error handling here ...
70
+ NSLog(@"%@",[error localizedDescription]);
71
+ ```
72
+
73
+ #### Post File
74
+ If the file is locally stored, you can read it using `NSFileManager` and pass the read stream to the block, like the following:
75
+
76
+ ```objective-c
77
+ NSData *data = [[NSFileManager defaultManager] contentsAtPath:@"path/to/the/file.jpg"];
78
+
79
+ [rapid callPackage:@"MicrosoftComputerVision" block:@"analyzeImage"
80
+ withParameters:[NSDictionary dictionaryWithObjectsAndKeys:
81
+ @"XXXXXXXXXXXXXXXXXXX",@"subscriptionKey",
82
+ data, @"image",
83
+ nil]
84
+ success:^(NSDictionary *responseDict) {
85
+ NSLog(@"%@",responseDict);
86
+ } failure:^(NSError *error) {
87
+ // error handling here ...
88
+ NSLog(@"%@",[error localizedDescription]);
89
+ ```
90
+
91
+ ##Issues:
92
+
93
+ As this is a pre-release version of the SDK, you may expirience bugs. Please report them in the issues section to let us know. You may use the intercom chat on rapidapi.com for support at any time.
94
+
95
+ ##License:
96
+
97
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
98
+
99
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -6,7 +6,7 @@ end
6
6
  class RapidAPI::Config
7
7
  def self.setup(**args)
8
8
  @@project = args[:project]
9
- @@api_key = args[:api_key]
9
+ @@token = args[:token]
10
10
  return
11
11
  end
12
12
 
@@ -14,7 +14,7 @@ class RapidAPI::Config
14
14
  @@project || raise(MissingCredentialsError, 'Project name not set')
15
15
  end
16
16
 
17
- def self.api_key
18
- @@api_key || raise(MissingCredentialsError, 'API key not set')
17
+ def self.token
18
+ @@token || raise(MissingCredentialsError, 'Token not set')
19
19
  end
20
20
  end
@@ -1,3 +1,3 @@
1
1
  module RapidAPI
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
@@ -36,7 +36,7 @@ module RapidAPI
36
36
  config = RapidAPI::Config
37
37
 
38
38
  req = Net::HTTP::Post::Multipart.new(uri, form_data)
39
- req.basic_auth(config.project, config.api_key)
39
+ req.basic_auth(config.project, config.token)
40
40
 
41
41
  req
42
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rapidapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Bukati