amplify_syndication 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d2710bd59fa2d3c01b488bba30392f7bdf296741fbc698e8119c2a65c3ba5c33
4
+ data.tar.gz: d61cecb2245118e3db17c27c973c4c9a32f37d7f65f159bc48973da0c32edda4
5
+ SHA512:
6
+ metadata.gz: 707bb585b4afc0d5476d874464d477f2632d51df1d7a3bd76c56a6a0f1c863fa71cdc4e9b8fd74e8740040527beafe9a2e1a84ed028fd0148911c826fb747562
7
+ data.tar.gz: 54e3c195ab9a89484722166f2a1146227c85d65e8c0e47ee4aa70c28b6c5f35edbfb20aaa58bcc31aadf9527f51f9d2be887e8ebb25bc33cfdf4489cec409de0
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ ## 0.1.0
2
+
3
+ API Client for use with Amplify Syndication API
4
+
5
+ #### Includes API endpoints for
6
+ - property
7
+ - media
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Stephen Higgins
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,184 @@
1
+ # Amplify Syndication Gem
2
+
3
+ ## Overview
4
+
5
+ `amplify_syndication` is a Ruby gem that provides a simple interface to interact with the Amplify Syndication API. It includes methods to manage properties, media, and other related resources in real estate applications.
6
+
7
+ ---
8
+
9
+ ## Features
10
+
11
+ - Fetch and manage **Property** resources:
12
+ - Retrieve specific properties by `ListingKey`
13
+ - Query for properties with advanced filtering and sorting
14
+ - Fetch and manage **Media** resources:
15
+ - Retrieve specific media by `MediaKey`
16
+ - Query for media associated with properties, offices, and members
17
+ - Easy-to-use replication features for synchronizing data
18
+
19
+ ---
20
+
21
+ ## Installation
22
+
23
+ Add the gem to your Gemfile:
24
+
25
+ ```bash
26
+ gem 'amplify_syndication'
27
+ ```
28
+
29
+ Then run:
30
+
31
+ ```bash
32
+ bundle install
33
+ ```
34
+
35
+ Or install it manually:
36
+
37
+ ```bash
38
+ gem install amplify_syndication
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Configuration
44
+
45
+ You need to configure the base URL and access token for the Amplify Syndication API. Add the following to your application’s initializer or a setup script:
46
+
47
+ ```bash
48
+ AmplifySyndication.configure do |config|
49
+ config.base_url = "https://query.ampre.ca/odata"
50
+ config.access_token = "your_api_access_token_here"
51
+ end
52
+ ```
53
+
54
+ ---
55
+
56
+ ## Usage
57
+
58
+ ### Initialize the API
59
+
60
+ Create an instance of the API:
61
+
62
+ ```bash
63
+ api = AmplifySyndication::API.new
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Properties
69
+
70
+ ### Fetch Metadata
71
+
72
+ Retrieve metadata for the API:
73
+
74
+ ```bash
75
+ metadata = api.fetch_metadata
76
+ puts metadata
77
+ ```
78
+
79
+ ### Replication: Initial Download
80
+
81
+ Perform an initial download of properties for replication:
82
+
83
+ ```bash
84
+ properties = api.perform_initial_download(batch_size: 100)
85
+ puts "Downloaded #{properties.size} properties."
86
+ ```
87
+
88
+ ### Fetch Property by ListingKey
89
+
90
+ Retrieve full details of a property by its ListingKey:
91
+
92
+ ```bash
93
+ property = api.fetch_property_by_key("12345")
94
+ puts property
95
+ ```
96
+
97
+ ### Fetch Filtered Properties
98
+
99
+ Query for properties with advanced filtering:
100
+
101
+ ```bash
102
+ filtered_properties = api.fetch_filtered_properties(
103
+ filter: "City eq 'Toronto' and ListPrice gt 500000",
104
+ select: "ListingKey,City,ListPrice",
105
+ orderby: "ListPrice desc",
106
+ top: 10
107
+ )
108
+ puts filtered_properties
109
+ ```
110
+
111
+ ### Fetch Property Count
112
+
113
+ Get the total count of properties:
114
+
115
+ ```bash
116
+ count = api.fetch_property_count
117
+ puts "Total properties: #{count['@odata.count']}"
118
+ ```
119
+
120
+ ---
121
+
122
+ ## Media
123
+
124
+ ### Fetch Media by MediaKey
125
+
126
+ Retrieve full details of a media record by its MediaKey:
127
+
128
+ ```bash
129
+ media = api.fetch_media_by_key("61400d19-417e-4f43-b36e-efffb352a128")
130
+ puts media
131
+ ```
132
+
133
+ ### Fetch Media by Resource
134
+
135
+ Retrieve all media records associated with a specific resource:
136
+
137
+ ```bash
138
+ property_media = api.fetch_media_by_resource("Property", "12345")
139
+ puts property_media
140
+ ```
141
+
142
+ ### Fetch Recent Media
143
+
144
+ Query for recently created or modified media:
145
+
146
+ ```bash
147
+ recent_media = api.fetch_recent_media(
148
+ filter: "ResourceName eq 'Property'",
149
+ modification_date: "2023-12-01T00:00:00Z"
150
+ )
151
+ puts recent_media
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Error Handling
157
+
158
+ If an API call fails, the gem raises a StandardError with details of the HTTP response:
159
+
160
+ ```bash
161
+ begin
162
+ property = api.fetch_property_by_key("invalid_key")
163
+ rescue StandardError => e
164
+ puts "Error: #{e.message}"
165
+ end
166
+ ```
167
+
168
+ ---
169
+
170
+ ## Contributing
171
+
172
+ 1. Fork the repository
173
+ 2. Create a feature branch (git checkout -b feature/new-feature)
174
+ 3. Commit your changes (git commit -m 'Add a new feature')
175
+ 4. Push to the branch (git push origin feature/new-feature)
176
+ 5. Create a Pull Request
177
+
178
+ ---
179
+
180
+ Bug reports and pull requests are welcome on GitHub at https://github.com/gryphonandrook/amplify_syndication.
181
+
182
+ ## License
183
+
184
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ task default: %i[]
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AmplifySyndication
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "amplify_syndication/version"
4
+ require_relative "amplify_syndication/configuration"
5
+ require_relative "amplify_syndication/api"
6
+ require_relative "amplify_syndication/client"
7
+
8
+ module AmplifySyndication
9
+ class Error < StandardError; end
10
+ class << self
11
+ attr_accessor :configuration
12
+
13
+ def configure
14
+ self.configuration ||= Configuration.new
15
+ yield(configuration)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,4 @@
1
+ module AmplifySyndication
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: amplify_syndication
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Stephen Higgins
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-12-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httpclient
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.8'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.8'
27
+ description: Provides a Ruby interface for interacting with the Amplify Syndication
28
+ API.
29
+ email:
30
+ - stephen@gryphonandrook.com
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - CHANGELOG.md
36
+ - LICENSE.txt
37
+ - README.md
38
+ - Rakefile
39
+ - lib/amplify_syndication.rb
40
+ - lib/amplify_syndication/version.rb
41
+ - sig/amplify_syndication.rbs
42
+ homepage: https://github.com/gryphonandrook/amplify_syndication
43
+ licenses:
44
+ - MIT
45
+ metadata:
46
+ allowed_push_host: https://rubygems.org
47
+ homepage_uri: https://github.com/gryphonandrook/amplify_syndication
48
+ source_code_uri: https://github.com/gryphonandrook/amplify_syndication
49
+ changelog_uri: https://github.com/gryphonandrook/amplify_syndication/CHANGELOG.md
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: 3.0.0
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubygems_version: 3.4.19
66
+ signing_key:
67
+ specification_version: 4
68
+ summary: An API client for Amplify Syndication services
69
+ test_files: []